How victoryfairy/victoryfairy-backend works
Project Type and Purpose
• This is a backend service for a baseball game record web application (“승리요정”). It’s built using NestJS and follows a modular architecture. The service handles user authentication, game data, ranking, cheering songs, parking info, and more. It integrates with PostgreSQL (via AWS RDS), Redis for caching, AWS S3 for storage, external services (e.g., Slack, nodemailer for email), and utilizes Docker containerization with various docker-compose files for local, staging, and production deployments.
File Structure
• The top-level directories and files (e.g., src/, core/, modules/, common/, shared/, tools/, test/) show the separation of business logic (modules), common helper code (guards, pipes, interceptors in common/), centralized configuration and integration logic (core/), and shared types and DTOs (shared/).
• Each business domain is isolated within its own module (e.g., auth, game, stadium, team, user), which helps to emphasize a highly modular, possibly domain-driven design.
• There are also infrastructure-related folders: “core” (with AWS, Redis, mail, etc.), “tools” (for database migrations and seeders), and GitHub workflows for CI/CD and deployment.
• Configuration and deployment files (like Dockerfile, docker-compose YAMLs, GitHub Actions workflows) indicate that container orchestration and automated deployment (including staging and production) are important parts of the system.
README for Additional Insights
• The README explains the team’s architectural approach and technology stack. Key external services include PostgreSQL, Redis, AWS services, and Slack.
a. Main Components:
• API Server: The main NestJS application containing multiple modules (auth, game, cheering-song, team, etc.).
• Business Modules: Each domain (account, auth, cheering-song, game, parking-info, rank, registered-game, stadium, team, term, user) represented as separate components.
• Core Infrastructure: Includes AWS S3 integration, Redis (with multiple services for caching, ranking, user sessions, etc.), mailing subsystem, slack integration, and scheduling/crawling utilities.
• Database: PostgreSQL (hosted on AWS RDS) that stores all persistent data.
• External Interfaces: Docker containerization (Dockerfiles and docker-compose for different environments), third-party services (Route53, ALB, Cloudflare for staging), and CI/CD flows (GitHub Actions and various deployment workflows).
b. Relationships and Interactions:
• Within the NestJS server, illustrate connections between controllers and their corresponding services.
• How the business modules interact with core infrastructure (e.g., auth module using Redis for token management; mail module invoking nodemailer configurations; AWS S3 module interfacing with S3 storage).
• Data flow between the API server and external dependencies, including the PostgreSQL database and Redis.
c. Important Architectural Patterns and Technologies:
• A modular (domain-driven) architecture where each business domain is encapsulated within its own module.
• Use of NestJS’s dependency injection, middleware (for logging and meta gathering), guards, pipes, filters, and interceptors.
• Acknowledge the containerized deployment approach (Docker and Docker Compose with multiple configurations for different environments) and automated CI/CD pipelines.
• Integration with external technologies like PostgreSQL (RDS), Redis, AWS services, and Slack for notifications.
d. Relevant Technologies, Frameworks, or Libraries:
• NestJS as the core framework.
• PostgreSQL via AWS RDS and TypeORM as the ORM.
• Redis for caching and session management.
• AWS S3 for file storage.
• Docker (with Dockerfiles and docker-compose configurations) for containerization.
• GitHub Actions for CI/CD workflows.
• Nodemailer, Slack, and external API integrations.