Microservice-based URL shortener built with Go, implementing Layered Architecture with an NGINX API Gateway. Includes user authentication, a dashboard for managing short links with analytics, and a file upload pipeline.
| Service | Framework | Port | Description |
|---|---|---|---|
| Auth | Gin | 8080 |
Registration, login, email verification, password reset |
| Shortener | Echo | 8081 |
Short URL resolution & redirect, visitor tracking |
| User | Fiber | 8082 |
Profile management, dashboard, short link CRUD |
| Upload | — | Consumer | Avatar upload via MinIO (RabbitMQ consumer) |
| Component | Role |
|---|---|
| NGINX | API Gateway — SSL termination, rate limiting, CORS, path-based routing |
| MongoDB | Primary database |
| Redis | Caching & verification code storage |
| RabbitMQ | Async messaging (shortener CRUD, avatar uploads) |
| gRPC | Inter-service communication (User ↔ Shortener) |
| Jaeger | Distributed tracing (OpenTelemetry) |
| MinIO | S3-compatible object storage for avatars |
All HTTP traffic goes through NGINX on ports :80 (→ HTTPS redirect) and :443.
| External Path | Internal Service | Description |
|---|---|---|
/{code} |
Shortener | Root-level redirect (shortest URL) |
/s/{code} |
Shortener | Redirect alias |
/api/v1/auth/* |
Auth | Authentication endpoints |
/api/v1/shortener/* |
Shortener | Shortener API |
/api/v1/user/* |
User | User management API |
/health |
NGINX | Gateway health check |
Features: SSL/TLS termination, rate limiting (10 req/s per IP, burst 20), centralized CORS, HTTP → HTTPS redirect.
- Register — Email verification with branded HTML emails
- Login — JWT-based authentication
- Forgot / Reset Password — Email-based password recovery
- User Profiles — View & edit profile, avatar upload
- User Dashboard — Analytics on short link visitor counts
- URL Shortener — Generate, update, delete short links
- Short URL Redirect — Root-level (
/{code}) for ultra-short URLs
| Category | Technology |
|---|---|
| Language | Go 1.25 |
| HTTP Frameworks | Gin, Echo, Fiber |
| Database | MongoDB |
| Cache | Redis |
| Message Broker | RabbitMQ |
| Inter-service | gRPC + Protobuf |
| API Gateway | NGINX (SSL, Rate Limiting) |
| Object Storage | MinIO |
| Tracing | Jaeger (OpenTelemetry) |
| Containerization | Docker & Docker Compose |
- Docker & Docker Compose installed on your machine
- Rename
example.envto.envinside each service directory - Fill your SMTP configuration in the auth
.env(uncomment the SMTP lines) - Generate SSL certificates for the NGINX gateway :
bash nginx/certs/generate-certs.sh
-
Build all services :
make build
-
Build & Run all services in background :
make run
-
Stop all services :
make stop
-
Stop & Remove all services and volumes :
make remove
Import the Postman collection to test all endpoints :
singkatin-api.postman_collection.json
Collection variables :
| Variable | Description |
|---|---|
base_url |
Gateway host (default: localhost) |
access_token |
Auto-populated after login |
verify_code |
Email verification code |
short_id |
Short link ID for update/delete |
short_url |
Short URL code for redirect testing |
