- High-performance async gRPC API
- URL shortening with PostgreSQL + Redis caching
- Event-driven via Kafka (FastStream)
- Full DDD / Clean Architecture setup
- Async ORM with SQLAlchemy & Alembic migrations
- Unit of Work & transaction management
- DI with Dishka, testing with pytest
- Observability stack: Prometheus, Grafana, Loki, Promtail
| Layer | Tools & Tech |
|---|---|
| API | gRPC (protobuf) |
| DB & ORM | PostgreSQL, SQLAlchemy (async), Alembic |
| Caching | Redis |
| Messaging | Kafka (FastStream) |
| DI & Architecture | Dishka, DDD, Clean Architecture |
| Testing & QA | pytest, Ruff, Pyright |
| Observability | Prometheus, Grafana, Loki, Promtail |
| DevOps & Containers | Docker, Docker Compose, Justfile |
grpcui -plaintext localhost:50051System Diagram
TODO: Add Excalidraw system diagram
- Clone repo
git clone git@github.com:mrKazzila/shortener_url_api.git
cd shortener_url_api/backend-
Configure env & pgbouncer (edit
env.envandbackend/docker/compose/infra/pgbouncer/userlist.txt) -
Start infrastructure
just infra-up- Run app (1 1 = partitions & replicas)
just app-bootstrap 1 1- Optional monitoring stack
just mon-up- See all available commands
justFor local load testing, I use ghz.
ghz --insecure \
--proto ./proto/shortener_app/v1/shortener_app.proto \
--call shortener_app.v1.ShortenerService.CreateShortUrl \
-d '{"target_url":"https://example.com"}' \
-c 50 \
--duration 10m \
--import-paths ./proto \
localhost:50051Example results:
- ~800k requests in 10 minutes
- ~1330 RPS
- Avg latency ~37ms
- P99 ~91ms
- Occasional
Unavailableerrors on the local network during aggressive competition


