Services¶
The services layer is the heart of the backend: it owns all business logic that sits between HTTP handlers (backend/internal/handlers/) and the persistence layer (backend/internal/repository/, internal/database/). Handlers are thin — they parse and validate input, extract the user from the JWT, then delegate to a service. Repositories know nothing about business rules; they only execute SQL. Services are the only layer that may compose multiple repositories, talk to Redis, call out to third-party APIs (Stripe, Google Places, Photon, Apple, Google ID tokens), or enqueue background work via the scheduler.
All services live in backend/internal/services/ and are wired together with Google Wire (see backend/cmd/server/wire.go).
Service catalog¶
| Service docs | Domain |
|---|---|
| Auth | Registration, login (password, Google, Apple, LINE, WebAuthn), OTP, sessions, JWT |
| Users | Profile, avatar, password change, deactivation, GDPR delete |
| Events | Event CRUD, participants, lifecycle state machine, transfer ownership |
| Chat | Event chat, 1:1 DM, group chat, reactions, disappearing messages, WebSocket |
| Friends | Friendship graph, requests, live friend locations |
| Discovery | Map markers, radar, location/event/moment detail, H3 indexing |
| Moments | Ephemeral photo drops, likes, journaled vs. expiring |
| Presence | Heartbeat, active location sharing sessions |
| Locations | Nearby / autocomplete / resolve / reverse geocode (Google + Photon) |
| Notifications | (Not yet implemented — see doc for current status) |
| Payments | Stripe checkout, billing portal, webhook subscription sync |
| Admin | Admin stats, user moderation, category management |
Read this first
For the request lifecycle (handler → service → repository), see architecture/auth.md and Database.