mohsin-devs commited on
Commit
5101a73
Β·
1 Parent(s): 3342f91

Fix README - restore complete content with proper YAML frontmatter

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