# zanelittle/swoleexperiencereact architecture

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

- Interactive diagram: https://gitdiagram.com/zanelittle/swoleexperiencereact
- Repository: https://github.com/zanelittle/swoleexperiencereact

## Overview

Magni is an Expo weight tracker and workout planner; Modi is its developing Go authentication API. The principal shown workflow is login/register from the home screen, through auth state and local token storage, to Modi’s auth endpoints. Weight and workout capabilities are represented from the README and source tree, but several screen-to-service links are not shown in the excerpts, so those relationships are omitted. Macro tracking and future nutrition scanning are documented plans, not established runtime features.

Main entry points: [`modi/cmd/api/main.go`](https://github.com/zanelittle/swoleexperiencereact/blob/main/modi/cmd/api/main.go) (HTTP API), [`magni/app/index.tsx`](https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/app/index.tsx) (Home screen), [`magni/contexts/AuthContext.tsx`](https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/contexts/AuthContext.tsx) (Auth state), [`modi/internal/handlers/auth.go`](https://github.com/zanelittle/swoleexperiencereact/blob/main/modi/internal/handlers/auth.go) (Auth handlers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_magni_app["Magni application"]
  node_home["Home screen<br/>[index.tsx]"]
  node_settings["Settings<br/>[settings.tsx]"]
end

subgraph group_magni_auth["Authentication"]
  node_auth_context["Auth state<br/>[AuthContext.tsx]"]
  node_login["Login modal<br/>[LoginModal.tsx]"]
  node_register["Register modal<br/>[RegisterModal.tsx]"]
  node_auth_service["Auth client<br/>[AuthService.ts]"]
  node_token_storage[("Token storage<br/>[tokenStorage.ts]")]
end

subgraph group_magni_weight["Weight tracking"]
  node_weight_screen["Weight screen<br/>[weight.tsx]"]
  node_weight_entry["Weight entry"]
  node_weight_history["Weight history<br/>[WeightHistory.tsx]"]
  node_weight_chart["Weight chart<br/>[WeightChart.tsx]"]
  node_weight_service["Weight service<br/>[WeightService.ts]"]
  node_averages["Average service<br/>[AverageService.ts]"]
  node_daily_stats["Daily statistics<br/>[useDailyStats.ts]"]
end

subgraph group_magni_workouts["Workout planning"]
  node_workout_screen["Workout screen<br/>[WorkoutsScreen.tsx]"]
  node_workout_form["Workout editor"]
  node_workout_data["Workout data hook<br/>[useWorkoutData.ts]"]
  node_completion["Completion hook"]
  node_workout_service[("Workout service<br/>[WorkoutService.ts]")]
  node_history_service[("History service")]
  node_workout_bank["Workout library"]
  node_import_service["Workout import"]
  node_export_service["Workout export"]
end

subgraph group_modi_api["Modi API"]
  node_api_server["HTTP API<br/>[main.go]"]
  node_auth_handler["Auth handlers<br/>[auth.go]"]
  node_auth_service_go["Auth service<br/>[auth.go]"]
  node_user_repository["User repository<br/>[user.go]"]
  node_food_models["Food data models<br/>[food.go]"]
end

node_user(("User"))

node_user -->|"opens"| node_home
node_home -->|"reads auth state"| node_auth_context
node_home -->|"opens"| node_login
node_home -->|"opens"| node_register
node_auth_context -->|"requests auth"| node_auth_service
node_auth_context -->|"stores tokens"| node_token_storage
node_auth_service -->|"HTTP requests"| node_api_server
node_api_server -->|"routes auth"| node_auth_handler
node_api_server -->|"constructs repository"| node_user_repository
node_api_server -->|"constructs service"| node_auth_service_go
node_api_server -->|"protects account route"| node_auth_handler
node_auth_handler -->|"delegates auth"| node_auth_service_go
node_auth_service_go -->|"uses repository"| node_user_repository
node_user -.->|"tracks weight"| node_weight_screen
node_user -.->|"plans workouts"| node_workout_screen
node_workout_data -->|"loads workouts"| node_workout_service
node_workout_data -->|"loads history"| node_history_service
node_completion -->|"updates workouts"| node_workout_service
node_completion -->|"records completion"| node_history_service
node_workout_form -->|"saves workout"| node_workout_service
node_daily_stats -.-> node_averages
node_weight_service -.-> node_averages

click node_home "https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/app/index.tsx"
click node_settings "https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/app/settings.tsx"
click node_auth_context "https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/contexts/AuthContext.tsx"
click node_login "https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/components/auth/LoginModal.tsx"
click node_register "https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/components/auth/RegisterModal.tsx"
click node_auth_service "https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/lib/services/AuthService.ts"
click node_token_storage "https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/lib/utils/tokenStorage.ts"
click node_api_server "https://github.com/zanelittle/swoleexperiencereact/blob/main/modi/cmd/api/main.go"
click node_auth_handler "https://github.com/zanelittle/swoleexperiencereact/blob/main/modi/internal/handlers/auth.go"
click node_auth_service_go "https://github.com/zanelittle/swoleexperiencereact/blob/main/modi/internal/services/auth.go"
click node_user_repository "https://github.com/zanelittle/swoleexperiencereact/blob/main/modi/internal/repositories/user.go"
click node_weight_screen "https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/app/weight.tsx"
click node_weight_entry "https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/components/weight/WeightEntryForm.tsx"
click node_weight_history "https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/components/weight/WeightHistory.tsx"
click node_weight_chart "https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/components/weight/WeightChart.tsx"
click node_weight_service "https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/lib/services/WeightService.ts"
click node_averages "https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/lib/services/AverageService.ts"
click node_daily_stats "https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/hooks/useDailyStats.ts"
click node_workout_screen "https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/components/workouts/WorkoutsScreen.tsx"
click node_workout_form "https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/components/workouts/WorkoutCreateUpdateForm.tsx"
click node_workout_data "https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/hooks/useWorkoutData.ts"
click node_completion "https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/hooks/useWorkoutCompletion.ts"
click node_workout_service "https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/lib/services/WorkoutService.ts"
click node_history_service "https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/lib/services/WorkoutHistoryService.ts"
click node_workout_bank "https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/lib/services/WorkoutBankService.ts"
click node_import_service "https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/lib/services/WorkoutImportService.ts"
click node_export_service "https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/lib/services/WorkoutExportService.ts"
click node_food_models "https://github.com/zanelittle/swoleexperiencereact/blob/main/modi/internal/models/food.go"

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_home,node_settings,node_user toneBlue
class node_auth_context,node_login,node_register,node_auth_service,node_token_storage toneAmber
class node_weight_screen,node_weight_entry,node_weight_history,node_weight_chart,node_weight_service,node_averages,node_daily_stats toneMint
class node_workout_screen,node_workout_form,node_workout_data,node_completion,node_workout_service,node_history_service,node_workout_bank,node_import_service,node_export_service toneRose
class node_api_server,node_auth_handler,node_auth_service_go,node_user_repository,node_food_models toneIndigo
```

## Components

### Magni application

- [Home screen](https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/app/index.tsx): `magni/app/index.tsx`
- [Settings](https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/app/settings.tsx): `magni/app/settings.tsx`

### Authentication

- [Auth state](https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/contexts/AuthContext.tsx): `magni/contexts/AuthContext.tsx`
- [Login modal](https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/components/auth/LoginModal.tsx): `magni/components/auth/LoginModal.tsx`
- [Register modal](https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/components/auth/RegisterModal.tsx): `magni/components/auth/RegisterModal.tsx`
- [Auth client](https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/lib/services/AuthService.ts): `magni/lib/services/AuthService.ts`
- [Token storage](https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/lib/utils/tokenStorage.ts): `magni/lib/utils/tokenStorage.ts`

### Weight tracking

- [Weight screen](https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/app/weight.tsx): `magni/app/weight.tsx`
- [Weight entry](https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/components/weight/WeightEntryForm.tsx): `magni/components/weight/WeightEntryForm.tsx`
- [Weight history](https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/components/weight/WeightHistory.tsx): `magni/components/weight/WeightHistory.tsx`
- [Weight chart](https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/components/weight/WeightChart.tsx): `magni/components/weight/WeightChart.tsx`
- [Weight service](https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/lib/services/WeightService.ts): `magni/lib/services/WeightService.ts`
- [Average service](https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/lib/services/AverageService.ts): `magni/lib/services/AverageService.ts`
- [Daily statistics](https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/hooks/useDailyStats.ts): `magni/hooks/useDailyStats.ts`

### Workout planning

- [Workout screen](https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/components/workouts/WorkoutsScreen.tsx): `magni/components/workouts/WorkoutsScreen.tsx`
- [Workout editor](https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/components/workouts/WorkoutCreateUpdateForm.tsx): `magni/components/workouts/WorkoutCreateUpdateForm.tsx`
- [Workout data hook](https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/hooks/useWorkoutData.ts): `magni/hooks/useWorkoutData.ts`
- [Completion hook](https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/hooks/useWorkoutCompletion.ts): `magni/hooks/useWorkoutCompletion.ts`
- [Workout service](https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/lib/services/WorkoutService.ts): `magni/lib/services/WorkoutService.ts`
- [History service](https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/lib/services/WorkoutHistoryService.ts): `magni/lib/services/WorkoutHistoryService.ts`
- [Workout library](https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/lib/services/WorkoutBankService.ts): `magni/lib/services/WorkoutBankService.ts`
- [Workout import](https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/lib/services/WorkoutImportService.ts): `magni/lib/services/WorkoutImportService.ts`
- [Workout export](https://github.com/zanelittle/swoleexperiencereact/blob/main/magni/lib/services/WorkoutExportService.ts): `magni/lib/services/WorkoutExportService.ts`

### Modi API

- [HTTP API](https://github.com/zanelittle/swoleexperiencereact/blob/main/modi/cmd/api/main.go): `modi/cmd/api/main.go`
- [Auth handlers](https://github.com/zanelittle/swoleexperiencereact/blob/main/modi/internal/handlers/auth.go): `modi/internal/handlers/auth.go`
- [Auth service](https://github.com/zanelittle/swoleexperiencereact/blob/main/modi/internal/services/auth.go): `modi/internal/services/auth.go`
- [User repository](https://github.com/zanelittle/swoleexperiencereact/blob/main/modi/internal/repositories/user.go): `modi/internal/repositories/user.go`
- [Food data models](https://github.com/zanelittle/swoleexperiencereact/blob/main/modi/internal/models/food.go): `modi/internal/models/food.go`

### Other components

- **User**

## Connections

- User → Home screen: opens (evidence: `magni/app/index.tsx`)
- Home screen → Auth state: reads auth state (evidence: `magni/app/index.tsx`)
- Home screen → Login modal: opens (evidence: `magni/app/index.tsx`)
- Home screen → Register modal: opens (evidence: `magni/app/index.tsx`)
- Auth state → Auth client: requests auth (evidence: `magni/contexts/AuthContext.tsx`)
- Auth state → Token storage: stores tokens (evidence: `magni/contexts/AuthContext.tsx`)
- Auth client → HTTP API: HTTP requests (evidence: `magni/lib/services/AuthService.ts`)
- HTTP API → Auth handlers: routes auth (evidence: `modi/cmd/api/main.go`)
- HTTP API → User repository: constructs repository (evidence: `modi/cmd/api/main.go`)
- HTTP API → Auth service: constructs service (evidence: `modi/cmd/api/main.go`)
- HTTP API → Auth handlers: protects account route (evidence: `modi/cmd/api/main.go`)
- Auth handlers → Auth service: delegates auth (evidence: `modi/internal/handlers/auth.go`)
- Auth service → User repository: uses repository (evidence: `modi/internal/services/auth.go`)
- User → Weight screen: tracks weight (evidence: `README.md`)
- User → Workout screen: plans workouts (evidence: `README.md`)
- Workout data hook → Workout service: loads workouts (evidence: `magni/hooks/useWorkoutData.ts`)
- Workout data hook → History service: loads history (evidence: `magni/hooks/useWorkoutData.ts`)
- Completion hook → Workout service: updates workouts (evidence: `magni/hooks/useWorkoutCompletion.ts`)
- Completion hook → History service: records completion (evidence: `magni/hooks/useWorkoutCompletion.ts`)
- Workout editor → Workout service: saves workout (evidence: `magni/components/workouts/WorkoutCreateUpdateForm.tsx`)
- Daily statistics → Average service
- Weight service → Average service
