How menumate-a2sv/dineq-backend works
DineQ is a Go HTTP service for restaurant menus, with account and authentication features alongside restaurant, menu, item, photo, and review functionality. The principal workflow is an HTTP request entering the API, being routed to a handler, and—where wired—being served by a use case and infrastructure. Sampled auth code shows registration, login and token refresh, OTP verification, password reset, and Google sign-in; the tree also shows content-management modules. Most content handlers and the central router setup were not sampled, so their internal wiring is not inferred.
Main entry points: auth_routes.go Auth Routes · auth_handler.go Auth Handler · user_routes.go User Routes · user_usecase.go User Use Case
Components 34
HTTP API
- API Server
cmd/api/main.go - Router Setup
internal/interfaces/http/routers/setup.go - Auth Routes
internal/interfaces/http/routers/auth_routes.go - User Routes
internal/interfaces/http/routers/user_routes.go - Auth Handler
internal/interfaces/http/handlers/auth_handler.go - User Handler
internal/interfaces/http/handlers/user_handler.go - Restaurant Handler
internal/interfaces/http/handlers/restaurant_handler.go - Menu Handler
internal/interfaces/http/handlers/menu_handler.go - Item Handler
internal/interfaces/http/handlers/item_handler.go - Photo Handler
internal/interfaces/http/handlers/photo_handler.go - Review Handler
internal/interfaces/http/handlers/review_handler.go
Business Logic
- User Use Case
internal/usecases/user_usecase.go - OTP Use Case
internal/usecases/otp_usecase.go - Refresh Token Use Case
internal/usecases/refresh_token_usecase.go - Restaurant Use Case
internal/usecases/restaurant_usecase.go - Menu Use Case
internal/usecases/menu_usecase.go - Item Use Case
internal/usecases/item_usecase.go - Photo Use Case
internal/usecases/photo_usecase.go - Review Use Case
internal/usecases/review_usecase.go
Infrastructure
- MongoDB
internal/infrastructure/database/mongo.go - User Repository
internal/infrastructure/repositories/user_repo.go - OTP Repository
internal/infrastructure/repositories/otp_repo.go - Refresh Repository
internal/infrastructure/repositories/refresh_token_repo.go - JWT Service
internal/infrastructure/security/jwt_service.go - Email Service
internal/infrastructure/email/gomail_services.go - Image Storage
internal/infrastructure/storage/imagekit.go - Google OAuth
internal/infrastructure/oauth/google.go
Domain
- User Model
internal/domain/user.go - OTP Model
internal/domain/otp.go - Menu Model
internal/domain/menu.go - Restaurant Model
internal/domain/restaurant.go - Item Model
internal/domain/item.go
Other components
- API Client
- SMTP Service
Connections 32
- API Client → API Server: sends request
- API Server → Router Setup: configures routes
- Router Setup → Auth Routes: registers routes
- Router Setup → User Routes: registers routes
- Auth Routes → Auth Handler: dispatches auth
- User Routes → User Handler: dispatches profile
- Auth Routes → User Repository: constructs
- Auth Routes → OTP Repository: constructs
- Auth Routes → Refresh Repository: constructs
- Auth Routes → User Use Case: constructs
- Auth Routes → OTP Use Case: constructs
- Auth Routes → Refresh Token Use Case: constructs
- Auth Routes → JWT Service: constructs
- Auth Routes → Email Service: constructs
- Auth Routes → Image Storage: constructs
- User Routes → User Repository: constructs
- User Routes → User Use Case: constructs
- User Routes → Image Storage: constructs
- Auth Handler → User Use Case: calls
- Auth Handler → OTP Use Case: calls
- Auth Handler → Refresh Token Use Case: calls
- Auth Handler → JWT Service: generates tokens
- Auth Handler → Google OAuth: starts OAuth
- User Use Case → User Repository
- User Use Case → Image Storage
- OTP Use Case → OTP Repository
- OTP Use Case → Email Service
- Refresh Token Use Case → Refresh Repository
- User Repository → MongoDB: reads/writes
- OTP Repository → MongoDB: reads/writes
- Refresh Repository → MongoDB: reads/writes
- Email Service → SMTP Service: sends email