TinyDrive is a personal project, that is inspired by the Google's Drive interface and cloud storage. This project was developt to explore concepts and apply them is a somewhat real project.
TinyDrive was created for you store files on the cloud in a easy way and download or preview its content.
You can access the project and test it using this link: Tiny Drive
if you don't want to login with your own email, you can use this login I've created for tests:
Email: [email protected]
Senha: 12345678
- Standarized API Responses: All the API endpoints will return an standarized response, making the API predictable. The models for the responses are created with pydantic models.
- Messaging: Heavy and blocking processes are made in a separate server, connected by a RabbitMQ queue.
- File Preview:
- The previews are generated asynchronously, using RabbitMQ queues, with consumers created with
multiprocessing.Process - All previews are resized to fit in 1920x1080px, and converted into "JPEG" for opmization and to reduce the preview size even more.
- Previews are delivered by a signed-url generated by the storage provider (Supabase), which are cached in the browser using the HTTP
Cache-Controlheader.
- The previews are generated asynchronously, using RabbitMQ queues, with consumers created with
- File Deletetion: To ensure reduce metadata and filedata atomicity, the files to be deleted are first stored in a trash path in the bucket and then removed.
- Authentication: User authentication using the supabase authentication service. Authentication middleware validates the JWT token and verify for account mismatches between the token and the requested ownerid.
- BLOB Storage: The files data are stored in the supabase storage service.
- Custom Exceptions Handling: Use of custom exeptions that fit the domain.
This project uses mainly supabase for storage, authentication and database. If you want to run it you'll need a supabase project.
Clone this repo and move to the folder:
git clone https://github.com/RobertSDM/be-tiny-drive.git
cd be-tiny-driveIf you need run create a virtual environment:
python -m venv venvInstall the project dependencies in the requirements file
pip install -r requirements.txtThe necessary environment variables needed are:
DATABASE_URLSUPA_URLSUPA_KEYORIGINS# Origins allowed on CORS
Run with:
# if you already activated the venv
make run
# if you want to run and activate the venv
make env-runThe API was made with Fastapi, so it has a openAPI endpoint documenting the API. If you want to see more details about the API see the endpoint /docs"
- Fastapi
- Alembic
- Pillow
- Pytest
- SQLAlchemy
- Supabase
- Uvicorn
- Pika
- Supabase Storage
- Supabase Authentication
- Supabase Database - Postgres
- Vercel (Server host)
- Railway (Preview Processing host)