| .gitea/workflows | ||
| backend | ||
| docker/pgbouncer | ||
| docs | ||
| frontend | ||
| k8s | ||
| loadtest | ||
| scripts | ||
| docker-compose.yml | ||
| README.md | ||
| sonar-project.properties | ||
Shortly Cloud
URL shortener platform with a Rust redirect/API service, a Next.js web console, and production-grade Kubernetes manifests. It is tuned for high concurrency with Redis caching and PgBouncer pooling.
Repository layout
backend: Rust API service (Axum + SQLx + Redis)frontend: Next.js marketing site + shortener consolek8s: Kubernetes manifests for Postgres, PgBouncer, Redis, API, web, and ingress
Backend configuration
Set environment variables for the API service:
DATABASE_URL: PgBouncer connection stringREDIS_URL: Redis connection stringBASE_URL: public base URL used for short linksCACHE_TTL_SECONDS: cache TTL for redirects (default: 86400)CODE_LENGTH: short code length (default: 7)DB_MAX_CONNECTIONS: API pool size (default: 30)SERVICE_MODE:all|shorten|redirect(default:all)CLICK_FLUSH_INTERVAL_SECONDS: Redis click flush interval (default: 10)CLICK_FLUSH_BATCH_SIZE: batch size per DB flush (default: 1000)
Frontend configuration
NEXT_PUBLIC_API_URL: API base URL exposed to the browser
Kubernetes quick start
- Build and push images:
# Example tags
# shortly-api:latest
# shortly-web:latest
- Apply manifests:
kubectl apply -f k8s/namespace.yaml
kubectl apply -f k8s/db-secret.yaml
kubectl apply -f k8s/app-config.yaml
kubectl apply -f k8s/postgres.yaml
kubectl apply -f k8s/pgbouncer.yaml
kubectl apply -f k8s/redis.yaml
kubectl apply -f k8s/api.yaml
kubectl apply -f k8s/redirect.yaml
kubectl apply -f k8s/web.yaml
kubectl apply -f k8s/ingress.yaml
kubectl apply -f k8s/networkpolicy.yaml
Notes
- Update
k8s/db-secret.yamlandk8s/pgbouncer.yamlwith your production credentials. - Set
k8s/app-config.yamlhostnames to match your DNS and TLS.