How ahmedasem1/url-shortener works
Project type and purpose
• This is a backend-only, distributed URL-shortener service written in Go.
• It provides an HTTP API (no SPA/UI), with endpoints to shorten URLs, redirect to originals, test rate limits, and expose Swagger docs.
• It uses Redis for rate limiting and as an analytics queue, MongoDB for persistent URL and analytics storage, and is deployed via Docker/Kubernetes with a GitHub Actions CI/CD pipeline.
File structure
• Top-level: Dockerfiles, Compose, K8s manifests, and Go module files.
• src/ directory holds all Go code, split into:
• config/ – configuration loader
• docs/ – Swagger JSON/YAML and doc generator
• handlers/ – HTTP endpoint implementations
• middleware/ – Redis-backed rate limiter
• storage/ – Mongo and Redis clients
• workers/ – background analytics processor
• main.go – application entrypoint
• tests/ folder contains unit and integration tests.
• k8s/ folder defines separate deployments for API, Redis, Mongo, and nginx ingress.
README for additional insights
• Confirms tech stack: Go, Redis, MongoDB, Kubernetes, Docker Compose.
• Describes Docker-Compose for local dev, GitHub Actions for CI/CD (build/tests, Docker Hub push, K8s deploy).
• Provides environment variables, swagger endpoint, and basic usage.
Elements
• Clear, descriptive labels for each component (e.g. “API Service (Go)”, “Redis (Rate Limiter & Queue)”).