How projectgammacompany/eduplay-backend works
Purpose and entry points
This is a Go microservice backend for EduPlay: user identity, educational events/tasks, file/public-event data, and notifications, fronted by an HTTP gateway. Each Go service starts from cmd/service/main.go, notably eduplay-gateway/cmd/service/main.go, eduplay-event/cmd/service/main.go, and eduplay-user/cmd/service/main.go. The separate Python mail service starts at eduplay-mail/run.py.
HTTP edge and request orchestration
eduplay-gateway is the public HTTP boundary. Its application bootstrap and route composition are in eduplay-gateway/internal/application/application.go and eduplay-gateway/internal/http/routers/. HTTP handlers delegate to gateway use cases, which call downstream gRPC clients rather than directly accessing service databases. Cross-cutting HTTP controls include CORS, logging, request sizing, and token validation in eduplay-gateway/internal/http/middleware/ and eduplay-gateway/internal/http/tokens/validation.go.
Event domain service
eduplay-event owns the event-authoring and player workflow: events, blocks, tasks, conditions, participation/groups, answers, progression, ratings, favorites, history, and stats. Its RPC boundary is eduplay-event/internal/rpc/event_handler/handler.go; business operations are concentrated in eduplay-event/internal/pkg/usecase/events/; persistence is behind eduplay-event/internal/pkg/storage/postgres/postgres.go. The gateway maps corresponding HTTP operations into this service through eduplay-gateway/internal/pkg/clients/event/eventClient.go and eduplay-gateway/internal/pkg/usecases/event/.
User identity and account lifecycle
eduplay-user owns registration, sign-in/out, refresh tokens, profiles, passwords, avatars, verification codes, and account deletion. Its domain models are in eduplay-user/internal/model/, RPC implementation in eduplay-user/internal/rpc/user_handler/handler.go, and PostgreSQL adapter in eduplay-user/internal/pkg/storage/postgres/postgres.go. Gateway user endpoints flow through eduplay-gateway/internal/pkg/clients/user/usersClient.go and eduplay-gateway/internal/pkg/usecases/user/.
Data/files and notifications
eduplay-data provides file saving and public-event retrieval, exposing gRPC via eduplay-data/internal/rpc/data_handler/handler.go and persisting through eduplay-data/internal/pkg/storage/postgres/postgres.go. eduplay-notification independently serves notification retrieval/deletion through eduplay-notification/internal/rpc/notification_handler/handler.go and eduplay-notification/internal/pkg/usecase/notification/. Both are consumed by gateway-specific clients: eduplay-gateway/internal/pkg/clients/data/dataClient.go and eduplay-gateway/internal/pkg/clients/notification/notificationClient.go.
Service contracts and asynchronous boundaries
Service-to-service synchronous communication is gRPC, defined by per-service protobuf contracts such as eduplay-event/proto/service_events.proto, eduplay-user/proto/service_users.proto, and gateway client contracts under eduplay-gateway/proto/clients/. RabbitMQ is an asynchronous integration boundary: user code has a producer at eduplay-user/internal/pkg/usecase/rabbitmq/producer.go, while event and data include consumers at eduplay-event/internal/pkg/usecase/rabbitmq/consumer.go and eduplay-data/internal/pkg/usecase/rabbitmq/consumer.go. Email delivery is delegated from user logic to the mail client at eduplay-user/internal/pkg/clients/email/client.go, with implementation in eduplay-mail/mail/srv.py.
Persistence and deployment
PostgreSQL schema is partitioned by domain in database/users.sql, database/events.sql, database/files.sql, and database/notification.sql. Local multi-container composition is represented by docker-compose.yml; each service has a Dockerfile. Kubernetes deployment manifests cover gateway, event, user, notification, and mail under k8s/app/, with public ingress specifically at k8s/app/eduplay-gateway/ingress.yaml. Argo bootstrap is defined in k8s/bootstrap/argo-app.yaml.
Main entry points: docker-compose.yml Container deployment · dataClient.go Data & notification clients · producer.go RabbitMQ · handler.go Event RPC service
Components 21
HTTP Gateway
Public API and downstream gRPC orchestration.
- Public clients
- Gateway routes & middleware · Routes apply token validation and HTTP controls.
- Gateway application
eduplay-gateway/internal/application/application.go - Event gateway use cases
- User gateway use cases
- Data & notification clients
eduplay-gateway/internal/pkg/clients/data/dataClient.go
Domain Services
Independently owned gRPC domains.
- Event RPC service
eduplay-event/internal/rpc/event_handler/handler.go - Event workflow · Authors and runs events, tasks, progression, and player activity.
- Event storage
eduplay-event/internal/pkg/storage/postgres/postgres.go - User RPC service
eduplay-user/internal/rpc/user_handler/handler.go - Account lifecycle · Registration, authentication, profiles, credentials, and verification.
- User storage
eduplay-user/internal/pkg/storage/postgres/postgres.go - Data RPC service · Provides file saving and public-event retrieval.
eduplay-data/internal/rpc/data_handler/handler.go - Data storage
eduplay-data/internal/pkg/storage/postgres/postgres.go - Notification RPC service
eduplay-notification/internal/rpc/notification_handler/handler.go - Notification use cases · Retrieves and deletes notifications.
Integration & Data
Shared asynchronous, persistence, and deployment boundaries.
- Service protobuf contracts · Defines synchronous service APIs.
eduplay-event/proto/service_events.proto - RabbitMQ · Asynchronous user-to-event/data integration boundary.
eduplay-user/internal/pkg/usecase/rabbitmq/producer.go - Mail service · Delivers email requested by user workflows.
eduplay-mail/mail/srv.py - Domain PostgreSQL schemas · Separate users, events, files, and notification schemas.
database/users.sql - Container deployment · Local composition, Kubernetes workloads, ingress, and Argo bootstrap.
docker-compose.yml
Connections 29
- Public clients → Gateway routes & middleware: HTTPS
- Gateway application → Gateway routes & middleware: composes
- Gateway routes & middleware → Event gateway use cases: event requests
- Gateway routes & middleware → User gateway use cases: account requests
- Gateway routes & middleware → Data & notification clients: data and notifications
- Event gateway use cases → Event RPC service: gRPC
- User gateway use cases → User RPC service: gRPC
- Data & notification clients → Data RPC service: gRPC
- Data & notification clients → Notification RPC service: gRPC
- Event RPC service → Event workflow: delegates
- Event workflow → Event storage: persists
- User RPC service → Account lifecycle: delegates
- Account lifecycle → User storage: persists
- Data RPC service → Data storage: persists
- Notification RPC service → Notification use cases: delegates
- Event gateway use cases → Service protobuf contracts: uses API
- User gateway use cases → Service protobuf contracts: uses API
- Account lifecycle → RabbitMQ: publishes
- RabbitMQ → Event workflow: consumed by
- RabbitMQ → Data RPC service: consumed by
- Account lifecycle → Mail service: email client
- Event storage → Domain PostgreSQL schemas: events schema
- User storage → Domain PostgreSQL schemas: users schema
- Data storage → Domain PostgreSQL schemas: files schema
- Container deployment → Gateway application: deploys
- Container deployment → Event RPC service: deploys
- Container deployment → User RPC service: deploys
- Container deployment → Notification RPC service: deploys
- Container deployment → Mail service: deploys