Finally, a community-powered ELO matchmaking system for birds.
Check it out at wingleader.app
Wing Leader is a full-stack web application that allows users to vote on bird species in head-to-head matches and assigns ratings based on the traditional ELO rating algorithim. Deployed to Google Cloud Platform via a Github actions CI/CD platform.
Features
- Type-safe SQL queries utilizing sqlc
- Database migrations via goose
- Structured logging using zerolog for observability
- Lightweight static template generation using HTMX
- Serverless compute via Google Cloud Run
- Session based vote tracking
- IP-based rate limiting
- Concurrent SQL safety
This project was built as a learning excersie to familiarize myself with Golang backends, PostgreSQL, and CI/CD using Github Actions. More importantly, this project answers an age old question in an empiracal way using wisdom of the crowds - which is the best bird?
Pre-requisites
-
Clone the repository
git clone https://github.com/neeeb1/rate_birds cd rate_birds -
Update env with your nuthatch api key and the DB url, user, and password.
cp .env.example .env vim .env
-
Run the make command
make compose-up
Returns HTML fragment with two random bird cards and creates session.
Records vote, updates ELO ratings, returns new bird pair.
Query Params:
winner:left|rightleftBirdID: UUIDrightBirdID: UUID
Headers: Cookie: sessionToken=<token>
Response: New HTML fragment + new session cookie
Error Codes:
400: Invalid parameters or missing session401: Session expired or already voted429: Rate limit exceeded
Returns top N birds by ELO rating as HTML table.
Query Params:
listLength: Integer (1-1000)
| Endpoint | Purpose | Use Case |
|---|---|---|
GET /health/live |
Liveness probe | K8s/Cloud Run liveness |
GET /health/ready |
Readiness probe (DB ping) | K8s/Cloud Run readiness |
-
Cloud Run Metrics:
- Request count and latency (p50, p95, p99)
- Container instance count and CPU/memory utilization
- Billable container time
- Cold start frequency
-
Cloud SQL Metrics:
- Connection count and connection errors
- Query execution time
- Database size and storage utilization
- Replication lag (if applicable)
-
Cloudflare Analytics:
- Global traffic distribution
- Cache hit ratio
- Threat detection and blocking
- DNS query volume
- Format: Structured JSON (zerolog)
- Levels: debug, info, warn, error
- Fields: timestamp, level, message, request_id, user_ip, bird_ids
- Destination: Cloud Logging (formerly Stackdriver)
- Hypermedia: HTMX
- Styling: Tailwind CSS v4
- Edge Network: Cloudflare (DNS, DDoS, CDN)
- Compute: Google Cloud Run (serverless containers)
- Database: Cloud SQL (PostgreSQL 17)
- Container Registry: Google Artifact Registry
- Monitoring: Cloud Run metrics, Cloud SQL metrics, structured logging
- CI/CD: GitHub Actions
- Nuthatch API: Bird species data
This project demonstrates:
- Distributed Systems: Handling concurrent database writes safely with transactions and row-level locking
- Cloud-Native Architecture: Stateless design, auto-scaling, health checks, graceful shutdown
- Edge Computing: Cloudflare integration for DDoS protection, CDN, and global distribution
- Layered Architecture: Clean separation of concerns (API β Business Logic β Data)
- Testing Strategy: Unit, integration, and concurrency tests with race detection
- CI/CD: Automated testing and deployment pipelines with Docker and Artifact Registry
- Database Design: Schema design, indexing, migrations, transaction management
- API Design: RESTful principles, hypermedia (HTMX), session-based state
- Production Readiness: Structured logging, metrics, error handling, security best practices
- Cost Optimization: Serverless compute with pay-per-use pricing model
- Static page generation for each bird with more info and conservation links
- CDN/image caching layer for bird images
Contributions welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Run tests (
go test ./... -race) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Nuthatch API for comprehensive bird species data
- Boot.dev for Go backend development curriculum
- HTMX community for modern hypermedia patterns
- Go community for excellent tooling ecosystem
Built with β€οΈ by neeeb