Deploy Fileverse API on Cloudflare Containers with an external PostgreSQL database.
- A Cloudflare account with Workers Paid plan
- A Fileverse API key
- A PostgreSQL database (any provider)
Click the Deploy to Cloudflare button above, then set the following secrets in the Cloudflare dashboard:
API_KEY=your-fileverse-api-key
DATABASE_URL=postgresql://user:password@host:5432/dbname
git clone https://github.com/fileverse/api-cloudflare-template.git
cd api-cloudflare-template
npm install
# Copy and fill in your environment variables
cp .dev.vars.example .dev.vars
# Deploy to Cloudflare
npx wrangler deployThen set your secrets:
npx wrangler secret put API_KEY
npx wrangler secret put DATABASE_URLStart a local PostgreSQL database and the API with Docker Compose:
# Set your API key
export API_KEY=your-fileverse-api-key
# Start services
docker compose upThe API will be available at http://localhost:8001.
Verify it's running:
curl http://localhost:8001/ping
# {"reply":"pong"}| Variable | Required | Description |
|---|---|---|
API_KEY |
Yes | Your Fileverse API key |
DATABASE_URL |
Yes | PostgreSQL connection string |
RPC_URL |
No | Custom Ethereum RPC endpoint |
WORKER_CONCURRENCY |
No | Background worker concurrency (default: 5) |
Any PostgreSQL-compatible database works. Some options:
- Neon — Serverless PostgreSQL with generous free tier
- Supabase — Managed PostgreSQL with extras
- Railway — Simple cloud PostgreSQL
- Self-hosted — Any PostgreSQL 14+ instance
┌─────────────────────────────────────────────────┐
│ Cloudflare │
│ │
│ ┌──────────┐ ┌──────────────────────────┐ │
│ │ Worker │───▶│ Container (Durable Object)│ │
│ │ (proxy) │ │ ┌────────────────────┐ │ │
│ └──────────┘ │ │ @fileverse/api │ │ │
│ │ │ Express server │ │ │
│ │ └────────┬───────────┘ │ │
│ └───────────┼──────────────┘ │
│ │ │
└───────────────────────────────┼────────────────────┘
│
┌───────────▼───────────┐
│ External PostgreSQL │
│ (Neon, Supabase, etc) │
└───────────────────────┘
MIT