Spaces:
Running
Running
Delete README.md
Browse files
README.md
DELETED
|
@@ -1,171 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: DocVault App
|
| 3 |
-
emoji: 📁
|
| 4 |
-
colorFrom: blue
|
| 5 |
-
colorTo: purple
|
| 6 |
-
sdk: docker
|
| 7 |
-
pinned: false
|
| 8 |
-
---
|
| 9 |
-
|
| 10 |
-
# DocVault - Offline-First Document Storage System
|
| 11 |
-
|
| 12 |
-
Complete offline-first document storage system built with **Python Flask** and local filesystem storage. No cloud dependencies, fully self-contained, and ready for future Hugging Face integration.
|
| 13 |
-
|
| 14 |
-
## 🎯 Features
|
| 15 |
-
|
| 16 |
-
### Core Features
|
| 17 |
-
- ✅ **Create Files and Folders** - Including nested directory structures
|
| 18 |
-
- ✅ **Delete Items** - Individual files/folders or bulk deletion
|
| 19 |
-
- ✅ **Upload Files** - Support for 50+ file types
|
| 20 |
-
- ✅ **List Contents** - Browse file/folder hierarchy with metadata
|
| 21 |
-
- ✅ **Rename Items** - Rename files and folders
|
| 22 |
-
- ✅ **Security** - Path traversal prevention, input validation
|
| 23 |
-
- ✅ **Logging** - Comprehensive logging with rotation
|
| 24 |
-
- ✅ **File Metadata** - Size, creation time, modification time
|
| 25 |
-
- ✅ **Multi-User** - Support for multiple users via user IDs
|
| 26 |
-
|
| 27 |
-
### Storage
|
| 28 |
-
- Local filesystem storage in `data/{user_id}/` structure
|
| 29 |
-
- Automatic marker files (`.gitkeep`) for HF integration compatibility
|
| 30 |
-
- Prevents duplicate filenames with auto-numbering
|
| 31 |
-
- Maintains clean directory structure
|
| 32 |
-
|
| 33 |
-
## 📁 Project Structure
|
| 34 |
-
|
| 35 |
-
```
|
| 36 |
-
.
|
| 37 |
-
├── server/
|
| 38 |
-
│ ├── app.py # Flask application
|
| 39 |
-
│ ├── config.py # Configuration settings
|
| 40 |
-
│ ├── requirements.txt # Python dependencies
|
| 41 |
-
│ ├── routes/
|
| 42 |
-
│ │ └── api.py # API endpoints
|
| 43 |
-
│ ├── storage/
|
| 44 |
-
│ │ └── manager.py # Storage operations
|
| 45 |
-
│ └── utils/
|
| 46 |
-
│ ├── logger.py # Logging setup
|
| 47 |
-
│ └── validators.py # Path validation & security
|
| 48 |
-
├── data/ # Storage directory (auto-created)
|
| 49 |
-
├── logs/ # Log files (auto-created)
|
| 50 |
-
├── tests/
|
| 51 |
-
│ ├── test_docvault.py # Unit tests
|
| 52 |
-
│ └── test_api.sh # API test script
|
| 53 |
-
├── index.html # Frontend UI
|
| 54 |
-
├── app.js # Frontend app logic
|
| 55 |
-
├── styles.css # Frontend styles
|
| 56 |
-
└── README.md # This file
|
| 57 |
-
```
|
| 58 |
-
|
| 59 |
-
## 🚀 Getting Started
|
| 60 |
-
|
| 61 |
-
### Prerequisites
|
| 62 |
-
- Python 3.8+
|
| 63 |
-
- pip or conda
|
| 64 |
-
|
| 65 |
-
### Installation
|
| 66 |
-
|
| 67 |
-
1. **Clone the repository**
|
| 68 |
-
```bash
|
| 69 |
-
git clone <your-repo-url>
|
| 70 |
-
cd DocVault
|
| 71 |
-
```
|
| 72 |
-
|
| 73 |
-
2. **Install dependencies**
|
| 74 |
-
```bash
|
| 75 |
-
pip install -r server/requirements.txt
|
| 76 |
-
```
|
| 77 |
-
|
| 78 |
-
3. **Run the application**
|
| 79 |
-
```bash
|
| 80 |
-
python server/app.py
|
| 81 |
-
```
|
| 82 |
-
|
| 83 |
-
4. **Access the app**
|
| 84 |
-
- Open browser to `http://localhost:5000`
|
| 85 |
-
|
| 86 |
-
## 📝 API Endpoints
|
| 87 |
-
|
| 88 |
-
### File Operations
|
| 89 |
-
- `POST /api/create` - Create file or folder
|
| 90 |
-
- `DELETE /api/delete` - Delete file or folder
|
| 91 |
-
- `PUT /api/rename` - Rename item
|
| 92 |
-
- `POST /api/upload` - Upload file
|
| 93 |
-
- `GET /api/list/<path>` - List directory contents
|
| 94 |
-
|
| 95 |
-
### Request Examples
|
| 96 |
-
|
| 97 |
-
**Create File:**
|
| 98 |
-
```bash
|
| 99 |
-
curl -X POST http://localhost:5000/api/create \
|
| 100 |
-
-H "Content-Type: application/json" \
|
| 101 |
-
-d '{"user_id":"default_user","item_type":"file","name":"test.txt","path":"/"}'
|
| 102 |
-
```
|
| 103 |
-
|
| 104 |
-
**Upload File:**
|
| 105 |
-
```bash
|
| 106 |
-
curl -X POST http://localhost:5000/api/upload \
|
| 107 |
-
-F "user_id=default_user" \
|
| 108 |
-
-F "file=@localfile.txt" \
|
| 109 |
-
-F "path=/"
|
| 110 |
-
```
|
| 111 |
-
|
| 112 |
-
**List Contents:**
|
| 113 |
-
```bash
|
| 114 |
-
curl http://localhost:5000/api/list/default_user/
|
| 115 |
-
```
|
| 116 |
-
|
| 117 |
-
## 🧪 Testing
|
| 118 |
-
|
| 119 |
-
Run the test suite:
|
| 120 |
-
```bash
|
| 121 |
-
python -m pytest tests/test_docvault.py -v
|
| 122 |
-
```
|
| 123 |
-
|
| 124 |
-
Or use the included API test script:
|
| 125 |
-
```bash
|
| 126 |
-
bash tests/test_api.sh
|
| 127 |
-
```
|
| 128 |
-
|
| 129 |
-
## 🔒 Security Features
|
| 130 |
-
|
| 131 |
-
- **Path Traversal Prevention** - Validates all paths to prevent directory escape attacks
|
| 132 |
-
- **Input Validation** - Sanitizes filenames and paths
|
| 133 |
-
- **User Isolation** - Each user has their own data directory
|
| 134 |
-
- **Error Handling** - Comprehensive error messages without exposing system details
|
| 135 |
-
|
| 136 |
-
## 📊 Logging
|
| 137 |
-
|
| 138 |
-
- Logs stored in `logs/` directory
|
| 139 |
-
- Automatic log rotation (10 MB per file, 10 files kept)
|
| 140 |
-
- Levels: DEBUG, INFO, WARNING, ERROR, CRITICAL
|
| 141 |
-
|
| 142 |
-
## 🚢 Deployment
|
| 143 |
-
|
| 144 |
-
### Docker
|
| 145 |
-
```bash
|
| 146 |
-
docker build -t docvault .
|
| 147 |
-
docker run -p 5000:5000 docvault
|
| 148 |
-
```
|
| 149 |
-
|
| 150 |
-
### Hugging Face Spaces
|
| 151 |
-
This app is ready for deployment on Hugging Face Spaces as a static frontend application.
|
| 152 |
-
|
| 153 |
-
## 📦 Dependencies
|
| 154 |
-
|
| 155 |
-
- Flask 2.3.2
|
| 156 |
-
- Werkzeug 2.3.6
|
| 157 |
-
- Python 3.8+
|
| 158 |
-
|
| 159 |
-
See `server/requirements.txt` for full list.
|
| 160 |
-
|
| 161 |
-
## 📄 License
|
| 162 |
-
|
| 163 |
-
MIT License
|
| 164 |
-
|
| 165 |
-
## 🤝 Contributing
|
| 166 |
-
|
| 167 |
-
Contributions welcome! Please feel free to submit a Pull Request.
|
| 168 |
-
|
| 169 |
-
## 📧 Support
|
| 170 |
-
|
| 171 |
-
For issues or questions, please open an Issue on GitHub.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|