How goorm-sudo/raillo-backend works
Project Type and Purpose
• This is a backend monolithic application (Spring Boot) that implements a ticket reservation platform (“Raillo”).
• It’s organized into logical business domains (packages/modules): Member, Booking, Payment, Train, plus a Global/Common module.
High-Level Architectural Overview
• The entire system runs as one Spring Boot application deployed in Kubernetes.
• Externally it exposes a REST API consumed by clients (mobile/web).
• Internally it uses layered/hexagonal architecture:
• Controllers (presentation)
• Application services (use-case layer)
• Domain layer (business rules & entities)
• Infrastructure/adapters (JPA repositories, Redis, external HTTP clients)
• It relies on:
• Relational DB (JPA)
• Redis (distributed locks, logout tokens, caching)
• External Payment Gateways (e.g., KakaoPay, NaverPay)
• Email service (for authentication)
• Excel file inputs (train schedules & fares)
• It is deployed via Docker → Kubernetes, managed by ArgoCD, and monitored with Prometheus + Grafana.
Main Components
A. API Layer
• BookingController, MemberController, PaymentControllers, TrainControllers (Spring MVC)
B. Application Services (per module)
• BookingApplicationService, ReservationService, TicketService, etc.
• MemberAuthService, MemberService
• PaymentCreationService, PaymentExecutionService, MileageEarningApplicationService, etc.
• TrainScheduleService, SeatReservationService, StationService
C. Domain Layer
• Aggregates & Entities (Reservation, Ticket, Member, Payment, TrainSchedule, StationFare, etc.)
• Domain services & policies (e.g., RefundPolicyFactory)
• Domain events & listeners (BookingPaymentCompletedEvent, PaymentRefundedEvent, MileageEventListener)
D. Infrastructure Adapters
• Persistence adapters (Jpa…Repository implementations)
• RedisConfig & RedisUtil for caching/locking
• External HTTP clients & gateways (PgApiClient, KakaoPayGateway, MemberInfoAdapter)
• Excel parsers for initial data load
E. Supporting Infrastructure
• PostgreSQL (or chosen RDBMS)
• Redis Cluster
• Kubernetes cluster
• ArgoCD (GitOps)
• Prometheus + Grafana + node-exporter
Relationships & Data Flows
1) Client → HTTP(S) → API Gateway / Load Balancer in k8s
2) Requests routed to Spring Boot pod → Controller
3) Controller → Application Service → Domain Logic
4) Domain Logic → Repository Ports → JPA Adapter → Database
5) Some operations fire Domain Events → Event Listeners handle async tasks (e.g., refund alerts, mileage scheduling)
6) Payment flows call external PG Gateway via HTTP clients → back to application → persist transaction
7) Redis used for distributed locks (annotation @DistributedLock), token storage (logout)
8) Scheduled jobs (ReservationScheduler, MileageEarningScheduler) execute periodic tasks
Key Architectural Patterns & Principles
• Layered Architecture (presentation → application → domain → infrastructure)
• Hexagonal / Ports & Adapters (payment module defines ports/in/out for testability)
• Domain-Driven Design (bounded contexts for Booking, Payment, Member, Train)
• Event-Driven (internal Spring events for decoupling)
• Scheduled tasks for background processing
• GitOps for deployment (ArgoCD), CI pipelines via GitHub Actions
Summary
• Traffic ingress (Ingress/NLB → Spring Boot pod)
• Module boundaries (Booking, Payment, etc.)
• Data stores & caches (DB, Redis)
• External dependencies (PG gateways, email)
• CI/CD & GitOps layers (GitHub Actions, Docker registry, ArgoCD)
• Monitoring stack
• Aim for clarity: a viewer should immediately understand the major functional domains, data flows, and deployment topology of Raillo.