Go to file
daywave f94ebb2cce
Some checks failed
Build and Deploy shortly / security (push) Successful in 12m29s
Build and Deploy shortly / sonar (push) Failing after 1m35s
Build and Deploy shortly / build-and-deploy (push) Successful in 1m58s
fix: import security reports into defectdojo
2026-03-24 14:14:28 +00:00
.gitea/workflows fix: import security reports into defectdojo 2026-03-24 14:14:28 +00:00
backend Fix shortly backend image build and redis increment API 2026-03-23 22:30:17 +00:00
docker/pgbouncer Initial infrastructure import 2026-03-23 21:51:10 +00:00
docs Initial infrastructure import 2026-03-23 21:51:10 +00:00
frontend Fix frontend image build in CI by tracking public dir 2026-03-23 23:25:51 +00:00
k8s Add security+auto-deploy workflow and align k8s DB/network settings 2026-03-23 22:39:17 +00:00
loadtest Initial infrastructure import 2026-03-23 21:51:10 +00:00
scripts fix: import security reports into defectdojo 2026-03-24 14:14:28 +00:00
docker-compose.yml Initial infrastructure import 2026-03-23 21:51:10 +00:00
README.md Initial infrastructure import 2026-03-23 21:51:10 +00:00
sonar-project.properties Adopt proj_link deploy workflow for shortly and align to vsoshkuber infra 2026-03-23 23:06:19 +00:00

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 console
  • k8s: Kubernetes manifests for Postgres, PgBouncer, Redis, API, web, and ingress

Backend configuration

Set environment variables for the API service:

  • DATABASE_URL: PgBouncer connection string
  • REDIS_URL: Redis connection string
  • BASE_URL: public base URL used for short links
  • CACHE_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

  1. Build and push images:
# Example tags
# shortly-api:latest
# shortly-web:latest
  1. 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.yaml and k8s/pgbouncer.yaml with your production credentials.
  • Set k8s/app-config.yaml hostnames to match your DNS and TLS.