# kupr666/orange_team architecture

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

- Interactive diagram: https://gitdiagram.com/kupr666/orange_team
- Repository: https://github.com/kupr666/orange_team

## Overview

SoloLeveling is a fitness and habit-tracking product with a Go HTTP API, PostgreSQL persistence, and a separate React frontend. Users register or log in, then manage profile data, habits, workouts and exercises, and view daily, weekly, or monthly leaderboards. The API bootstraps feature services and handlers, routes requests through shared HTTP infrastructure, and runs a leaderboard snapshot worker. The README documents the frontend-to-API workflow; unsampled feature internals are represented by their existing directories, so their detailed call paths are not inferred.

Main entry points: [`cmd/app/main.go`](https://github.com/kupr666/orange_team/blob/main/cmd/app/main.go) (Application bootstrap), [`frontend/src/App.tsx`](https://github.com/kupr666/orange_team/blob/main/frontend/src/App.tsx) (React application), [`frontend/src/api/client.ts`](https://github.com/kupr666/orange_team/blob/main/frontend/src/api/client.ts) (API client), [`internal/features/leaderboard/worker/snapshot_worker.go`](https://github.com/kupr666/orange_team/blob/main/internal/features/leaderboard/worker/snapshot_worker.go) (Snapshot worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API platform"]
  node_main["Application bootstrap<br/>[main.go]"]
  node_http["HTTP server and routing"]
  node_authinfra["JWT and auth middleware"]
end

subgraph group_features["Product features"]
  node_authfeature["Registration and login"]
  node_users["User profiles"]
  node_habits["Habit tracking"]
  node_exercises["Exercise catalog"]
  node_workouts["Workout management"]
  node_workoutitems["Workout exercises and scoring"]
  node_leaderboard["Leaderboard queries"]
  node_snapshots["Snapshot worker<br/>[snapshot_worker.go]"]
  node_webfeature["Web page delivery"]
end

subgraph group_web["Web client"]
  node_frontend["React application<br/>[App.tsx]"]
  node_client["API client<br/>[client.ts]"]
  node_habitsui["Habits page<br/>[HabitsPage.tsx]"]
  node_workoutsui["Workouts page<br/>[WorkoutsPage.tsx]"]
  node_profileui["Profile page<br/>[ProfilePage.tsx]"]
  node_demo["Demo data<br/>[demo.ts]"]
end

subgraph group_data["Persistence and domain"]
  node_pg["PostgreSQL pool<br/>[pool.go]"]
  node_domain["Shared domain models<br/>[workout.go]"]
end

node_user(("Browser user"))

node_user -->|"uses"| node_frontend
node_frontend -->|"calls"| node_client
node_frontend -->|"renders"| node_habitsui
node_frontend -->|"renders"| node_workoutsui
node_frontend -->|"renders"| node_profileui
node_habitsui -->|"calls"| node_client
node_workoutsui -->|"calls"| node_client
node_profileui -->|"calls"| node_client
node_client -->|"HTTP requests"| node_http
node_main -->|"creates pool"| node_pg
node_main -->|"wires feature"| node_authfeature
node_main -->|"wires feature"| node_users
node_main -->|"wires feature"| node_habits
node_main -->|"wires feature"| node_exercises
node_main -->|"wires feature"| node_workouts
node_main -->|"wires feature"| node_workoutitems
node_main -->|"wires feature"| node_leaderboard
node_main -->|"wires feature"| node_webfeature
node_main -->|"registers routes"| node_http
node_main -->|"starts worker"| node_snapshots
node_main -->|"configures auth"| node_authinfra
node_main -->|"uses models"| node_domain
node_snapshots -->|"runs snapshots"| node_leaderboard

click node_main "https://github.com/kupr666/orange_team/blob/main/cmd/app/main.go"
click node_http "https://github.com/kupr666/orange_team/tree/main/internal/core/transport/http/server"
click node_authinfra "https://github.com/kupr666/orange_team/tree/main/internal/core/auth/jwt"
click node_authfeature "https://github.com/kupr666/orange_team/tree/main/internal/features/authentication"
click node_users "https://github.com/kupr666/orange_team/tree/main/internal/features/users"
click node_habits "https://github.com/kupr666/orange_team/tree/main/internal/features/habits"
click node_exercises "https://github.com/kupr666/orange_team/tree/main/internal/features/exercises"
click node_workouts "https://github.com/kupr666/orange_team/tree/main/internal/features/workouts"
click node_workoutitems "https://github.com/kupr666/orange_team/tree/main/internal/features/workout_exercises"
click node_leaderboard "https://github.com/kupr666/orange_team/tree/main/internal/features/leaderboard"
click node_snapshots "https://github.com/kupr666/orange_team/blob/main/internal/features/leaderboard/worker/snapshot_worker.go"
click node_webfeature "https://github.com/kupr666/orange_team/tree/main/internal/features/web"
click node_pg "https://github.com/kupr666/orange_team/blob/main/internal/core/repository/postgres/pool/pgx/pool.go"
click node_domain "https://github.com/kupr666/orange_team/blob/main/internal/core/domain/workout.go"
click node_frontend "https://github.com/kupr666/orange_team/blob/main/frontend/src/App.tsx"
click node_client "https://github.com/kupr666/orange_team/blob/main/frontend/src/api/client.ts"
click node_habitsui "https://github.com/kupr666/orange_team/blob/main/frontend/src/features/habits/HabitsPage.tsx"
click node_workoutsui "https://github.com/kupr666/orange_team/blob/main/frontend/src/features/workouts/WorkoutsPage.tsx"
click node_profileui "https://github.com/kupr666/orange_team/blob/main/frontend/src/features/profile/ProfilePage.tsx"
click node_demo "https://github.com/kupr666/orange_team/blob/main/frontend/src/demo.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_main,node_http,node_authinfra,node_user toneBlue
class node_authfeature,node_users,node_habits,node_exercises,node_workouts,node_workoutitems,node_leaderboard,node_snapshots,node_webfeature toneAmber
class node_frontend,node_client,node_habitsui,node_workoutsui,node_profileui,node_demo toneMint
class node_pg,node_domain toneRose
```

## Components

### API platform

- [Application bootstrap](https://github.com/kupr666/orange_team/blob/main/cmd/app/main.go): `cmd/app/main.go`
- [HTTP server and routing](https://github.com/kupr666/orange_team/tree/main/internal/core/transport/http/server): `internal/core/transport/http/server`
- [JWT and auth middleware](https://github.com/kupr666/orange_team/tree/main/internal/core/auth/jwt): `internal/core/auth/jwt`

### Product features

- [Registration and login](https://github.com/kupr666/orange_team/tree/main/internal/features/authentication): `internal/features/authentication`
- [User profiles](https://github.com/kupr666/orange_team/tree/main/internal/features/users): `internal/features/users`
- [Habit tracking](https://github.com/kupr666/orange_team/tree/main/internal/features/habits): `internal/features/habits`
- [Exercise catalog](https://github.com/kupr666/orange_team/tree/main/internal/features/exercises): `internal/features/exercises`
- [Workout management](https://github.com/kupr666/orange_team/tree/main/internal/features/workouts): `internal/features/workouts`
- [Workout exercises and scoring](https://github.com/kupr666/orange_team/tree/main/internal/features/workout_exercises): `internal/features/workout_exercises`
- [Leaderboard queries](https://github.com/kupr666/orange_team/tree/main/internal/features/leaderboard): `internal/features/leaderboard`
- [Snapshot worker](https://github.com/kupr666/orange_team/blob/main/internal/features/leaderboard/worker/snapshot_worker.go): `internal/features/leaderboard/worker/snapshot_worker.go`
- [Web page delivery](https://github.com/kupr666/orange_team/tree/main/internal/features/web): `internal/features/web`

### Web client

- [React application](https://github.com/kupr666/orange_team/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API client](https://github.com/kupr666/orange_team/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`
- [Habits page](https://github.com/kupr666/orange_team/blob/main/frontend/src/features/habits/HabitsPage.tsx): `frontend/src/features/habits/HabitsPage.tsx`
- [Workouts page](https://github.com/kupr666/orange_team/blob/main/frontend/src/features/workouts/WorkoutsPage.tsx): `frontend/src/features/workouts/WorkoutsPage.tsx`
- [Profile page](https://github.com/kupr666/orange_team/blob/main/frontend/src/features/profile/ProfilePage.tsx): `frontend/src/features/profile/ProfilePage.tsx`
- [Demo data](https://github.com/kupr666/orange_team/blob/main/frontend/src/demo.ts): `frontend/src/demo.ts`

### Persistence and domain

- [PostgreSQL pool](https://github.com/kupr666/orange_team/blob/main/internal/core/repository/postgres/pool/pgx/pool.go): `internal/core/repository/postgres/pool/pgx/pool.go`
- [Shared domain models](https://github.com/kupr666/orange_team/blob/main/internal/core/domain/workout.go): `internal/core/domain/workout.go`

### Other components

- **Browser user**

## Connections

- Browser user → React application: uses
- React application → API client: calls (evidence: `frontend/src/App.tsx`)
- React application → Habits page: renders (evidence: `frontend/src/App.tsx`)
- React application → Workouts page: renders (evidence: `frontend/src/App.tsx`)
- React application → Profile page: renders (evidence: `frontend/src/App.tsx`)
- Habits page → API client: calls (evidence: `frontend/src/features/habits/HabitsPage.tsx`)
- Workouts page → API client: calls (evidence: `frontend/src/features/workouts/WorkoutsPage.tsx`)
- Profile page → API client: calls (evidence: `frontend/src/features/profile/ProfilePage.tsx`)
- API client → HTTP server and routing: HTTP requests
- Application bootstrap → PostgreSQL pool: creates pool (evidence: `cmd/app/main.go`)
- Application bootstrap → Registration and login: wires feature (evidence: `cmd/app/main.go`)
- Application bootstrap → User profiles: wires feature (evidence: `cmd/app/main.go`)
- Application bootstrap → Habit tracking: wires feature (evidence: `cmd/app/main.go`)
- Application bootstrap → Exercise catalog: wires feature (evidence: `cmd/app/main.go`)
- Application bootstrap → Workout management: wires feature (evidence: `cmd/app/main.go`)
- Application bootstrap → Workout exercises and scoring: wires feature (evidence: `cmd/app/main.go`)
- Application bootstrap → Leaderboard queries: wires feature (evidence: `cmd/app/main.go`)
- Application bootstrap → Web page delivery: wires feature (evidence: `cmd/app/main.go`)
- Application bootstrap → HTTP server and routing: registers routes (evidence: `cmd/app/main.go`)
- Application bootstrap → Snapshot worker: starts worker (evidence: `cmd/app/main.go`)
- Application bootstrap → JWT and auth middleware: configures auth (evidence: `cmd/app/main.go`)
- Application bootstrap → Shared domain models: uses models (evidence: `cmd/app/main.go`)
- Snapshot worker → Leaderboard queries: runs snapshots
