# jumyeong33/wodmon architecture

> Architecture diagram of the GitHub repository jumyeong33/wodmon, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jumyeong33/wodmon
- Repository: https://github.com/jumyeong33/wodmon

## Overview

##### Project type and purpose
- This is a NestJS–Prisma backend service (Node.js + TypeScript) implementing REST HTTP endpoints for user management, authentication (JWT + Google OAuth), and workout-of-the-day (WOD) resources (hero-wod, wods, tags).
- It exposes JSON APIs consumed by clients (web/mobile), persists data in a relational database via Prisma ORM, and integrates with Google OAuth for social login.

##### File structure
- Top-level:
- src/app.module.ts – root module binding all features
- src/main.ts – application bootstrap (NestFactory)
- src/auth, src/users, src/hero-wod, src/wods, src/tags – feature modules (controllers, services, DTOs, Prisma schemas)
- src/prisma – PrismaModule and PrismaService (DB connection, injection)
- src/common, src/utils – cross-cutting concerns (guards, decorators, filters)
- prisma/schema.prisma and prisma/migrations – database schema definitions and migration history
- Configuration: nest-cli.json, tsconfig.json, package.json, Docker or CI config can be added if needed.

##### README for additional insights
- Lists commands to start in dev/prod, run tests, generate migrations.
- Technology stack: Node.js, NestJS, Prisma, Jest for tests.

