A full-stack file management application built with React and Django, designed for efficient file handling and storage.
- Django 4.x (Python web framework)
- Django REST Framework (API development)
- SQLite (Development database)
- Gunicorn (WSGI HTTP Server)
- WhiteNoise (Static file serving)
- React 18 with TypeScript
- TanStack Query (React Query) for data fetching
- Axios for API communication
- Tailwind CSS for styling
- Heroicons for UI elements
- Docker and Docker Compose
- Local file storage with volume mounting
Before you begin, ensure you have installed:
- Docker (20.10.x or higher) and Docker Compose (2.x or higher)
- Node.js (18.x or higher) - for local development
- Python (3.9 or higher) - for local development
docker-compose up --build
-
Create and activate virtual environment
cd backend python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Create necessary directories
mkdir -p media staticfiles data
-
Run migrations
python manage.py migrate
-
Start the development server
python manage.py runserver
-
Install dependencies
cd frontend npm install
-
Create environment file Create
.env.local
:REACT_APP_API_URL=http://localhost:8000/api
-
Start development server
npm start
- Frontend Application: http://localhost:3000
- Backend API: http://localhost:8000/api
- GET
/api/files/
- Returns a list of all uploaded files
- Response includes file metadata (name, size, type, upload date)
- POST
/api/files/
- Upload a new file
- Request: Multipart form data with 'file' field
- Returns: File metadata including ID and upload status
- GET
/api/files/<file_id>/
- Retrieve details of a specific file
- Returns: Complete file metadata
- DELETE
/api/files/<file_id>/
- Remove a file from the system
- Returns: 204 No Content on success
- Access file directly through the file URL provided in metadata
file-hub/
├── backend/ # Django backend
│ ├── files/ # Main application
│ │ ├── models.py # Data models
│ │ ├── views.py # API views
│ │ ├── urls.py # URL routing
│ │ └── serializers.py # Data serialization
│ ├── core/ # Project settings
│ └── requirements.txt # Python dependencies
├── frontend/ # React frontend
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── services/ # API services
│ │ └── types/ # TypeScript types
│ └── package.json # Node.js dependencies
└── docker-compose.yml # Docker composition
- Hot reloading for both frontend and backend
- React Query DevTools for debugging data fetching
- TypeScript for better development experience
- Tailwind CSS for rapid UI development
-
Port Conflicts
# If ports 3000 or 8000 are in use, modify docker-compose.yml or use: # Frontend: npm start -- --port 3001 # Backend: python manage.py runserver 8001
-
File Upload Issues
- Maximum file size: 10MB
- Ensure proper permissions on media directory
- Check network tab for detailed error messages
-
Database Issues
# Reset database rm backend/data/db.sqlite3 python manage.py migrate