How go-park-mail-ru/2026_2_totallyswipes works
This is a Go backend for a Tinder-style dating product. Its principal workflow is account registration/login, profile and photo creation, authenticated personality-test submission, then profile-based feed generation with compatibility scores. The graph also includes profile retrieval, refreshable sessions, and supporting middleware and persistence. Several test, profile-short, and storage implementations were not excerpted; their presence and some wiring are supported by the entry-point routes, but their internal behavior is not inferred.
Main entry points: main.go HTTP Server · auth_service.go Authentication · profile_service.go Profiles and Feed · post_auth_register_handler.go Auth Handlers
Components 22
HTTP API
- HTTP Server
cmd/api/main.go - Auth Routes
cmd/api/main.go - Auth Handlers
internal/handler/post_auth_register_handler.go - Feed Handler
internal/handler/get_feed_handler.go - Test Handlers
internal/handler/get_tests_current_handler.go - Short Profile Handler
internal/handler/get_profile_short_handler.go
Dating Services
- Authentication
internal/service/auth_service.go - Profiles and Feed
internal/service/profile_service.go - Compatibility Scoring
internal/service/compatibility_service.go - Personality Tests
internal/service - Input Validation
internal/validate/validate.go
Persistence
- User Repository
internal/repository/auth_user_repository.go - Profile Repository
internal/repository/profile_repository.go - Session Repository
internal/repository/session_repository.go - PostgreSQL
internal/storage/postgres.go - Redis
internal/storage/redis.go - Photo Storage
internal/storage/photo.go
Auth Security
- JWT Middleware
internal/middleware/auth.go - JWT Tokens
internal/auth/token.go - Password Hashing
internal/auth/hasher.go - Configuration
internal/config/config.go
Other components
- API Client
Connections 26
- API Client → HTTP Server: sends requests
cmd/api/main.go - HTTP Server → Auth Routes: routes auth
cmd/api/main.go - Auth Routes → Auth Handlers: dispatches
cmd/api/main.go - HTTP Server → Feed Handler: routes feed
cmd/api/main.go - HTTP Server → Test Handlers: routes tests
cmd/api/main.go - HTTP Server → Short Profile Handler: routes profile
cmd/api/main.go - Auth Handlers → Authentication: calls
internal/handler/post_auth_register_handler.go - Auth Handlers → Input Validation: validates input
internal/handler/post_auth_register_handler.go - Authentication → User Repository: creates and finds users
internal/service/auth_service.go - Authentication → Session Repository: manages sessions
internal/service/auth_service.go - Authentication → Profiles and Feed: checks completion
internal/service/auth_service.go - Authentication → Password Hashing: hashes passwords
internal/service/auth_service.go - Authentication → JWT Tokens: issues access tokens
internal/service/auth_service.go - Authentication → Photo Storage: deletes orphan photos
internal/service/auth_service.go - User Repository → PostgreSQL: queries
internal/repository/auth_user_repository.go - Session Repository → Redis: stores sessions
internal/repository/session_repository.go - Feed Handler → Profiles and Feed: requests feed
- Short Profile Handler → Profiles and Feed: requests profile
- Profiles and Feed → Profile Repository: loads profiles
internal/service/profile_service.go - Profiles and Feed → Compatibility Scoring: calculates compatibility
internal/service/profile_service.go - Profile Repository → PostgreSQL: reads and writes
- Test Handlers → Personality Tests: submits and reads tests
- Personality Tests → Profiles and Feed: updates profile results
- HTTP Server → JWT Middleware: protects routes
cmd/api/main.go - JWT Middleware → JWT Tokens: parses tokens
internal/middleware/auth.go - HTTP Server → Configuration: loads settings
cmd/api/main.go