2026-03-13 14:34:07 +05:30
2026-03-13 14:27:45 +05:30
2026-03-13 14:34:07 +05:30
2026-03-08 17:25:31 +05:30
2026-03-08 21:11:43 +05:30

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

  1. Enter the upload password to authenticate
  2. Drop a file or click to browse (250 MB max)
  3. Copy the public link and share it

The frontend proxies /api/* to the backend at localhost:8000, so both run separately during development.


Prerequisites

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_URL is the public base URL of your R2 bucket (e.g. https://pub-xxx.r2.dev or a custom domain). It must include https://.


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
S
Description
Simple self-hosted file sharing
Readme
146 KiB
0 Stars 1 Watchers 0 Forks
Languages
TypeScript 72%
Python 27%
CSS 1%