# pumpowhat/fitholic architecture

> Architecture diagram of the GitHub repository pumpowhat/fitholic, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pumpowhat/fitholic
- Repository: https://github.com/pumpowhat/fitholic

## Overview

Fitholic is a fitness-tracking product whose current runnable surface is a Next.js prototype plus a NestJS API focused on authentication and profile onboarding. The principal implemented flow is account creation or sign-in, followed by authenticated onboarding that calculates and stores suggested nutrition targets. The web tree also contains calendar, nutrition, workout, progress/dashboard and profile features, but README-described logging, sleep, AI-coach, worker and related capabilities are not evidenced as implemented in this tree. Arrows are limited to relationships shown in excerpts, the source index, or README; unsampled feature-to-API wiring is omitted.

Main entry points: [`packages/contracts/src/index.ts`](https://github.com/pumpowhat/fitholic/blob/main/packages/contracts/src/index.ts) (Shared contracts), [`apps/api/src/modules/profile/profile.service.ts`](https://github.com/pumpowhat/fitholic/blob/main/apps/api/src/modules/profile/profile.service.ts) (Onboarding and profile), [`apps/api/src/modules/auth/auth.controller.ts`](https://github.com/pumpowhat/fitholic/blob/main/apps/api/src/modules/auth/auth.controller.ts) (Auth endpoints), [`apps/api/src/modules/profile/profile.controller.ts`](https://github.com/pumpowhat/fitholic/blob/main/apps/api/src/modules/profile/profile.controller.ts) (Profile endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_auth_ui["Sign-in and signup<br/>[auth-screen.tsx]"]
  node_auth_state["Auth context<br/>[auth-context.tsx]"]
  node_oauth_ui["OAuth callback<br/>[oauth-callback.tsx]"]
  node_onboard_ui["Onboarding form"]
  node_dashboard["Progress dashboard<br/>[dashboard.tsx]"]
  node_nutrition_ui["Nutrition tracking<br/>[nutrition-page.tsx]"]
  node_workout_ui["Workout tracking<br/>[workout-page.tsx]"]
  node_calendar_ui["Training calendar<br/>[calendar-page.tsx]"]
  node_profile_ui["Profile settings<br/>[profile-page.tsx]"]
  node_tracking_state["Tracking state"]
  node_api_client["API client<br/>[api-client.ts]"]
end

subgraph group_identity["Identity and sessions"]
  node_auth_controller["Auth endpoints<br/>[auth.controller.ts]"]
  node_auth_service["Auth and sessions<br/>[auth.service.ts]"]
end

subgraph group_profile["Profile and targets"]
  node_profile_controller["Profile endpoints"]
  node_profile_service["Onboarding and profile<br/>[profile.service.ts]"]
  node_calculator["Nutrition calculator"]
end

subgraph group_platform["API platform"]
  node_contracts["Shared contracts<br/>[index.ts]"]
  node_database[("PostgreSQL data store<br/>[prisma.service.ts]")]
  node_app_module["API module wiring<br/>[app.module.ts]"]
  node_api_bootstrap["API bootstrap<br/>[main.ts]"]
end

node_user(("Fitness user"))

node_user -->|"signs in"| node_auth_ui
node_auth_ui -->|"uses"| node_auth_state
node_auth_controller -->|"dispatches"| node_auth_service
node_auth_service -->|"reads and writes"| node_database
node_user -->|"provides details"| node_onboard_ui
node_profile_controller -->|"dispatches"| node_profile_service
node_profile_service -->|"calculates targets"| node_calculator
node_profile_service -->|"reads and writes"| node_database
node_profile_service -->|"gets current user"| node_auth_service
node_api_bootstrap -->|"creates app"| node_app_module
node_app_module -->|"registers module"| node_auth_controller
node_app_module -->|"registers module"| node_profile_controller
node_auth_controller -->|"uses types"| node_contracts
node_profile_controller -->|"uses types"| node_contracts
node_profile_service -->|"uses types"| node_contracts
node_calculator -->|"returns target"| node_contracts
node_auth_state -->|"uses types"| node_contracts
node_api_client -->|"uses types"| node_contracts
node_auth_controller -->|"redirects callback"| node_oauth_ui

click node_auth_ui "https://github.com/pumpowhat/fitholic/blob/main/apps/web/features/auth/auth-screen.tsx"
click node_auth_state "https://github.com/pumpowhat/fitholic/blob/main/apps/web/features/auth/auth-context.tsx"
click node_oauth_ui "https://github.com/pumpowhat/fitholic/blob/main/apps/web/features/auth/oauth-callback.tsx"
click node_onboard_ui "https://github.com/pumpowhat/fitholic/blob/main/apps/web/features/onboarding/onboarding-form.tsx"
click node_dashboard "https://github.com/pumpowhat/fitholic/blob/main/apps/web/features/dashboard/dashboard.tsx"
click node_nutrition_ui "https://github.com/pumpowhat/fitholic/blob/main/apps/web/features/nutrition/nutrition-page.tsx"
click node_workout_ui "https://github.com/pumpowhat/fitholic/blob/main/apps/web/features/workout/workout-page.tsx"
click node_calendar_ui "https://github.com/pumpowhat/fitholic/blob/main/apps/web/features/calendar/calendar-page.tsx"
click node_profile_ui "https://github.com/pumpowhat/fitholic/blob/main/apps/web/features/profile/profile-page.tsx"
click node_tracking_state "https://github.com/pumpowhat/fitholic/blob/main/apps/web/features/tracking/tracking-context.tsx"
click node_api_client "https://github.com/pumpowhat/fitholic/blob/main/apps/web/lib/api-client.ts"
click node_contracts "https://github.com/pumpowhat/fitholic/blob/main/packages/contracts/src/index.ts"
click node_auth_controller "https://github.com/pumpowhat/fitholic/blob/main/apps/api/src/modules/auth/auth.controller.ts"
click node_auth_service "https://github.com/pumpowhat/fitholic/blob/main/apps/api/src/modules/auth/auth.service.ts"
click node_profile_controller "https://github.com/pumpowhat/fitholic/blob/main/apps/api/src/modules/profile/profile.controller.ts"
click node_profile_service "https://github.com/pumpowhat/fitholic/blob/main/apps/api/src/modules/profile/profile.service.ts"
click node_calculator "https://github.com/pumpowhat/fitholic/blob/main/apps/api/src/modules/profile/nutrition-calculator.service.ts"
click node_database "https://github.com/pumpowhat/fitholic/blob/main/apps/api/src/database/prisma.service.ts"
click node_app_module "https://github.com/pumpowhat/fitholic/blob/main/apps/api/src/app.module.ts"
click node_api_bootstrap "https://github.com/pumpowhat/fitholic/blob/main/apps/api/src/main.ts"

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_auth_ui,node_auth_state,node_oauth_ui,node_onboard_ui,node_dashboard,node_nutrition_ui,node_workout_ui,node_calendar_ui,node_profile_ui,node_tracking_state,node_api_client,node_user toneBlue
class node_auth_controller,node_auth_service toneAmber
class node_profile_controller,node_profile_service,node_calculator toneMint
class node_contracts,node_database,node_app_module,node_api_bootstrap toneRose
```

## Components

### Web experience

- [Sign-in and signup](https://github.com/pumpowhat/fitholic/blob/main/apps/web/features/auth/auth-screen.tsx): `apps/web/features/auth/auth-screen.tsx`
- [Auth context](https://github.com/pumpowhat/fitholic/blob/main/apps/web/features/auth/auth-context.tsx): `apps/web/features/auth/auth-context.tsx`
- [OAuth callback](https://github.com/pumpowhat/fitholic/blob/main/apps/web/features/auth/oauth-callback.tsx): `apps/web/features/auth/oauth-callback.tsx`
- [Onboarding form](https://github.com/pumpowhat/fitholic/blob/main/apps/web/features/onboarding/onboarding-form.tsx): `apps/web/features/onboarding/onboarding-form.tsx`
- [Progress dashboard](https://github.com/pumpowhat/fitholic/blob/main/apps/web/features/dashboard/dashboard.tsx): `apps/web/features/dashboard/dashboard.tsx`
- [Nutrition tracking](https://github.com/pumpowhat/fitholic/blob/main/apps/web/features/nutrition/nutrition-page.tsx): `apps/web/features/nutrition/nutrition-page.tsx`
- [Workout tracking](https://github.com/pumpowhat/fitholic/blob/main/apps/web/features/workout/workout-page.tsx): `apps/web/features/workout/workout-page.tsx`
- [Training calendar](https://github.com/pumpowhat/fitholic/blob/main/apps/web/features/calendar/calendar-page.tsx): `apps/web/features/calendar/calendar-page.tsx`
- [Profile settings](https://github.com/pumpowhat/fitholic/blob/main/apps/web/features/profile/profile-page.tsx): `apps/web/features/profile/profile-page.tsx`
- [Tracking state](https://github.com/pumpowhat/fitholic/blob/main/apps/web/features/tracking/tracking-context.tsx): `apps/web/features/tracking/tracking-context.tsx`
- [API client](https://github.com/pumpowhat/fitholic/blob/main/apps/web/lib/api-client.ts): `apps/web/lib/api-client.ts`

### Identity and sessions

- [Auth endpoints](https://github.com/pumpowhat/fitholic/blob/main/apps/api/src/modules/auth/auth.controller.ts): `apps/api/src/modules/auth/auth.controller.ts`
- [Auth and sessions](https://github.com/pumpowhat/fitholic/blob/main/apps/api/src/modules/auth/auth.service.ts): `apps/api/src/modules/auth/auth.service.ts`

### Profile and targets

- [Profile endpoints](https://github.com/pumpowhat/fitholic/blob/main/apps/api/src/modules/profile/profile.controller.ts): `apps/api/src/modules/profile/profile.controller.ts`
- [Onboarding and profile](https://github.com/pumpowhat/fitholic/blob/main/apps/api/src/modules/profile/profile.service.ts): `apps/api/src/modules/profile/profile.service.ts`
- [Nutrition calculator](https://github.com/pumpowhat/fitholic/blob/main/apps/api/src/modules/profile/nutrition-calculator.service.ts): `apps/api/src/modules/profile/nutrition-calculator.service.ts`

### API platform

- [Shared contracts](https://github.com/pumpowhat/fitholic/blob/main/packages/contracts/src/index.ts): `packages/contracts/src/index.ts`
- [PostgreSQL data store](https://github.com/pumpowhat/fitholic/blob/main/apps/api/src/database/prisma.service.ts): `apps/api/src/database/prisma.service.ts`
- [API module wiring](https://github.com/pumpowhat/fitholic/blob/main/apps/api/src/app.module.ts): `apps/api/src/app.module.ts`
- [API bootstrap](https://github.com/pumpowhat/fitholic/blob/main/apps/api/src/main.ts): `apps/api/src/main.ts`

### Other components

- **Fitness user**

## Connections

- Fitness user → Sign-in and signup: signs in (evidence: `apps/web/features/auth/auth-screen.tsx`)
- Sign-in and signup → Auth context: uses (evidence: `apps/web/features/auth/auth-screen.tsx`)
- Auth endpoints → Auth and sessions: dispatches (evidence: `apps/api/src/modules/auth/auth.controller.ts`)
- Auth and sessions → PostgreSQL data store: reads and writes (evidence: `apps/api/src/modules/auth/auth.service.ts`)
- Fitness user → Onboarding form: provides details (evidence: `README.md`)
- Profile endpoints → Onboarding and profile: dispatches (evidence: `apps/api/src/modules/profile/profile.controller.ts`)
- Onboarding and profile → Nutrition calculator: calculates targets (evidence: `apps/api/src/modules/profile/profile.service.ts`)
- Onboarding and profile → PostgreSQL data store: reads and writes (evidence: `apps/api/src/modules/profile/profile.service.ts`)
- Onboarding and profile → Auth and sessions: gets current user (evidence: `apps/api/src/modules/profile/profile.service.ts`)
- API bootstrap → API module wiring: creates app (evidence: `apps/api/src/main.ts`)
- API module wiring → Auth endpoints: registers module (evidence: `apps/api/src/app.module.ts`)
- API module wiring → Profile endpoints: registers module (evidence: `apps/api/src/app.module.ts`)
- Auth endpoints → Shared contracts: uses types (evidence: `apps/api/src/modules/auth/auth.controller.ts`)
- Profile endpoints → Shared contracts: uses types (evidence: `apps/api/src/modules/profile/profile.controller.ts`)
- Onboarding and profile → Shared contracts: uses types (evidence: `apps/api/src/modules/profile/profile.service.ts`)
- Nutrition calculator → Shared contracts: returns target (evidence: `apps/api/src/modules/profile/nutrition-calculator.service.ts`)
- Auth context → Shared contracts: uses types (evidence: `apps/web/features/auth/auth-context.tsx`)
- API client → Shared contracts: uses types (evidence: `apps/web/lib/api-client.ts`)
- Auth endpoints → OAuth callback: redirects callback (evidence: `apps/api/src/modules/auth/auth.controller.ts`)
