HARTWELL_LABS

Deployment

LinkShort ships with three deployment options: Docker, Docker Compose, and Fly.io.

Deployment

LinkShort ships with three deployment options: Docker, Docker Compose, and Fly.io.

Docker

A multi-stage Dockerfile builds the React frontend and packages the FastAPI app into a single image.

docker build -t linkshort .

# SQLite file lives in /app/data (volume mount recommended)
docker run -p 8000:8000 \
  -e SECRET_KEY=change-me \
  -v ./data:/app/data \
  linkshort

Docker Compose

The provided docker-compose.yml wires the image, port, env vars, and a data volume:

docker compose up -d
KeyValue
Imagebuilt from the repo
Port8000:8000
DATABASE_URLsqlite:///./urlshortener.db
Volume./data:/app/data

Fly.io

fly.toml is included for one-command deployment:

fly launch   # first time only
fly deploy

Deployment architecture

Browser
   β”‚  HTTPS
   β–Ό
Fly.io / Docker host
   β”‚  uvicorn: app.main:app
   β”œβ”€β”€ /auth/*        β†’ JWT auth
   β”œβ”€β”€ /urls/*        β†’ shorten, my, stats, delete, redirect
   β”œβ”€β”€ /health        β†’ liveness
   └── /* (SPA)       β†’ static files / index.html fallback
   β”‚
   β–Ό
SQLite (volume-mounted /app/data)

Production checklist

  • Set a long, random SECRET_KEY (never commit it)
  • Mount persistent storage for the SQLite database
  • Run behind TLS (Fly.io provides it automatically)
  • Confirm backend/static contains a fresh frontend build
  • Restrict CORS origins instead of the dev * wildcard if needed
  • Back up the SQLite file regularly (single-file backups are trivial)
  • Monitor /health with your uptime checker

On this page