Skip to content

πŸ” Secure File Sharing System built with FastAPI lets users πŸ“€ upload, πŸ“₯ download, and πŸ“Ž share files safely. It uses πŸ”‘ token-based/OAuth authentication, πŸ“ encrypted storage & transfer, and πŸ›‘οΈ access controls so only authorized users can retrieve shared files.

Notifications You must be signed in to change notification settings

yash2974/EzLabs-secure-file-sharing-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ Secure File Sharing System

This is a backend API for securely uploading, listing, and downloading files with user authentication and role-based access. Used Celery for non blocking Email verification. Create a .env file for Postgresql db and email/google-app-password

πŸš€ Base URL

http://127.0.0.1:8000/

πŸš€ How to run

fastapi dev main.py     
celery -A utils.celery_worker.celery_app worker --loglevel=info --pool=solo

πŸ“€ Database Schema

CREATE TABLE users (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  email VARCHAR(255) UNIQUE NOT NULL,
  hashed_password TEXT NOT NULL,
  role VARCHAR(10) NOT NULL CHECK (role IN ('ops', 'client')),
  is_verified BOOLEAN DEFAULT FALSE,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

πŸ” Authentication

  • Type: Bearer Token (JWT)
  • How to get it: Use the /login endpoint to retrieve access_token
  • Where to use it: Pass it in the Authorization header as Bearer <access_token>

πŸ“ 1. Sign Up

Endpoint: POST /signup
Auth Required: ❌ No
Request Body (JSON):

{
  "email": "example@mail.com",
  "password": "yourpassword",
  "role": "ops" // or "client"
}

Response:

  • Success or error message

πŸ”‘ 2. Log In

Endpoint: POST /login
Auth Required: ❌ No
Request Body (JSON):

{
  "email": "example@mail.com",
  "password": "yourpassword"
}

Response:

{
  "access_token": "your-jwt-token"
}

πŸ“€ 3. Upload File

Endpoint: POST /upload
Auth Required: βœ… Yes
Form-Data:

  • file: Upload .pptx, .docx, or .xlsx file only

Response:

  • Success or error message

πŸ“ƒ 4. List Files

Endpoint: GET /list_files
Auth Required: βœ… Yes

Response:

[
  "file1.xlsx",
  "file2.docx"
]

πŸ”— 5. Get Secure Download Link

Endpoint: GET /download/{filename}
Auth Required: βœ… Yes
Example:

GET /download/data-1749407797375.xlsx

Response:

{
  "download-link": "http://127.0.0.1:8000/download_secure/<token>"
}

⬇️ 6. Download File via Secure Link

Endpoint: GET /download_secure/{token}
Auth Required: βœ… Yes

Description: Accesses and downloads the file using the encrypted token link.


🌐 Postman Collection Variables

  • {{access_token}}: Set after login
  • {{secure_encrypted_token}}: Set after requesting download link

πŸ“Œ Notes

  • Only users with role "ops" can upload files.
  • All download links are time-limited and encrypted for added security.

About

πŸ” Secure File Sharing System built with FastAPI lets users πŸ“€ upload, πŸ“₯ download, and πŸ“Ž share files safely. It uses πŸ”‘ token-based/OAuth authentication, πŸ“ encrypted storage & transfer, and πŸ›‘οΈ access controls so only authorized users can retrieve shared files.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages