How krishna4a6av/chirpy works
Chirpy is a Go REST backend for user accounts, token-based authentication, chirp CRUD, and Chirpy Red upgrades. HTTP routes in main.go dispatch requests to handlers there; those handlers use internal/auth for password and token operations and internal/database for persistent data. The README documents additional account, chirp, webhook, and admin capabilities; the excerpts do not show every handler implementation, so those features are represented at the main.go boundary without inferring unsupported internal call chains.
Main entry points: main.go HTTP Routes · users.sql.go SQL Queries · auth Auth Utilities · schema Database Schema
Components 15
HTTP API
- HTTP Routes
main.go - Admin and Metrics
main.go
Accounts and Auth
- Account Handlers
main.go - Login Handler
main.go - Token Handlers
main.go - Auth Utilities
internal/auth - Upgrade Webhook
main.go
Chirp Management
- Chirp Create
main.go - Chirp Reads
main.go - Chirp Delete
main.go
Persistence
- SQL Queries
internal/database/users.sql.go - PostgreSQL
- Database Schema
sql/schema
Other components
- API Client
- Polka
Connections 26
- API Client → HTTP Routes: sends requests
- HTTP Routes → Account Handlers: dispatches
- HTTP Routes → Login Handler: dispatches
- HTTP Routes → Token Handlers: dispatches
- HTTP Routes → Upgrade Webhook: dispatches
- HTTP Routes → Chirp Create: dispatches
- HTTP Routes → Chirp Reads: dispatches
- HTTP Routes → Chirp Delete: dispatches
- HTTP Routes → Admin and Metrics: dispatches
- Account Handlers → Auth Utilities: hashes passwords
- Account Handlers → Auth Utilities: validates JWT
- Account Handlers → SQL Queries: reads and updates users
- Login Handler → Auth Utilities: checks password and signs tokens
- Login Handler → SQL Queries: reads user and saves refresh token
- Token Handlers → Auth Utilities: validates bearer token
- Token Handlers → SQL Queries: reads and revokes tokens
- Polka → Upgrade Webhook: posts upgrade event
- Upgrade Webhook → SQL Queries: upgrades user
- Chirp Create → Auth Utilities: validates JWT
- Chirp Create → SQL Queries: creates chirp
- Chirp Reads → SQL Queries: reads chirps
- Chirp Delete → Auth Utilities: validates JWT
- Chirp Delete → SQL Queries: reads and deletes chirp
- Admin and Metrics → SQL Queries: resets user data
- SQL Queries → PostgreSQL: executes SQL
- Database Schema → PostgreSQL: defines tables