Rust File Backend (RFB) is a high-performance, enterprise-grade file management system combining the memory safety and speed of Rust with a modern React frontend. Built for cost-efficiency through content-addressable storage (deduplication) and scalability via parallel multipart uploads.
- Built on Axum web framework and Tokio async runtime
- Handles thousands of concurrent requests with minimal overhead
- 10× less memory usage compared to Node.js/Python equivalents
- SHA-256 Content Hashing eliminates duplicate storage
- Instant "uploads" for previously stored content
- Drastically reduced storage costs across all users
- ClamAV Integration: Real-time virus scanning
- Magic Byte Verification: File type validation beyond extensions
- Path Traversal Protection: Aggressive filename sanitization
- JWT Authentication: Secure token-based access control
- CAPTCHA Registration: Bot-resistant account creation
- S3-Compatible Storage: Encrypted transport layer
- Custom chunked upload engine with parallel workers
- Exponential backoff retry mechanism
- Multi-GB file support on unstable connections
- Configurable chunk sizes (default: 10MB)
- Public Share Links: Time-limited, token-based sharing with unique URLs
- Password Protection: Argon2-hashed passwords for sensitive shares
- Granular Permissions:
view(inline preview) ordownload(attachment) modes - Folder Sharing: Share entire folders with browsable file listings
- Access Logging: Track views, downloads, and password attempts with IP/User-Agent
- Public Share Page: Beautiful, responsive frontend for recipients
- Media Preview: Inline image, video, audio, and PDF preview on shared links
- WebP Format: Optimized thumbnails (256px) for minimal bandwidth
- Multi-Format Support: Images, PDFs (via
pdftocairo), and Videos (viaffmpeg) - Encrypted File Detection: Skips password-protected PDFs gracefully
- Dedicated Worker: Separate
thumbnail-workerprocess for asynchronous generation - Lazy Loading: Frontend loads thumbnails asynchronously with smooth animations
- Copy/Paste: Recursive folder duplication with deduplication
- Bulk Actions: Move, delete, and copy multiple items
- Archive Preview: Inspect ZIP, 7z, RAR, TAR without extraction
- Download Tickets: Time-limited shareable links
- PDF Preview: Inline document viewing
- Favorites: Star/unstar files and folders for quick access
- Share Links: Public or user-specific sharing with configurable permissions
- Password Protection: Argon2id-hashed passwords for secure access
- Expiration Control: Configurable expiry up to 1 year
- View/Download Modes: Inline display or attachment download
- Access Logging: Track views, downloads, and password attempts
- Public Share Page: Standalone viewer with media preview
- Full-Text Search: Real-time filename search with debouncing
- Fuzzy/Similarity Search: Find files even with typos
- Regex & Wildcard: Power-user search patterns
- Tag Filtering: Filter by user-defined tags
- Category Filtering: Filter by auto-detected file categories
- Date Range: Filter files by creation date
- Size Range: Filter files by size boundaries
- Favorites Filter: Show only starred items
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ React │─────▶│ Axum API │─────▶│ PostgreSQL │
│ Frontend │ │ (Rust) │ │ Database │
└─────────────┘ └──────────────┘ └─────────────┘
│
├─────▶ S3/RustFS (File Storage)
└─────▶ ClamAV (Virus Scanning)
┌──────────────────────────────────────────────────────────┐
│ Background Workers (separate processes) │
│ ├── Worker: Virus scanning, cleanup, facts updates │
│ └── Thumbnail Worker: WebP thumbnail generation │
└──────────────────────────────────────────────────────────┘
Technology Stack:
- Language: Rust 2024 Edition
- Web Framework: Axum 0.7
- ORM: SeaORM (PostgreSQL & SQLite)
- Storage: AWS SDK for Rust (S3-compatible)
- Security: JWT, Argon2, ClamAV, CAPTCHA
- Runtime: Tokio async
Key Modules:
api/handlers/— HTTP request handlers (auth, files, upload, captcha, users, settings, shares, health)services/— Business logic (file, upload, metadata, scanner, audit, facts, share, thumbnail, worker)entities/— Database models (SeaORM)infrastructure/— Storage, database, scanner adaptersutils/— Validation, auth, encryption helpers
Features:
- Chunked multipart uploads with resume capability
- Content-based deduplication (SHA-256)
- Background virus scanning queue
- Metadata extraction (EXIF, ID3, PDF, Office)
- Recursive folder operations
- Download ticket generation
- File sharing with password protection and access logs
- WebP thumbnail generation (images, PDFs, videos)
- Favorites and folder tree navigation
Technology Stack:
- Framework: React 18 + TypeScript
- Build Tool: Vite 5
- Runtime: Bun
- Styling: Tailwind CSS + Glassmorphism
- Icons: Lucide React
- Tables: TanStack Table v8
- State: React Context + Hooks
Key Components:
features/dashboard/— Main file manager interfacefeatures/auth/— Login, register, OIDCfeatures/share/— Public share page (password gate, media preview, folder browsing)lib/— Reusable file manager libraryservices/— API client (upload, file operations, sharing)components/— Modals, toasts, context menus, sidebar with shares
Features:
- Drag-and-drop file upload
- Real-time upload progress with parallel chunks
- Copy/Cut/Paste with keyboard shortcuts
- Bulk selection and operations
- File preview modals (images, PDF, archives)
- Archive content inspection
- Responsive grid/list views
- Thumbnail previews with lazy loading
- Share management (create, revoke, view logs)
- Public share page with media viewer
- Sidebar with active shares navigation
- Favorites toggle and filtering
- Rust 1.84+
- Bun 1.1+
- PostgreSQL 14+ (or SQLite for development)
- RustFS, MinIO, or AWS S3
- Redis (optional, for caching)
- ClamAV (optional, for scanning)
pdftocairo(optional, for PDF thumbnails)ffmpeg(optional, for video thumbnails)
- Clone Repository
git clone https://github.com/appsjuragan/rust-file-backend.git
cd rust-file-backend- Backend Setup
cd api
cp ../.env.sample .env
# Edit .env with your database and S3 credentials
# Run migrations
cargo run --bin rust-file-backend -- --mode migrate
# Start API server
cargo run --bin rust-file-backend -- --mode api
# Start background worker (separate terminal)
cargo run --bin rust-file-backend -- --mode worker
# Start thumbnail worker (separate terminal)
cargo run --bin rust-file-backend -- --mode thumbnail-worker- Frontend Setup
cd web
cp .env.example .env
# Edit .env to set VITE_API_URL=http://localhost:3000
bun install
bun run dev- Access Application
- Frontend: http://localhost:5173
- API Docs: http://localhost:3000/swagger-ui
- Health Check: http://localhost:3000/health
./run.bat# Backend
docker build -t rfb-api:latest ./api
# Frontend
docker build --build-arg VITE_API_URL=https://your-api-domain.com -t rfb-web:latest ./webOfficial images are available on GitHub Container Registry:
# Pull Backend (v9)
docker pull ghcr.io/appsjuragan/rust-file-backend-api:v9
# Pull Frontend (v9)
docker pull ghcr.io/appsjuragan/rust-file-backend-web:v9The compose stack includes:
- API server — Axum HTTP service
- Background worker — Virus scanning, cleanup, facts updates
- Thumbnail worker — WebP thumbnail generation (images, PDFs, videos)
- PostgreSQL — Primary database
- RustFS — S3-compatible object storage
- Web — Nginx-served React frontend
docker compose up -dPOST /register— Create new user (CAPTCHA-protected)POST /login— Authenticate and receive JWTPOST /captcha— Generate CAPTCHA challengeGET /auth/oidc/login— OIDC authentication flowGET /auth/oidc/callback— OIDC callback handler
POST /upload— Single file uploadPOST /files/upload/init— Initialize chunked uploadGET /files/upload/sessions— List pending upload sessionsPUT /files/upload/:id/chunk/:num— Upload chunkPOST /files/upload/:id/complete— Finalize uploadDELETE /files/upload/:id— Abort chunked uploadGET /files— List files (with pagination, search, filters)GET /files/:id— Download filePOST /files/:id/ticket— Generate download ticketGET /download/:ticket— Download via ticketDELETE /files/:id— Delete file/folderPUT /files/:id/rename— Rename or move itemPOST /files/:id/favorite— Toggle favorite statusGET /files/:id/thumbnail— Get WebP thumbnail
POST /files/bulk-delete— Delete multiple itemsPOST /files/bulk-move— Move multiple itemsPOST /files/bulk-copy— Copy multiple items (with recursion)
POST /folders— Create new folderGET /folders/tree— Get full folder tree for navigationGET /files/:id/path— Get folder breadcrumb path
POST /shares— Create a share link (public/user, password, permissions)GET /shares— List user's shares (optionally filter by file)DELETE /shares/:id— Revoke a share linkGET /shares/:id/logs— Get share access logs
GET /share/:token— Get shared item info (filename, type, permissions)POST /share/:token/verify— Verify share passwordGET /share/:token/download— Download shared file (with optionalfile_idfor folder items)GET /share/:token/list— List shared folder contents
POST /pre-check— Check if file exists (deduplication)POST /files/link— Link existing storage fileGET /files/:id/zip-contents— Preview archive contents
GET /users/me— Get user profilePUT /users/me— Update profileGET /users/avatar/:user_id— Get public avatar imagePOST /users/me/avatar— Upload personal avatarGET /users/me/facts— Get storage statisticsGET /settings— Get user preferencesPUT /settings— Update preferences
GET /health— Health check (DB, storage, version)GET /system/validation-rules— Get file validation rules
Full API documentation available at /swagger-ui endpoint.
Import api/postman_collection.json for ready-to-use API requests with:
- Pre-configured authentication
- Example payloads for all endpoints including sharing
- Environment variables
- Postman test scripts for auto-setting tokens
cd api
cargo testcd web
bun test# Dependency audit
cargo audit# Backend
cd api && cargo fmt
# Frontend
cd web && bun run format# Backend
cd api && cargo clippy -- -D warnings
# Frontend
cd web && bun run lintAll code follows:
- Rust 2024 edition conventions
- ESLint + Prettier for TypeScript
- No unused imports or dead code
DATABASE_URL=postgresql://user:pass@localhost/rfb
JWT_SECRET=your-secret-key
# OIDC (optional)
OIDC_ISSUER_URL=https://accounts.google.com
OIDC_CLIENT_ID=your-client-id
OIDC_CLIENT_SECRET=your-client-secret
OIDC_REDIRECT_URL=http://localhost:3000/auth/oidc/callback
OIDC_SKIP_DISCOVERY=false
MINIO_ENDPOINT=http://localhost:9000
MINIO_BUCKET=file-storage
MINIO_ACCESS_KEY=rustfsadmin
MINIO_SECRET_KEY=rustfsadmin
MINIO_REGION=us-east-1
CHUNK_SIZE=10485760
MAX_FILE_SIZE=1073741824
CLAMAV_HOST=localhost
CLAMAV_PORT=3310
ENABLE_VIRUS_SCAN=true
ALLOWED_ORIGINS=http://localhost:3000,http://localhost:5173See .env.sample in the project root for a complete reference.
VITE_API_URL=http://localhost:3000
VITE_CHUNK_SIZE=10485760- Upload Speed: 500MB/s on local network
- Concurrent Users: 10,000+ simultaneous connections
- Memory Usage: ~50MB base (API server)
- Deduplication Savings: Up to 80% storage reduction
- Chunk Upload Parallelism: 4 workers default
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
Licensed under the MIT License. See LICENSE file for details.
Created with ❤️ by the AppsJuragan team.
- WebDAV support
- Real-time collaboration
- File versioning
-
Advanced search with filters - Mobile app (Capacitor)
- End-to-end encryption option
-
File sharing with public links -
Thumbnail generation -
Favorites system