Skip to content

RobertSDM/be-tiny-drive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

255 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TinyDrive (Server)

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

Main Features

  • 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-Control header.
  • 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.

Run locally

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-drive

If you need run create a virtual environment:

python -m venv venv

Install the project dependencies in the requirements file

pip install -r requirements.txt

The necessary environment variables needed are:

  • DATABASE_URL
  • SUPA_URL
  • SUPA_KEY
  • ORIGINS # 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-run

API Endpoints

The 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"

Technologies

Frameworks

  • Fastapi

Libraries

  • Alembic
  • Pillow
  • Pytest
  • SQLAlchemy
  • Supabase
  • Uvicorn
  • Pika

Cloud

  • Supabase Storage
  • Supabase Authentication
  • Supabase Database - Postgres
  • Vercel (Server host)
  • Railway (Preview Processing host)

About

REST API for TinyDrive cloud storage management

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages