# ban-gilhyeon/motiv8-backend architecture

> Architecture diagram of the GitHub repository ban-gilhyeon/motiv8-backend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ban-gilhyeon/motiv8-backend
- Repository: https://github.com/ban-gilhyeon/motiv8-backend

## Overview

Motiv8 is an early-stage NestJS REST backend for exercise-based motivation. The implemented user path is API requests for signup/login/profile, through controllers and application services, to repository adapters and PostgreSQL; signup also creates a profile, while profile experience updates can affect level. The README describes exercise logging, journals, character changes, recommendations, reminders, and social features as product goals, not completed capabilities, so these are shown as planned subsystems without invented runtime connections. Evidence is limited to the README and indexed or excerpted source; unsampled feature wiring is not asserted.

Main entry points: [`src/modules/auth/application/auth.service.ts`](https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/auth/application/auth.service.ts) (Auth workflows), [`src/modules`](https://github.com/ban-gilhyeon/motiv8-backend/tree/main/src/modules) (Workout records and journal), [`src/modules/auth/presentation/auth.controller.ts`](https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/auth/presentation/auth.controller.ts) (Auth API), [`src/modules/profile/presentation/profile.controller.ts`](https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/profile/presentation/profile.controller.ts) (Profile API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and runtime"]
  node_app["NestJS application<br/>[app.module.ts]"]
  node_auth_controller["Auth API<br/>[auth.controller.ts]"]
  node_profile_controller["Profile API"]
  node_prisma["Prisma service<br/>[prisma.service.ts]"]
  node_database[("PostgreSQL")]
end

subgraph group_identity["Identity"]
  node_auth_service["Auth workflows<br/>[auth.service.ts]"]
  node_password["Password hashing<br/>[password-hasher.ts]"]
  node_token["Token issuance<br/>[token-issuer.ts]"]
  node_jwt_strategy["JWT strategy<br/>[jwt.strategy.ts]"]
  node_auth_guard["JWT guard<br/>[jwt-auth.guard.ts]"]
  node_user_port["User repository port"]
  node_refresh_port["Refresh-token port"]
  node_user_adapter["User persistence"]
  node_refresh_adapter["Refresh-token persistence"]
end

subgraph group_profile["User profile"]
  node_profile_service["Profile workflows<br/>[profile.service.ts]"]
  node_level_policy["Level policy<br/>[level-policy.ts]"]
  node_profile_port["Profile repository port"]
  node_profile_adapter["Profile persistence"]
end

subgraph group_fitness["Exercise experience"]
  node_exercise["Exercise catalog and routines"]
  node_workout_log["Workout records and journal"]
end

subgraph group_engagement["Motivation features"]
  node_character["Character progression"]
  node_recommendations["Exercise recommendations"]
  node_notifications["Reminders and alerts"]
  node_social["Friends and competition"]
end

node_client(("Web or mobile client"))

node_client -->|"sends REST requests"| node_auth_controller
node_client -->|"sends REST requests"| node_profile_controller
node_app -->|"registers"| node_auth_controller
node_app -->|"registers"| node_profile_controller
node_auth_controller -->|"calls"| node_auth_service
node_profile_controller -->|"calls"| node_profile_service
node_auth_controller -->|"guards protected route"| node_auth_guard
node_profile_controller -->|"guards protected route"| node_auth_guard
node_auth_service -->|"hashes and verifies"| node_password
node_auth_service -->|"issues and verifies"| node_token
node_auth_service -->|"uses"| node_user_port
node_auth_service -->|"uses"| node_refresh_port
node_auth_service -->|"creates profile"| node_profile_service
node_user_adapter -->|"implements"| node_user_port
node_refresh_adapter -->|"implements"| node_refresh_port
node_profile_service -->|"uses"| node_profile_port
node_profile_service -->|"calculates level"| node_level_policy
node_profile_adapter -->|"implements"| node_profile_port
node_prisma -->|"connects"| node_database
node_user_adapter -->|"uses"| node_prisma
node_refresh_adapter -->|"uses"| node_prisma
node_profile_adapter -->|"uses"| node_prisma
node_workout_log -.->|"supports progression"| node_character
node_workout_log -.->|"informs suggestions"| node_recommendations
node_workout_log -.->|"triggers reminders and alerts"| node_notifications
node_workout_log -.->|"supports comparison"| node_social
node_exercise -.->|"structures records"| node_workout_log

click node_app "https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/app.module.ts"
click node_auth_controller "https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/auth/presentation/auth.controller.ts"
click node_profile_controller "https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/profile/presentation/profile.controller.ts"
click node_auth_service "https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/auth/application/auth.service.ts"
click node_password "https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/auth/application/components/password-hasher.ts"
click node_token "https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/auth/application/components/token-issuer.ts"
click node_jwt_strategy "https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/auth/infrastructure/jwt/jwt.strategy.ts"
click node_auth_guard "https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/common/guards/jwt-auth.guard.ts"
click node_user_port "https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/auth/domain/repositories/user-repository.port.ts"
click node_refresh_port "https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/auth/domain/repositories/refresh-token-repository.port.ts"
click node_user_adapter "https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/auth/infrastructure/prisma/prisma-user.repository.ts"
click node_refresh_adapter "https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/auth/infrastructure/prisma/prisma-refresh-token.repository.ts"
click node_profile_service "https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/profile/application/profile.service.ts"
click node_level_policy "https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/profile/application/components/level-policy.ts"
click node_profile_port "https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/profile/domain/repositories/profile-repository.port.ts"
click node_profile_adapter "https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/profile/infrastructure/prisma/prisma-profile.repository.ts"
click node_prisma "https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/auth/infrastructure/prisma/prisma.service.ts"
click node_exercise "https://github.com/ban-gilhyeon/motiv8-backend/tree/main/src/modules"
click node_workout_log "https://github.com/ban-gilhyeon/motiv8-backend/tree/main/src/modules"
click node_character "https://github.com/ban-gilhyeon/motiv8-backend/tree/main/src/modules"
click node_recommendations "https://github.com/ban-gilhyeon/motiv8-backend/tree/main/src/modules"
click node_notifications "https://github.com/ban-gilhyeon/motiv8-backend/tree/main/src/modules"
click node_social "https://github.com/ban-gilhyeon/motiv8-backend/tree/main/src/modules"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_auth_controller,node_profile_controller,node_prisma,node_database,node_client toneBlue
class node_auth_service,node_password,node_token,node_jwt_strategy,node_auth_guard,node_user_port,node_refresh_port,node_user_adapter,node_refresh_adapter toneAmber
class node_profile_service,node_level_policy,node_profile_port,node_profile_adapter toneMint
class node_exercise,node_workout_log toneRose
class node_character,node_recommendations,node_notifications,node_social toneIndigo
```

## Components

### API and runtime

- [NestJS application](https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/app.module.ts): `src/app.module.ts`
- [Auth API](https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/auth/presentation/auth.controller.ts): `src/modules/auth/presentation/auth.controller.ts`
- [Profile API](https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/profile/presentation/profile.controller.ts): `src/modules/profile/presentation/profile.controller.ts`
- [Prisma service](https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/auth/infrastructure/prisma/prisma.service.ts): `src/modules/auth/infrastructure/prisma/prisma.service.ts`
- **PostgreSQL**

### Identity

- [Auth workflows](https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/auth/application/auth.service.ts): `src/modules/auth/application/auth.service.ts`
- [Password hashing](https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/auth/application/components/password-hasher.ts): `src/modules/auth/application/components/password-hasher.ts`
- [Token issuance](https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/auth/application/components/token-issuer.ts): `src/modules/auth/application/components/token-issuer.ts`
- [JWT strategy](https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/auth/infrastructure/jwt/jwt.strategy.ts): `src/modules/auth/infrastructure/jwt/jwt.strategy.ts`
- [JWT guard](https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/common/guards/jwt-auth.guard.ts): `src/common/guards/jwt-auth.guard.ts`
- [User repository port](https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/auth/domain/repositories/user-repository.port.ts): `src/modules/auth/domain/repositories/user-repository.port.ts`
- [Refresh-token port](https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/auth/domain/repositories/refresh-token-repository.port.ts): `src/modules/auth/domain/repositories/refresh-token-repository.port.ts`
- [User persistence](https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/auth/infrastructure/prisma/prisma-user.repository.ts): `src/modules/auth/infrastructure/prisma/prisma-user.repository.ts`
- [Refresh-token persistence](https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/auth/infrastructure/prisma/prisma-refresh-token.repository.ts): `src/modules/auth/infrastructure/prisma/prisma-refresh-token.repository.ts`

### User profile

- [Profile workflows](https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/profile/application/profile.service.ts): `src/modules/profile/application/profile.service.ts`
- [Level policy](https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/profile/application/components/level-policy.ts): `src/modules/profile/application/components/level-policy.ts`
- [Profile repository port](https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/profile/domain/repositories/profile-repository.port.ts): `src/modules/profile/domain/repositories/profile-repository.port.ts`
- [Profile persistence](https://github.com/ban-gilhyeon/motiv8-backend/blob/main/src/modules/profile/infrastructure/prisma/prisma-profile.repository.ts): `src/modules/profile/infrastructure/prisma/prisma-profile.repository.ts`

### Exercise experience

- [Exercise catalog and routines](https://github.com/ban-gilhyeon/motiv8-backend/tree/main/src/modules): `src/modules`
- [Workout records and journal](https://github.com/ban-gilhyeon/motiv8-backend/tree/main/src/modules): `src/modules`

### Motivation features

- [Character progression](https://github.com/ban-gilhyeon/motiv8-backend/tree/main/src/modules): `src/modules`
- [Exercise recommendations](https://github.com/ban-gilhyeon/motiv8-backend/tree/main/src/modules): `src/modules`
- [Reminders and alerts](https://github.com/ban-gilhyeon/motiv8-backend/tree/main/src/modules): `src/modules`
- [Friends and competition](https://github.com/ban-gilhyeon/motiv8-backend/tree/main/src/modules): `src/modules`

### Other components

- **Web or mobile client**

## Connections

- Web or mobile client → Auth API: sends REST requests (evidence: `README.md`)
- Web or mobile client → Profile API: sends REST requests (evidence: `README.md`)
- NestJS application → Auth API: registers (evidence: `src/app.module.ts`)
- NestJS application → Profile API: registers (evidence: `src/app.module.ts`)
- Auth API → Auth workflows: calls (evidence: `src/modules/auth/presentation/auth.controller.ts`)
- Profile API → Profile workflows: calls (evidence: `src/modules/profile/presentation/profile.controller.ts`)
- Auth API → JWT guard: guards protected route (evidence: `src/modules/auth/presentation/auth.controller.ts`)
- Profile API → JWT guard: guards protected route (evidence: `src/modules/profile/presentation/profile.controller.ts`)
- Auth workflows → Password hashing: hashes and verifies (evidence: `src/modules/auth/application/auth.service.ts`)
- Auth workflows → Token issuance: issues and verifies (evidence: `src/modules/auth/application/auth.service.ts`)
- Auth workflows → User repository port: uses (evidence: `src/modules/auth/application/auth.service.ts`)
- Auth workflows → Refresh-token port: uses (evidence: `src/modules/auth/application/auth.service.ts`)
- Auth workflows → Profile workflows: creates profile (evidence: `src/modules/auth/application/auth.service.ts`)
- User persistence → User repository port: implements (evidence: `src/modules/auth/infrastructure/prisma/prisma-user.repository.ts`)
- Refresh-token persistence → Refresh-token port: implements (evidence: `src/modules/auth/infrastructure/prisma/prisma-refresh-token.repository.ts`)
- Profile workflows → Profile repository port: uses (evidence: `src/modules/profile/application/profile.service.ts`)
- Profile workflows → Level policy: calculates level (evidence: `src/modules/profile/application/profile.service.ts`)
- Profile persistence → Profile repository port: implements (evidence: `src/modules/profile/infrastructure/prisma/prisma-profile.repository.ts`)
- Prisma service → PostgreSQL: connects (evidence: `src/modules/auth/infrastructure/prisma/prisma.service.ts`)
- User persistence → Prisma service: uses (evidence: `src/modules/auth/infrastructure/prisma/prisma-user.repository.ts`)
- Refresh-token persistence → Prisma service: uses (evidence: `src/modules/auth/infrastructure/prisma/prisma-refresh-token.repository.ts`)
- Profile persistence → Prisma service: uses (evidence: `src/modules/profile/infrastructure/prisma/prisma-profile.repository.ts`)
- Workout records and journal → Character progression: supports progression (evidence: `README.md`)
- Workout records and journal → Exercise recommendations: informs suggestions (evidence: `README.md`)
- Workout records and journal → Reminders and alerts: triggers reminders and alerts (evidence: `README.md`)
- Workout records and journal → Friends and competition: supports comparison (evidence: `README.md`)
- Exercise catalog and routines → Workout records and journal: structures records (evidence: `README.md`)
