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 by Gin, and persists data through GORM 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)
└── repository (GORM 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.