fileshare-rs is a secure, end-to-end encrypted file sharing web service built with Rust and Axum. Inspired by services like Firefox Send (RIP) and WeTransfer, it allows users to upload files and share secure download links with optional password protection, expiry, and download limits.
π Designed with security and simplicity in mind β easily self-hostable and privacy-focused.
- System Architecture
- Security considerations
- Features
- Tech Stack
- Setup Locally
- API Documentation
- Contact me
-
If database got hacked, user credentials won't be exposed as it is being hashed before inserting in database.
-
For files, if anyone somehow gets file_id for some file, it won't be possible for him to see the actual file as it's been encrypted before getting stored in cloud.
-
User credentials are securely hashed before being stored in the database, so even if the database is compromised, the original passwords remain protected.
-
Files are encrypted before being uploaded to the cloud. Therefore, even if an attacker obtains a valid
file_id
, they cannot access the actual content without the decryption key. -
The encryption keys are not stored alongside the encrypted files, reducing the risk of unauthorized decryption even if cloud storage is compromised.
-
Access to sensitive endpoints (e.g., file upload, download, or user settings) should be gated behind proper authentication and authorization layers.
-
Use HTTPS for all client-server communications to prevent man-in-the-middle attacks and ensure data-in-transit is encrypted.
- User registration & login
- Secure password hashing (Argon2)
- Email verification workflow
- Password reset with email token
- Supports multipart/form-data for file uploads
- File size validation
- Metadata stored in MongoDB: filename, size, hash, etc.
- File content is encrypted and securely saved to Cloudinary storage.
- File download link generation
- Optional password protection (Argon2 hashed)
- Set max download count and expiry time
- Download request logging for tracking purposes
- Time-based expiry checks
- Automatic deletion of expired files or after max downloads
- Background job and Cron cleanup support
Layer | Tech |
---|---|
Language | Rust |
Framework | Axum |
Database | MongoDB |
Storage | Cloudinary |
Auth | JWT, Argon2, Sendgrid, Email Tokens |
Background | Tokio + Cron Tasks |
# Clone the repo
git clone https://github.com/ap211unitech/fileshare-rs.git
cd fileshare-rs
# Create .env file
SERVER_URL=127.0.0.1:8000
MONGODB_URL=
SENDGRID_API_KEY=
SENDGRID_SENDER_NAME=fileshare-rs
SENDGRID_SENDER_EMAIL=
JWT_SECRET_KEY=my-jwt-secret-key
CLOUDINARY_CLOUD_NAME=
CLOUDINARY_API_KEY=
CLOUDINARY_API_SECRET=
# Run the server
cargo run
This outlines the available routes and their respective functionalities for the fileshare-rs.
Base Path: /user
Registers a new user.
- Description: Accepts user credentials to create a new account.
- Request Body: JSON object containing user data (e.g., email, password).
- Response: Success message or validation errors.
Sends an email with a verification link to the user.
- Description: Initiates the email verification process.
- Request Body: JSON with user email.
- Response: Email sent confirmation.
Verifies the user's email.
- Description: Confirms the user account via verification token.
- Query Parameters: Includes the verification token and user id.
- Response: Success or failure message.
Authenticates a user.
- Description: Logs in the user and returns JWT token.
- Request Body: JSON with email and password.
- Response: JSON with authentication token or error message.
Sends a password reset link.
- Description: Triggers an email with instructions to reset the password.
- Request Body: JSON with user email.
- Response: Confirmation message.
Resets the user's password.
- Description: Uses a token to validate and update the password.
- Request Body: JSON with new password.
- Response: Password reset confirmation.
Base Path: /file
These routes require authentication via the
ExtractAuthAgent
middleware.
Uploads a file for the authenticated user.
- Description: Handles file uploads.
- Request: Multipart form data.
- Headers:
Authorization
token required. - Response: Upload confirmation and file metadata.
Lists all files uploaded by the authenticated user.
- Description: Fetches the authenticated user's files.
- Headers:
Authorization
token required. - Response: JSON array of file metadata.
Downloads a file.
- Description: Initiates file download. May require token or file identifier.
- Request Body: JSON with file ID or access token.
- Response: File stream or error message.
Base Path: /
Checks the server's health status.
- Description: Returns a simple status message to indicate the server is running.
- Response:
{ "message": "Server is healthy!" }
Have questions, suggestions, or want to collaborate? Feel free to reach out to the engineer behind this project:
Name: Arjun Porwal
Email: porwalarjun95@gmail.com
GitHub: github.com/ap211unitech
LinkedIn: linkedin.com/in/arjun-porwal-9198b71a3/
I'm always open to feedback and discussions!