A self-hosted CDN solution with a React dashboard for managing files and a Rust backend for serving content.
- 📁 Project-based organization — Create projects with custom endpoints (e.g.,
/my-project/) - 🔗 File aliases — Multiple URLs can point to the same file
- 🔄 Smart renaming — Automatic alias suggestions when renaming files
- 🔐 Multi-user auth — JWT-based authentication with refresh tokens
- 📊 Storage stats — Monitor your storage usage
- 🐳 Docker-ready — Easy deployment with Docker Compose
| Component | Technology |
|---|---|
| Backend | Rust, Axum, SQLx, SQLite |
| Frontend | React, Vite, TanStack Query, Tailwind CSS |
| Infrastructure | Docker, Docker Compose |
- Docker & Docker Compose
- (For development) Rust 1.75+, Node.js 20+
# Clone the repository
git clone https://github.com/yourusername/personal-cdn.git
cd personal-cdn
# Configure environment
cp .env.example .env
# Edit .env with your settings (especially JWT_SECRET!)
# Start services
docker compose up -dThe application will be available at:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8080
- CDN files: http://localhost:8080/cdn/{project-endpoint}/{filename}
cd backend
# Install sqlx-cli for migrations
cargo install sqlx-cli --no-default-features --features sqlite
# Copy environment file
cp .env.example .env
# Create database and run migrations
cargo sqlx database create
cargo sqlx migrate run
# Run with hot reload
cargo install cargo-watch
cargo watch -x runcd frontend
# Install dependencies
npm install
# Start dev server
npm run devpersonal-cdn/
├── backend/ # Rust API server
│ ├── src/
│ │ ├── handlers/ # Route handlers
│ │ ├── models/ # Data models
│ │ ├── services/ # Business logic
│ │ └── ...
│ └── migrations/ # SQL migrations
├── frontend/ # React dashboard
│ └── src/
│ ├── components/
│ ├── pages/
│ └── ...
└── docker-compose.yml
GET /cdn/{endpoint}/{filename}— Serve files (supports aliases)GET /health— Health check
POST /api/auth/*— AuthenticationGET/POST/PUT/DELETE /api/projects/*— Project managementGET/POST/PUT/DELETE /api/projects/{id}/files/*— File managementGET /api/system/storage— Storage statistics
See PROJECT_SPEC.md for full API documentation.
| Variable | Description | Default |
|---|---|---|
JWT_SECRET |
Secret key for JWT signing | (required) |
DATABASE_URL |
SQLite database path | sqlite:./data/cdn.db |
STORAGE_PATH |
File storage directory | ./storage/files |
MAX_UPLOAD_SIZE |
Max upload size in bytes | 52428800 (50MB) |
CORS_ORIGIN |
Allowed CORS origin | http://localhost:3000 |
- Create a new project in Coolify
- Add this repository as a Docker Compose service
- Set environment variables in Coolify's UI
- Configure your domain and SSL
- Deploy!
MIT