This is a simple file management application that allows users to upload and download temporary files from any terminal using curl
or wget
. The backend is built using FastAPI with SQLAlchemy for database management, and the frontend is built using Streamlit. The application supports user authentication and each user has their own directory on the server.
- User registration and authentication
- File upload and download
- File space checking for each user
- Streamlit frontend for user interaction
- Backend API with FastAPI
- SQLite database with SQLAlchemy
- Dockerized using Docker Compose
project/
│
├── backend/
│ ├── main.py
│ ├── models.py
│ ├── crud.py
│ ├── database.py
│ ├── security.py
│ ├── schemas.py
│ ├── Dockerfile
│ └── .env
│
├── frontend/
│ ├── app.py
│ ├── Dockerfile
│ └── .env
│
├── docker-compose.yml
└── .env
- Docker
- Docker Compose
-
Clone the repository:
git clone https://github.com/yourusername/file-management-app.git cd file-management-app
-
Create a
.env
file in the root directory and add the following environment variables:SECRET_KEY=your-secret-key SUPER_ADMIN_USERNAME=admin SUPER_ADMIN_PASSWORD=adminpassword
-
Navigate to the backend directory and create a
.env
file with the following content:SECRET_KEY=your-secret-key SUPER_ADMIN_USERNAME=admin SUPER_ADMIN_PASSWORD=adminpassword
-
Navigate to the frontend directory and create a
.env
file with the following content:API_URL=http://backend:8000
-
Build and start the application using Docker Compose:
docker-compose up --build
- Open your browser and navigate to
http://localhost:8501
to access the Streamlit frontend.
curl -X POST "http://localhost:8000/users/" -H "Content-Type: application/json" -d '{"username": "testuser", "email": "[email protected]", "full_name": "Test User", "password": "testpassword"}'
curl -X POST "http://localhost:8000/token" -d "username=testuser&password=testpassword"
curl -X POST "http://localhost:8000/upload" -H "Authorization: Bearer <your_token>" -F "file=@<path_to_your_file>"
curl -X GET "http://localhost:8000/download/<filename>" -H "Authorization: Bearer <your_token>" -O
curl -X GET "http://localhost:8000/filespace" -H "Authorization: Bearer <your_token>"
POST /users/
: Register a new userPOST /token
: Obtain a JWT tokenPOST /upload
: Upload a fileGET /download/{filename}
: Download a fileGET /filespace
: Check available file space and list files
This project is licensed under the MIT License. See the LICENSE file for more details.