##### Detailed elements
- Service layer: note business logic classes in each module
- PrismaService: show as a shared component imported by all modules requiring DB access

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Clients
    subgraph "Clients"
        direction TB
        WebClient["Web/Mobile Clients"]
    end

    %% API Gateway
    subgraph "API Gateway" 
        direction TB
        Main["main.ts\n(NestFactory)"]:::gateway
        AppModule["app.module.ts"]:::gateway
    end

    %% Feature Modules
    subgraph "Feature Modules"
        direction TB
        AuthModule["AuthModule"]:::feature
        UsersModule["UsersModule"]:::feature
        HeroWodModule["HeroWodModule"]:::feature
        WodsModule["WodsModule"]:::feature
        TagsModule["TagsModule"]:::feature
    end

    %% Common/Utils
    subgraph "Common/Utils"
        direction TB
        CommonUtils["Guards/Decorators/Filters"]:::common
    end

    %% Data Access Layer
    subgraph "PrismaModule"
        direction TB
        PrismaModuleNode["PrismaModule"]:::prisma
        PrismaService["PrismaService"]:::prisma
    end

    %% Database
    subgraph "Database"
        direction TB
        DB["PostgreSQL"]:::database
    end

    %% External OAuth
    GoogleOAuth["Google OAuth2 Service"]:::external

    %% Connections
    WebClient -->|HTTP| Main
    Main --> AppModule
    AppModule --> AuthModule
    AppModule --> UsersModule
    AppModule --> HeroWodModule
    AppModule --> WodsModule
    AppModule --> TagsModule
    AppModule --> CommonUtils
    AppModule --> PrismaModuleNode

    AuthModule -->|injects| CommonUtils
    UsersModule -->|injects| CommonUtils
    HeroWodModule -->|injects| CommonUtils
    WodsModule -->|injects| CommonUtils
    TagsModule -->|injects| CommonUtils

    AuthModule -->|uses| PrismaService
    UsersModule -->|uses| PrismaService
    HeroWodModule -->|uses| PrismaService
    WodsModule -->|uses| PrismaService
    TagsModule -->|uses| PrismaService

    PrismaModuleNode --> PrismaService
    PrismaService -->|SQL queries| DB

    AuthModule -->|OAuth2 token exchange| GoogleOAuth

    %% Click Events
    click Main "https://github.com/jumyeong33/wodmon/blob/main/src/main.ts"
    click AppModule "https://github.com/jumyeong33/wodmon/blob/main/src/app.module.ts"
    click AuthModule "https://github.com/jumyeong33/wodmon/blob/main/src/auth/auth.module.ts"
    click UsersModule "https://github.com/jumyeong33/wodmon/blob/main/src/users/users.module.ts"
    click HeroWodModule "https://github.com/jumyeong33/wodmon/blob/main/src/hero-wod/hero-wod.module.ts"
    click WodsModule "https://github.com/jumyeong33/wodmon/blob/main/src/wods/wods.module.ts"
    click TagsModule "https://github.com/jumyeong33/wodmon/blob/main/src/tags/tags.module.ts"
    click PrismaModuleNode "https://github.com/jumyeong33/wodmon/blob/main/src/prisma/prisma.module.ts"
    click PrismaService "https://github.com/jumyeong33/wodmon/blob/main/src/prisma/prisma.service.ts"
    click CommonUtils "https://github.com/jumyeong33/wodmon/blob/main/src/common/guards/at.guard.ts"
    click CommonUtils "https://github.com/jumyeong33/wodmon/blob/main/src/common/guards/rt.guard.ts"
    click CommonUtils "https://github.com/jumyeong33/wodmon/blob/main/src/common/guards/google.guard.ts"
    click CommonUtils "https://github.com/jumyeong33/wodmon/blob/main/src/common/decorators/get-current-user.decorator.ts"
    click CommonUtils "https://github.com/jumyeong33/wodmon/blob/main/src/common/decorators/get-current-user-uuid.decorator.ts"
    click CommonUtils "https://github.com/jumyeong33/wodmon/blob/main/src/common/decorators/get-google-user.decorator.ts"
    click CommonUtils "https://github.com/jumyeong33/wodmon/blob/main/src/utils/http-exception.filter.ts"
    click CommonUtils "https://github.com/jumyeong33/wodmon/blob/main/src/utils/ReplyHelper.ts"
    click CommonUtils "https://github.com/jumyeong33/wodmon/blob/main/src/utils/UUID.ts"
    click CommonUtils "https://github.com/jumyeong33/wodmon/blob/main/src/utils/preventRobots.ts"
    click UsersModule "https://github.com/jumyeong33/wodmon/blob/main/src/users/users.controller.ts"
    click UsersModule "https://github.com/jumyeong33/wodmon/blob/main/src/users/users.service.ts"
    click UsersModule "https://github.com/jumyeong33/wodmon/blob/main/src/users/dto/create-user.dto.ts"
    click UsersModule "https://github.com/jumyeong33/wodmon/blob/main/src/users/dto/create-google-user.dto.ts"
    click UsersModule "https://github.com/jumyeong33/wodmon/blob/main/src/users/entities/user.entity.ts"
    click UsersModule "https://github.com/jumyeong33/wodmon/blob/main/src/users/users-schema.prisma"
    click AuthModule "https://github.com/jumyeong33/wodmon/blob/main/src/auth/auth.controller.ts"
    click AuthModule "https://github.com/jumyeong33/wodmon/blob/main/src/auth/auth.service.ts"
    click AuthModule "https://github.com/jumyeong33/wodmon/blob/main/src/auth/dto/login.dto.ts"
    click AuthModule "https://github.com/jumyeong33/wodmon/blob/main/src/auth/strategies/at.strategy.ts"
    click AuthModule "https://github.com/jumyeong33/wodmon/blob/main/src/auth/strategies/rt.strategy.ts"
    click AuthModule "https://github.com/jumyeong33/wodmon/blob/main/src/auth/strategies/google.strategy.ts"
    click AuthModule "https://github.com/jumyeong33/wodmon/blob/main/src/auth/interfaces/jwtPayload.interface.ts"
    click AuthModule "https://github.com/jumyeong33/wodmon/blob/main/src/auth/interfaces/jwtPayloadWithRt.interface.ts"
    click AuthModule "https://github.com/jumyeong33/wodmon/blob/main/src/auth/interfaces/tokens.interface.ts"
    click HeroWodModule "https://github.com/jumyeong33/wodmon/blob/main/src/hero-wod/hero-wod.controller.ts"
    click HeroWodModule "https://github.com/jumyeong33/wodmon/blob/main/src/hero-wod/hero-wod.service.ts"
    click HeroWodModule "https://github.com/jumyeong33/wodmon/blob/main/src/hero-wod/dto/createHeroWod.ts"
    click HeroWodModule "https://github.com/jumyeong33/wodmon/blob/main/src/hero-wod/entities/hero-wod.entity.ts"
    click HeroWodModule "https://github.com/jumyeong33/wodmon/blob/main/src/hero-wod/hero-wod-schema.prisma"
    click WodsModule "https://github.com/jumyeong33/wodmon/blob/main/src/wods/wods.controller.ts"
    click WodsModule "https://github.com/jumyeong33/wodmon/blob/main/src/wods/wods.service.ts"
    click WodsModule "https://github.com/jumyeong33/wodmon/blob/main/src/wods/dto/createWod.ts"
    click WodsModule "https://github.com/jumyeong33/wodmon/blob/main/src/wods/entities/wod.entity.ts"
    click WodsModule "https://github.com/jumyeong33/wodmon/blob/main/src/wods/wods-schema.prisma"
    click TagsModule "https://github.com/jumyeong33/wodmon/blob/main/src/tags/tags.controller.ts"
    click TagsModule "https://github.com/jumyeong33/wodmon/blob/main/src/tags/tags.service.ts"
    click TagsModule "https://github.com/jumyeong33/wodmon/blob/main/src/tags/dto/create-tag.dto.ts"
    click TagsModule "https://github.com/jumyeong33/wodmon/blob/main/src/tags/entities/tag.entity.ts"
    click TagsModule "https://github.com/jumyeong33/wodmon/blob/main/src/tags/tags-schema.prisma"
    click DB "https://github.com/jumyeong33/wodmon/blob/main/prisma/schema.prisma"
    click DB "https://github.com/jumyeong33/wodmon/tree/main/prisma/migrations/"

    %% Styles
    classDef feature fill:#ADD8E6,stroke:#000
    classDef common fill:#D3D3D3,stroke:#000
    classDef prisma fill:#E6E6FA,stroke:#000
    classDef database fill:#98FB98,stroke:#000
    classDef external fill:#FFA500,stroke:#000
    classDef gateway fill:#87CEFA,stroke:#000
```
