# coach-montanha/montanha-personal-studio architecture

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

- Interactive diagram: https://gitdiagram.com/coach-montanha/montanha-personal-studio
- Repository: https://github.com/coach-montanha/montanha-personal-studio

## Overview

Personal Studio is a web-based studio-management and personal-training product, with authenticated staff workflows and a student portal. Users sign in, enter an authenticated area, and work across finance, student management, scheduling, CRM, or training; students use portal routes for their profile and workouts. The app also exposes administration and MCP tool routes. Evidence is limited to the supplied source index and excerpts: route coverage and feature areas are visible, but most domain implementation and its data calls were not sampled, so those links are omitted.

Main entry points: [`src/routeTree.gen.ts`](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routeTree.gen.ts) (Route registry), [`src/integrations/supabase/client.ts`](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/integrations/supabase/client.ts) (Browser data client), [`src/routes/_authenticated/route.tsx`](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routes/_authenticated/route.tsx) (Authenticated layout), [`src/routes/auth.tsx`](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routes/auth.tsx) (Sign-in and registration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and access"]
  node_router["Application router<br/>[router.tsx]"]
  node_route_tree["Route registry<br/>[routeTree.gen.ts]"]
  node_login["Sign-in and registration<br/>[auth.tsx]"]
  node_access_check["Access validation"]
  node_auth_hook["Session state<br/>[use-auth.ts]"]
  node_auth_route["Authenticated layout<br/>[route.tsx]"]
end

subgraph group_studio["Studio operations"]
  node_app_shell["Staff application shell<br/>[AppShell.tsx]"]
  node_finance["Finance and payments<br/>[financeiro.tsx]"]
  node_students["Student management<br/>[students.index.tsx]"]
  node_schedule["Agenda and scheduling<br/>[agenda.tsx]"]
  node_crm["CRM and announcements<br/>[crm.tsx]"]
end

subgraph group_training["Personal training"]
  node_pt_home["Trainer workspace<br/>[index.tsx]"]
  node_pt_library["Exercise library<br/>[biblioteca.tsx]"]
  node_pt_checkin["Training check-ins<br/>[checkin.tsx]"]
  node_training_timer["Training timer"]
end

subgraph group_portal["Student portal"]
  node_portal_shell["Student portal shell<br/>[PortalShell.tsx]"]
  node_portal_home["Student portal<br/>[index.tsx]"]
  node_portal_workout["Student workouts<br/>[treino.tsx]"]
end

subgraph group_platform["Platform services"]
  node_supabase_client["Browser data client<br/>[client.ts]"]
  node_supabase_server["Privileged server client<br/>[client.server.ts]"]
  node_storage_functions["Storage operations"]
  node_storage_page["Storage management<br/>[storage.tsx]"]
  node_mcp["MCP financial tools<br/>[index.ts]"]
end

node_user(("Studio user"))
node_supabase[("Supabase service")]

node_user -.->|"opens app"| node_router
node_router -->|"uses routes"| node_route_tree
node_route_tree -->|"registers"| node_login
node_route_tree -->|"registers"| node_auth_route
node_route_tree -->|"registers"| node_finance
node_route_tree -->|"registers"| node_students
node_route_tree -->|"registers"| node_schedule
node_route_tree -->|"registers"| node_crm
node_route_tree -->|"registers"| node_pt_home
node_route_tree -->|"registers"| node_pt_library
node_route_tree -->|"registers"| node_pt_checkin
node_route_tree -->|"registers"| node_portal_home
node_route_tree -->|"registers"| node_portal_workout
node_login -->|"checks access"| node_access_check
node_login -->|"authenticates"| node_supabase_client
node_auth_hook -->|"reads session"| node_supabase_client
node_auth_route -->|"checks session"| node_supabase_client
node_auth_route -->|"renders staff shell"| node_app_shell
node_auth_route -->|"renders portal shell"| node_portal_shell
node_app_shell -->|"uses data client"| node_supabase_client
node_portal_shell -->|"uses data client"| node_supabase_client
node_app_shell -->|"opens timer"| node_training_timer
node_portal_shell -->|"opens timer"| node_training_timer
node_storage_page -->|"manages files"| node_storage_functions
node_storage_functions -->|"uses admin storage"| node_supabase_server
node_supabase_client -->|"connects to"| node_supabase
node_supabase_server -->|"connects to"| node_supabase
node_mcp -.->|"reports financial data"| node_finance

click node_router "https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/router.tsx"
click node_route_tree "https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routeTree.gen.ts"
click node_login "https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routes/auth.tsx"
click node_access_check "https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/services/ecosystem-auth-service.ts"
click node_auth_hook "https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/hooks/use-auth.ts"
click node_auth_route "https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routes/_authenticated/route.tsx"
click node_app_shell "https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/components/edufinance/AppShell.tsx"
click node_finance "https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routes/_authenticated/financeiro.tsx"
click node_students "https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routes/_authenticated/students.index.tsx"
click node_schedule "https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routes/_authenticated/agenda.tsx"
click node_crm "https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routes/_authenticated/crm.tsx"
click node_pt_home "https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routes/_authenticated/personal-trainer/index.tsx"
click node_pt_library "https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routes/_authenticated/personal-trainer/biblioteca.tsx"
click node_pt_checkin "https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routes/_authenticated/personal-trainer/checkin.tsx"
click node_training_timer "https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/components/pt/TrainingTimerDialog.tsx"
click node_portal_shell "https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/components/portal/PortalShell.tsx"
click node_portal_home "https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routes/_authenticated/portal/index.tsx"
click node_portal_workout "https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routes/_authenticated/portal/pt/treino.tsx"
click node_supabase_client "https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/integrations/supabase/client.ts"
click node_supabase_server "https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/integrations/supabase/client.server.ts"
click node_storage_functions "https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/lib/storage-browser.functions.ts"
click node_storage_page "https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routes/_authenticated/storage.tsx"
click node_mcp "https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/lib/mcp/index.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_router,node_route_tree,node_login,node_access_check,node_auth_hook,node_auth_route,node_user toneBlue
class node_app_shell,node_finance,node_students,node_schedule,node_crm,node_supabase toneAmber
class node_pt_home,node_pt_library,node_pt_checkin,node_training_timer toneMint
class node_portal_shell,node_portal_home,node_portal_workout toneRose
class node_supabase_client,node_supabase_server,node_storage_functions,node_storage_page,node_mcp toneIndigo
```

## Components

### Entry and access

- [Application router](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/router.tsx): `src/router.tsx`
- [Route registry](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routeTree.gen.ts): `src/routeTree.gen.ts`
- [Sign-in and registration](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routes/auth.tsx): `src/routes/auth.tsx`
- [Access validation](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/services/ecosystem-auth-service.ts): `src/services/ecosystem-auth-service.ts`
- [Session state](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/hooks/use-auth.ts): `src/hooks/use-auth.ts`
- [Authenticated layout](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routes/_authenticated/route.tsx): `src/routes/_authenticated/route.tsx`

### Studio operations

- [Staff application shell](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/components/edufinance/AppShell.tsx): `src/components/edufinance/AppShell.tsx`
- [Finance and payments](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routes/_authenticated/financeiro.tsx): `src/routes/_authenticated/financeiro.tsx`
- [Student management](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routes/_authenticated/students.index.tsx): `src/routes/_authenticated/students.index.tsx`
- [Agenda and scheduling](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routes/_authenticated/agenda.tsx): `src/routes/_authenticated/agenda.tsx`
- [CRM and announcements](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routes/_authenticated/crm.tsx): `src/routes/_authenticated/crm.tsx`

### Personal training

- [Trainer workspace](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routes/_authenticated/personal-trainer/index.tsx): `src/routes/_authenticated/personal-trainer/index.tsx`
- [Exercise library](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routes/_authenticated/personal-trainer/biblioteca.tsx): `src/routes/_authenticated/personal-trainer/biblioteca.tsx`
- [Training check-ins](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routes/_authenticated/personal-trainer/checkin.tsx): `src/routes/_authenticated/personal-trainer/checkin.tsx`
- [Training timer](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/components/pt/TrainingTimerDialog.tsx): `src/components/pt/TrainingTimerDialog.tsx`

### Student portal

- [Student portal shell](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/components/portal/PortalShell.tsx): `src/components/portal/PortalShell.tsx`
- [Student portal](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routes/_authenticated/portal/index.tsx): `src/routes/_authenticated/portal/index.tsx`
- [Student workouts](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routes/_authenticated/portal/pt/treino.tsx): `src/routes/_authenticated/portal/pt/treino.tsx`

### Platform services

- [Browser data client](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`
- [Privileged server client](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/integrations/supabase/client.server.ts): `src/integrations/supabase/client.server.ts`
- [Storage operations](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/lib/storage-browser.functions.ts): `src/lib/storage-browser.functions.ts`
- [Storage management](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/routes/_authenticated/storage.tsx): `src/routes/_authenticated/storage.tsx`
- [MCP financial tools](https://github.com/coach-montanha/montanha-personal-studio/blob/main/src/lib/mcp/index.ts): `src/lib/mcp/index.ts`

### Other components

- **Studio user**
- **Supabase service**

## Connections

- Studio user → Application router: opens app
- Application router → Route registry: uses routes (evidence: `src/router.tsx`)
- Route registry → Sign-in and registration: registers (evidence: `src/routeTree.gen.ts`)
- Route registry → Authenticated layout: registers (evidence: `src/routeTree.gen.ts`)
- Route registry → Finance and payments: registers (evidence: `src/routeTree.gen.ts`)
- Route registry → Student management: registers (evidence: `src/routeTree.gen.ts`)
- Route registry → Agenda and scheduling: registers (evidence: `src/routeTree.gen.ts`)
- Route registry → CRM and announcements: registers (evidence: `src/routeTree.gen.ts`)
- Route registry → Trainer workspace: registers (evidence: `src/routeTree.gen.ts`)
- Route registry → Exercise library: registers (evidence: `src/routeTree.gen.ts`)
- Route registry → Training check-ins: registers (evidence: `src/routeTree.gen.ts`)
- Route registry → Student portal: registers (evidence: `src/routeTree.gen.ts`)
- Route registry → Student workouts: registers (evidence: `src/routeTree.gen.ts`)
- Sign-in and registration → Access validation: checks access (evidence: `src/routes/auth.tsx`)
- Sign-in and registration → Browser data client: authenticates (evidence: `src/routes/auth.tsx`)
- Session state → Browser data client: reads session (evidence: `src/hooks/use-auth.ts`)
- Authenticated layout → Browser data client: checks session (evidence: `src/routes/_authenticated/route.tsx`)
- Authenticated layout → Staff application shell: renders staff shell (evidence: `src/routes/_authenticated/route.tsx`)
- Authenticated layout → Student portal shell: renders portal shell (evidence: `src/routes/_authenticated/route.tsx`)
- Staff application shell → Browser data client: uses data client (evidence: `src/components/edufinance/AppShell.tsx`)
- Student portal shell → Browser data client: uses data client (evidence: `src/components/portal/PortalShell.tsx`)
- Staff application shell → Training timer: opens timer (evidence: `src/components/edufinance/AppShell.tsx`)
- Student portal shell → Training timer: opens timer (evidence: `src/components/portal/PortalShell.tsx`)
- Storage management → Storage operations: manages files (evidence: `src/routes/_authenticated/storage.tsx`)
- Storage operations → Privileged server client: uses admin storage (evidence: `src/lib/storage-browser.functions.ts`)
- Browser data client → Supabase service: connects to (evidence: `src/integrations/supabase/client.ts`)
- Privileged server client → Supabase service: connects to (evidence: `src/integrations/supabase/client.server.ts`)
- MCP financial tools → Finance and payments: reports financial data
