Tiny URL shortener built with Bun + Hono, a Svelte frontend, Redis for storage, and Traefik as the local API gateway.
This README covers local development only (Traefik in Docker). Production will be added later.
Routing (Traefik):
Docs:
Run from repo root:
docker compose -f docker-compose.dev.yml up -d
What it does:
Bun loads .env files automatically. Create per-service .env files:
packages/shortening-service/.env
REDIS_URL=redis://localhost:6379
BASE_URL=http://localhost
PORT=3001
packages/forwarding-service/.env
REDIS_URL=redis://localhost:6379
BASE_URL=http://localhost
PORT=3002
Frontend needs the API base exposed via Traefik:
packages/frontend/.env.local
VITE_API_BASE_URL=http://localhost
From the repo root (uses workspaces):
bun install
Shortening API (port 3001):
cd packages/shortening-service
bun run dev
Forwarding API (port 3002):
cd packages/forwarding-service
bun run dev
Frontend (Vite dev server):
cd packages/frontend
bun run dev
Traefik will route:
curl -sS -X POST http://localhost/shorten \
-H 'Content-Type: application/json' \
-d '{"longUrl":"https://example.com"}'
Expected response:
{ "shortUrl": "http://localhost/abc123" }
Open the returned shortUrl in the browser to be redirected.
micro-url
├─ docker-compose.dev.yml # Traefik + Redis for local dev
├─ traefik/
│ └─ dynamic/routes.yml # File provider config for Traefik
├─ packages/
│ ├─ frontend/ # Svelte app
│ ├─ shortening-service/ # POST /shorten
│ ├─ forwarding-service/ # GET /{slug}
│ └─ shared/ # common code (env, redis, logger, slug)
└─ redis-data/ # Redis persistence
docker compose ... up -d
is running and REDIS_URL points to redis://localhost:6379
.Production setup will be documented later.
This project uses Infrastructure as Code for the production cloud deployment:
infra/
(modules for network, ALB, ECS services, and Redis)Detailed production setup, variables, and deployment steps will be added here later.
aws ecr get-login-password --region eu-central-1 \
| docker login --username AWS --password-stdin <AWS_ACCOUNT_ID>.dkr.ecr.eu-central-1.amazonaws.com