Skip to content

Business Domains

Tomoda's backend is a single Go module, but its services correspond to clear product domains. This page is the index — each row points to the service file(s) that own the domain logic, the frontend folder(s) that consume it, and the API endpoint prefix where it is exposed.

For deeper documentation on each service, follow the link in the Service column.

Domain catalog

Domain Purpose Backend Frontend API prefix
Auth Identity, login, sessions, refresh tokens, passkeys, API keys auth_service.go, auth_service_ext.go, session_service.go contexts/AuthContext.tsx, app/auth/, utils/tokenManager.ts /auth
Users Profiles, preferences, avatars, account lifecycle user_service.go app/(social)/profile/, services/userService.ts /users, /auth/profile
Events Create / update / cancel events, participants, status transitions event_service.go, event_lifecycle_service.go app/home/, contexts/CreateEventContext.tsx, services/eventService.ts /events
Chat Event chat + DMs/groups, messages, reactions, read receipts chat_service.go, message_purger_service.go app/(social)/chat/, services/chatService.ts /chat, /dm, /ws/chat/:eventId
Friends Friend requests, acceptance, listing, location-sharing toggle friend_service.go contexts/FriendsContext.tsx, services/friendService.ts /friends, /location
Discovery Map data, radar, public profile lookups, recommendations discovery_service.go, recommendation_service.go app/discover/, services/discoveryService.ts /discovery
Moments Ephemeral location-anchored posts, likes, journal flag moment_service.go app/(moments)/ /moments
Presence Heartbeat-based online status, active location sharing presence_service.go contexts/LocationContext.tsx /presence
Locations Geocoding, autocomplete, nearby search, place resolution location_service.go, photon_service.go, places_service.go services/locationService.ts, utils/location.ts /locations
Notifications Email delivery, push fan-out, webhook dispatch email_service.go, webhook tests in auth_handler In-app toasts via contexts/ToastContext.tsx (internal + /auth/user/webhook/test)
Payments Stripe Checkout, subscription portal, webhook handling payment_service.go, stripe_client.go app/hub/ settings, billing screens /payment
Admin System / user stats, user status + subscription overrides admin_handler.go, audit_service.go, activity_log_service.go app/(admin)/, services/adminService.ts /admin

Cross-domain concerns

A handful of capabilities span every domain rather than belonging to one:

Concern Where it lives
Middleware chain backend/internal/middleware/ — JWT, API key, admin, IP blocker, rate limiter, security headers, trace ID
Background jobs backend/internal/worker/ (Asynq server) + backend/internal/scheduler/ (cron manager)
WebSocket Hub backend/internal/websocket/hub.go — owned by chat in practice but instantiated once for the process
Storage backend/internal/storage/ — S3/MinIO abstraction used by avatars, chat images, group avatars, moments
Redis backend/internal/services/redis_service.go — caching, presence TTLs, rate-limit counters, refresh-token mirror, SSRF cache
Logging / trace backend/internal/logger/ (Zap) + middleware/trace.go
Audit / activity audit_service.go, activity_log_service.go — append-only logs written by services on sensitive actions

Frontend mapping

The Expo Router structure mirrors the domain split:

Route group Purpose
app/auth/ Login, signup, OTP, passkey, OAuth callbacks
app/home/ Event feed, event creation/edit, RSVP
app/discover/ Map, radar, nearby people / places
app/horizon/ Calendar / upcoming events view
app/connect/ Friend graph — search, requests, list
app/hub/ Settings, billing, account, sessions
app/notifications/ Notification centre
app/(moments)/ Moments feed, composer, detail
app/(social)/ DMs, group chats, profile screens
app/(admin)/ Admin-only tools (gated by role)

Each frontend service in frontend/services/*.ts is a thin fetch wrapper for one domain, sharing the common handleResponse from frontend/utils/api.ts and the cached token from frontend/utils/tokenManager.ts.