A production-ready file management system with React frontend and FastAPI backend, featuring user authentication, role-based access control, and cloud storage integration.
/src β React + TypeScript frontend
/backend β FastAPI + PostgreSQL backend
/docs β Documentation
- π JWT Authentication - Secure login with token-based auth
- π₯ User Management - Admin panel for user administration
- π File Upload - Drag & drop with multiple file support
- π Public/Private Files - Control file visibility
- π Folder Management - Organize files in folders with breadcrumbs
- π Shareable Links - Friendly URLs for public files (e.g.,
/api/public/my-document-abc123) - π File Browser - Browse, search, and filter files
- ποΈ File Preview - View files inline in browser
- β¬οΈ Download - Download files with original names
- π‘οΈ User Isolation - Users only see their own files
- π¨βπΌ Admin Role - Admins have full access to all files and users
- π Password Hashing - Secure password storage
- π« Route Protection - Protected routes for authenticated users only
- π UI Authorization - Admin sections hidden from regular users
- βοΈ Cloud Storage - Garage S3-compatible storage integration
- π¦ Organized Storage - Files stored with unique keys and prefixes
- π·οΈ Metadata - Rich file metadata (type, tags, description, custom names)
- React 18 + TypeScript
- Vite
- React Router v6
- Zustand (state management)
- Shadcn UI components
- TailwindCSS
- React Dropzone
- Sonner (toast notifications)
- FastAPI (Python web framework)
- SQLAlchemy (ORM)
- PostgreSQL (database)
- Pydantic (validation)
- JWT authentication
- Boto3 (S3/Garage storage)
- Uvicorn (ASGI server)
- Node.js 18+
- Python 3.13+
- PostgreSQL 14+
- Garage or S3-compatible storage
# Install dependencies
npm install
# Configure environment
cp .env.example .env.local
# Edit .env.local with your API URL
# Run development server
npm run devVisit: http://localhost:5173
cd backend
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Configure environment
cp .env.example .env.local
# Edit .env.local with your database and storage credentials
# Run migrations
python -m app.migrate
# Seed database (creates admin user)
python -m app.seed
# Start server
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000Visit API docs: http://localhost:8000/docs
-
Admin User:
- Email:
admin@example.com - Password:
admin123
- Email:
-
Regular User:
- Email:
user@example.com - Password:
user123
- Email:
VITE_API_URL=http://localhost:8000# Database
DATABASE_URL=postgresql+asyncpg://user:password@localhost:5432/filedock
# JWT
SECRET_KEY=your-secret-key-here
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
# Cloud Storage
STORAGE_ENDPOINT=https://garage.rivetsoft.com
STORAGE_ACCESS_KEY=your-access-key
STORAGE_SECRET_KEY=your-secret-key
STORAGE_BUCKET=your-bucket-name
STORAGE_REGION=garage
STORAGE_PREFIX=filedock
# CORS
FRONTEND_URL=http://localhost:5173-
Admin Users (
is_admin=True):- Access to user management
- Can see all files from all users
- Can manage all folders
- Full system access
-
Regular Users (
is_admin=False):- Can only see their own files
- Can create folders in their own workspace
- Cannot access admin features
-
Private Files:
- Require authentication to access
- Only owner (or admin) can view/download
- Accessed via:
/api/files/view/{id}or/api/files/download/{id}
-
Public Files:
- Accessible without authentication
- Can have custom friendly URLs
- Accessed via:
/api/public/{slug}or/api/public/view/{slug} - Example:
/api/public/annual-report-a7b3
- Create nested folder structures
- Breadcrumb navigation
- Move files between folders
- Folder tree view
- Root-level and nested uploads
POST /api/auth/login- Login and get JWT tokenPOST /api/auth/register- Register new userGET /api/auth/me- Get current user info
POST /api/files/upload- Upload file with metadataGET /api/files- List files (paginated, filtered)GET /api/files/{id}- Get file metadataGET /api/files/view/{id}- View file inlineGET /api/files/download/{id}- Download filePUT /api/files/{id}- Update file metadataPUT /api/files/{id}/move- Move file to folderDELETE /api/files/{id}- Delete file
POST /api/folders- Create folderGET /api/folders- List all foldersGET /api/folders/tree- Get folder treeGET /api/folders/contents- Get folder contentsGET /api/folders/{id}- Get folder by IDPUT /api/folders/{id}- Update folderDELETE /api/folders/{id}- Delete folder
GET /api/users/- List all usersPOST /api/users/- Create userGET /api/users/{id}- Get user by IDPUT /api/users/{id}- Update userDELETE /api/users/{id}- Delete user
GET /api/public/{slug}- Download public file by slugGET /api/public/view/{slug}- View public file by slug
# Build for production
npm run build
# Preview production build
npm run preview
# Deploy 'dist' folder to your hosting (Vercel, Netlify, etc.)-
Environment Setup:
- Use production database credentials
- Set strong
SECRET_KEY - Configure production storage endpoint
- Set
FRONTEND_URLto your frontend domain
-
Database:
- Use PostgreSQL with connection pooling
- Run migrations:
python -m app.migrate - Seed initial data:
python -m app.seed
-
Server:
# Install production dependencies pip install gunicorn uvicorn[standard] # Run with Gunicorn gunicorn app.main:app -w 4 -k uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000
-
Security:
- Enable HTTPS
- Configure proper CORS origins
- Set up firewall rules
- Use environment variables for secrets
- Regular security updates
# Run with auto-reload
uvicorn app.main:app --reload
# Run migrations
python -m app.migrate
# Seed database
python -m app.seed
# Access interactive API docs
# Visit http://localhost:8000/docs# Run dev server
npm run dev
# Type checking
npm run type-check
# Lint
npm run lint
# Format
npm run format-
401 Unauthorized errors:
- User needs to logout and login again
- Check token in localStorage under "auth-storage"
-
Storage credentials not configured:
- Verify
.env.localhas correctSTORAGE_*variables - Ensure file is in
backend/directory
- Verify
-
Database connection errors:
- Check PostgreSQL is running
- Verify
DATABASE_URLin.env.local - Check database exists and credentials are correct
-
File upload fails:
- Check storage credentials are valid
- Verify bucket exists and is accessible
- Check file size limits
MIT
For issues and questions, please open an issue on GitHub.