ed1d0e6e53747a8ddca3cda8cbfad38d8f778d8a
filehost
A minimal self-hosted file sharing tool. Upload a file, get a public link. Files are stored on Cloudflare R2 and expire after 24 hours.
Stack: Next.js 15 (frontend) · FastAPI (backend) · Cloudflare R2 (storage)
How it works
- Enter the upload password to authenticate
- Drop a file or click to browse (250 MB max)
- Copy the public link and share it
The frontend proxies /api/* to the backend at localhost:8000, so both run separately during development.
Prerequisites
- Node.js 18+
- Python 3.11+
- uv (Python package manager)
- A Cloudflare R2 bucket with public access enabled
Upload limit: 250 MB per file. Files are streamed directly through the backend to R2 without being loaded into memory.
Environment setup
Create backend/.env:
R2_ENDPOINT=https://<account-id>.r2.cloudflarestorage.com
R2_ACCESS_KEY=<your-r2-access-key-id>
R2_SECRET_KEY=<your-r2-secret-access-key>
R2_BUCKET=<your-bucket-name>
PUBLIC_URL=https://<your-public-bucket-url>
UPLOAD_PASSWORD=<choose-a-password>
PUBLIC_URLis the public base URL of your R2 bucket (e.g.https://pub-xxx.r2.devor a custom domain). It must includehttps://.
Running locally
Backend
cd backend
uv venv
source .venv/bin/activate
uv pip install -r requirements.txt
uvicorn app.main:app --reload
Runs on http://localhost:8000.
Frontend
cd frontend
npm install
npm run dev
Runs on http://localhost:3000.
Open http://localhost:3000 in your browser.
Project structure
filehost/
├── backend/
│ ├── app/
│ │ ├── config/
│ │ │ └── settings.py # Pydantic settings (reads .env)
│ │ ├── services/
│ │ │ └── r2.py # Cloudflare R2 upload logic
│ │ └── main.py # FastAPI app, /auth and /upload routes
│ ├── requirements.txt
│ └── .env # ← you create this
└── frontend/
├── src/app/
│ ├── page.tsx # Upload UI
│ ├── layout.tsx
│ └── globals.css
└── next.config.ts # Proxies /api/* → localhost:8000
Languages
TypeScript
72%
Python
27%
CSS
1%