FileShare is a full-stack application for secure storage and sharing of files. The project was created to explore backend architecture, authentication, encryption, database design and frontend development in a single application.
Note that FileShare is an educational project under active development. It has not undergone an independent security audit and should NOT be used to store sensitive or irreplacable data.
cd backend
bun install
bun prisma migrate dev
bun run src/server.tsBackend environment variables (to be stored in backend/.env):
DATABASE_URL=<url_to_database>
FILE_MASTER_KEY=<master_key>To generate the required master key, it's possible to run
openssl rand -base64 32NOTE: if this key is lost, all encrypted files are lost.
cd frontend
bun install
bun run devFrontend environment variables (to be stored in frontend/.env):
VITE_API_BASE='/api' # "prefix" for express api paths- User registration and login
- Ed25519-signed JWT authentication
- Encrypted file storage using AES-256-GCM
- Folder system and breadcrumb navigation
- File upload and download
- File metadata persisted through Prisma and SQLite
- React frontend
- Express api running on Bun
- File sharing
- Permission management
- Background workers
- End-to-end encryption
- Files are stored on local filesystem
- SQLite used for local development
- File sharing not yet implemented
- Files are buffered in memory during encryption and decryption
- Currently, the server has access to decrypted file contents and encryption keys
Frontend
↓
Express REST API
↓
Authentication middleware
↓
Controllers
↓
Database / Storage
The react frontend is currently only a visual interface for the actual file system. Everything related to cryptography happens in the backend. In the future, I plan to move file key generation and encryption/decryption to the frontend for zero-knowledge encryption.
The authentication middleware uses JWT to create and verify user sessions, using Ed25519. For the implementation, see here.
File metadata is stored in SQLite through Prisma, while encrypted file contents are stored separately on the local file system. The latter is implemented by storing encrypted files here, while the former is realized by using an SQLite database.
Upon uploading a file, the backend runs the following encryption process
- Receive raw file data
- Generate random 256-bit AES file encryption key, and random 96-bit file initialization vector (IV)
- Encrypt file with AES-256-GCM using the file encryption key and IV
- Encrypt the file encryption key using AES-256-GCM with server KEK and new random IV
- Store encrypted file data in storage and file metadata in db
Frontend
- React
- TypeScript
- Vite
Backend
- Bun
- Express
- Prisma
- SQLite
Security
- JWT
- AES-256-GCM
Storage
- Local filesystem
The project was primarily an opportunity to gain experience with design and implementation of a secure backend, as well as structuring a full-stack application. Additionally, this project has provided the possibility to reason upon, explore and implement encryption, digital signatures and authentication in terms of both security and efficiency.

