Backend¶
The Tomoda backend is a single Go service that powers every API, WebSocket, and background job behind the product. It is written in Go 1.25, served over the standard net/http with the go-chi/chi v5 router, and persists data through sqlc-generated pgx queries into PostgreSQL (with PostGIS for geo queries). Redis sits behind it for caching, rate limiting, presence, and the task queue. Asynchronous work runs through Asynq and a custom distributed scheduler built on Redis. Dependencies are wired together at compile time by Google Wire.
Layered architecture¶
cmd/server (entry point + routes)
└── handlers (HTTP / WS — input parse + auth + delegate)
└── services (business logic — composes repos + Redis + 3rd-party APIs)
└── store (sqlc/pgx queries — no business rules)
└── database (Postgres + PostGIS)
Cross-cutting concerns — middleware, scheduler, Wire providers, storage clients — live alongside this stack in backend/internal/.
Start here¶
- Setup — local dev, ports, Swagger, seed data
- Configuration — YAML + env vars + GCP secrets
- Troubleshooting — common errors and fixes
- Services — domain logic catalog
- Infrastructure — DB, Redis, S3, WebSocket, workers
- API — conventions, rate limits, Swagger
- Security — rate limiting, fingerprints, threat model
First time?
Run task setup once, then task dev to bring up Postgres, Redis, MinIO, and the API with hot reload.