A secure file storage and sharing platform with deduplication capabilities.
NOTE: This has been configured to have maximum size of 5MB per normal user, and 10MB per premium/entreprise users!
- Docker & Docker Compose
- Git
git clone this repo
cd Vaultman
cp .env.example backend/.env
cd backend
docker-compose up -d
go run cmd/server/main.goLIkewise make frontend run by
cd frontend
npm install
ng serveAccess at: http://localhost
FIrst register in the register page.
LOgin using the username and password set.
Please go to My Files to view or upload files.
To share, click on the share button. Enter the email of the recipient and give permissions for view alone or to download
UNder shared section, the files shared to you, and also by you are visible.
You can view or download (if permission given) other's shared files, as well as your ones
- User registration and login
- JWT-based session management
- Role-based access (admin/user)
- Secure logout with session cleanup
- File upload with drag & drop
- File listing and management
- File download
- File deletion
- Storage deduplication (saves space for duplicate files)
- Real-time storage statistics
- File count and storage usage tracking
- Deduplication savings display
- User-specific dashboard
- Responsive Material Design interface
- Real-time user state management
- Loading states and error handling
- Public file links
- Permission management for shared files
- File versioning
- Folder organization
- File search and filtering
- Bulk operations
- File preview
- User management
- System-wide analytics
- Storage quota management
- File encryption at rest
- Rate limiting
- Audit logging
- File virus scanning
cmd/server/
internal/
├── database/
├── services/
├── middleware/
└── models/
src/app/
├── auth/
├── components/
├── services/
├── pages/
└── shared/
- Separation of concerns: Clear distinction between UI, business logic, and data layers
- Stateless API: JWT tokens for authentication, no server-side sessions
- File deduplication: SHA-256 hashing prevents duplicate storage
- Reactive UI: RxJS observables for real-time state updates
users(id, username, email, password_hash, role, account_type, status, created_at, last_login_at)
- Primary key: id (UUID)
- Unique: username, email
- Indexes: email
files(id, name, original_name, size, mime_type, file_path, checksum, owner_id, is_public, download_count, upload_date, deleted_at)
- Primary key: id (UUID)
- Foreign key: owner_id → users(id)
- Indexes: owner_id, checksum
- Checksum used for deduplication
file_shares(id, file_id, owner_id, shared_with_email, permissions, created_at)
- Primary key: id (UUID)
- Foreign keys: file_id → files(id), owner_id → users(id)
- Indexes: file_id
Register a new user account.
Request:
{
"username": "johndoe",
"email": "john@example.com",
"password": "securepassword"
}Response:
{
"success": true,
"message": "Registration successful",
"user": {
"id": "uuid",
"username": "johndoe",
"email": "john@example.com",
"role": "user"
},
"token": "jwt_token_here"
}Authenticate user and receive JWT token.
Request:
{
"email": "john@example.com",
"password": "securepassword"
}Get current authenticated user information.
Headers: Authorization: Bearer <token>
Response:
{
"success": true,
"data": {
"id": "uuid",
"username": "johndoe",
"email": "john@example.com",
"role": "user"
}
}List all files for authenticated user.
Headers: Authorization: Bearer <token>
Response:
{
"success": true,
"data": [
{
"id": "file_uuid",
"name": "document.pdf",
"size": 1048576,
"mimeType": "application/pdf",
"uploadDate": "2024-01-15T10:30:00Z",
"downloadCount": 5,
"isDuplicate": false
}
]
}Upload a new file with automatic deduplication.
Headers:
Authorization: Bearer <token>Content-Type: multipart/form-data
Body: Form data with file field
Response:
{
"success": true,
"message": "File uploaded successfully",
"data": {
"id": "new_file_uuid",
"name": "document.pdf",
"size": 1048576,
"isDuplicate": false
}
}Delete a file (soft delete).
Headers: Authorization: Bearer <token>
Download file content.
Headers: Authorization: Bearer <token>
Response: File binary data
Get storage statistics for authenticated user.
Headers: Authorization: Bearer <token>
Response:
{
"success": true,
"data": {
"totalFiles": 25,
"actualStorageUsed": 52428800,
"duplicateFiles": 3,
"storageSaved": 10485760,
"savingsPercentage": 16.7
}
}List all users (admin only).
Get system-wide statistics (admin only).
cd backend
go mod download
createdb file_vault
go run cmd/server/main.gocd frontend
npm install
ng serveDB_HOST=localhost
DB_PORT=5432
DB_NAME=file_vault
DB_USER=postgres
DB_PASSWORD=password
PORT=8080
export const environment = {
production: false,
apiUrl: 'http://localhost:8080/api'
};cd backend
go test ./...cd frontend
npm test