# aabaniel/ccm-app-teamnieric architecture

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

- Interactive diagram: https://gitdiagram.com/aabaniel/ccm-app-teamnieric
- Repository: https://github.com/aabaniel/ccm-app-teamnieric

## Overview

1440 is a local-first daily time-budget planner: users set personal targets, plan tomorrow in activity blocks, then execute today and review how actual time compared with the plan. The UI also exposes history, progress, XP/streaks, and optional alerts. Planning uses deterministic schedule and scoring logic; optional server routes provide AI classification and optimization, with deterministic fallbacks. The README documents these capabilities; unsampled route and screen internals are represented only where the README or source index supports them.

Main entry points: [`lib/storage/store.ts`](https://github.com/aabaniel/ccm-app-teamnieric/blob/main/lib/storage/store.ts) (App state store), [`components/time-budget-app.tsx`](https://github.com/aabaniel/ccm-app-teamnieric/blob/main/components/time-budget-app.tsx) (App shell), [`components/tomorrow-screen.tsx`](https://github.com/aabaniel/ccm-app-teamnieric/blob/main/components/tomorrow-screen.tsx) (Tomorrow planner), [`components/today-screen.tsx`](https://github.com/aabaniel/ccm-app-teamnieric/blob/main/components/today-screen.tsx) (Today execution)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_product_ui["Product UI"]
  node_app["App shell"]
  node_onboarding["Onboarding"]
  node_tomorrow["Tomorrow planner"]
  node_activity_form["Activity form"]
  node_timeline["Day timeline<br/>[day-timeline.tsx]"]
  node_today["Today execution<br/>[today-screen.tsx]"]
  node_history["History<br/>[history-screen.tsx]"]
  node_progress["Progress"]
  node_score_ring["Score display<br/>[score-ring.tsx]"]
end

subgraph group_state["State and persistence"]
  node_store["App state store<br/>[store.ts]"]
  node_local_storage[("Browser storage")]
end

subgraph group_domain["Planning domain"]
  node_plans["Plan lifecycle<br/>[plans.ts]"]
  node_schedule["Schedule validation<br/>[schedule.ts]"]
  node_scoring["Balance scoring<br/>[scoring.ts]"]
  node_categories["Time categories<br/>[categories.ts]"]
  node_recommendations["Focus recommendations<br/>[recommendations.ts]"]
  node_xp["XP and streaks<br/>[xp.ts]"]
  node_optimizer["Plan optimizer<br/>[optimizer.ts]"]
  node_classifier["Activity classifier<br/>[classifier.ts]"]
end

subgraph group_ai["AI services"]
  node_classify_route["Classify API<br/>[route.ts]"]
  node_optimize_route["Optimize API<br/>[route.ts]"]
  node_openai["Structured AI client<br/>[openai.ts]"]
end

node_user(("User"))
node_openai_service{{"OpenAI service"}}

node_user -->|"uses"| node_app
node_app -->|"loads state"| node_store
node_app -->|"shows setup"| node_onboarding
node_app -->|"opens planner"| node_tomorrow
node_app -->|"opens execution"| node_today
node_app -->|"opens history"| node_history
node_app -->|"opens progress"| node_progress
node_onboarding -->|"completes setup"| node_store
node_tomorrow -->|"edits plan"| node_store
node_tomorrow -->|"renders form"| node_activity_form
node_tomorrow -->|"renders schedule"| node_timeline
node_tomorrow -->|"shows score"| node_score_ring
node_today -->|"updates activity"| node_store
node_today -->|"shows score"| node_score_ring
node_today -->|"gets focus"| node_recommendations
node_today -->|"calculates actuals"| node_scoring
node_today -->|"reads level"| node_xp
node_history -->|"reads plans"| node_store
node_history -->|"renders schedule"| node_timeline
node_history -->|"shows balance"| node_scoring
node_progress -->|"reads progress"| node_store
node_progress -->|"shows levels"| node_xp
node_store -->|"persists state"| node_local_storage
node_store -->|"creates plans"| node_plans
node_store -->|"shifts activities"| node_schedule
node_store -->|"awards XP"| node_xp
node_plans -->|"recalculates score"| node_scoring
node_plans -->|"updates progress"| node_xp
node_scoring -->|"scores categories"| node_categories
node_optimizer -->|"validates intervals"| node_schedule
node_classify_route -->|"uses fallback"| node_classifier
node_classify_route -->|"requests AI"| node_openai
node_optimize_route -->|"uses fallback"| node_optimizer
node_optimize_route -->|"requests AI"| node_openai
node_openai -->|"sends request"| node_openai_service
node_tomorrow -.->|"requests optimization"| node_optimize_route
node_user -.->|"requests classification"| node_classify_route

click node_app "https://github.com/aabaniel/ccm-app-teamnieric/blob/main/components/time-budget-app.tsx"
click node_onboarding "https://github.com/aabaniel/ccm-app-teamnieric/blob/main/components/onboarding-screen.tsx"
click node_tomorrow "https://github.com/aabaniel/ccm-app-teamnieric/blob/main/components/tomorrow-screen.tsx"
click node_activity_form "https://github.com/aabaniel/ccm-app-teamnieric/blob/main/components/add-activity-form.tsx"
click node_timeline "https://github.com/aabaniel/ccm-app-teamnieric/blob/main/components/day-timeline.tsx"
click node_today "https://github.com/aabaniel/ccm-app-teamnieric/blob/main/components/today-screen.tsx"
click node_history "https://github.com/aabaniel/ccm-app-teamnieric/blob/main/components/history-screen.tsx"
click node_progress "https://github.com/aabaniel/ccm-app-teamnieric/blob/main/components/progress-screen.tsx"
click node_score_ring "https://github.com/aabaniel/ccm-app-teamnieric/blob/main/components/score-ring.tsx"
click node_store "https://github.com/aabaniel/ccm-app-teamnieric/blob/main/lib/storage/store.ts"
click node_plans "https://github.com/aabaniel/ccm-app-teamnieric/blob/main/lib/domain/plans.ts"
click node_schedule "https://github.com/aabaniel/ccm-app-teamnieric/blob/main/lib/domain/schedule.ts"
click node_scoring "https://github.com/aabaniel/ccm-app-teamnieric/blob/main/lib/domain/scoring.ts"
click node_categories "https://github.com/aabaniel/ccm-app-teamnieric/blob/main/lib/domain/categories.ts"
click node_recommendations "https://github.com/aabaniel/ccm-app-teamnieric/blob/main/lib/domain/recommendations.ts"
click node_xp "https://github.com/aabaniel/ccm-app-teamnieric/blob/main/lib/domain/xp.ts"
click node_optimizer "https://github.com/aabaniel/ccm-app-teamnieric/blob/main/lib/domain/optimizer.ts"
click node_classifier "https://github.com/aabaniel/ccm-app-teamnieric/blob/main/lib/domain/classifier.ts"
click node_classify_route "https://github.com/aabaniel/ccm-app-teamnieric/blob/main/app/api/classify/route.ts"
click node_optimize_route "https://github.com/aabaniel/ccm-app-teamnieric/blob/main/app/api/optimize/route.ts"
click node_openai "https://github.com/aabaniel/ccm-app-teamnieric/blob/main/lib/ai/openai.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_app,node_onboarding,node_tomorrow,node_activity_form,node_timeline,node_today,node_history,node_progress,node_score_ring,node_user toneBlue
class node_store,node_local_storage toneAmber
class node_plans,node_schedule,node_scoring,node_categories,node_recommendations,node_xp,node_optimizer,node_classifier toneMint
class node_classify_route,node_optimize_route,node_openai toneRose
class node_openai_service toneIndigo
```

## Components

### Product UI

- [App shell](https://github.com/aabaniel/ccm-app-teamnieric/blob/main/components/time-budget-app.tsx): `components/time-budget-app.tsx`
- [Onboarding](https://github.com/aabaniel/ccm-app-teamnieric/blob/main/components/onboarding-screen.tsx): `components/onboarding-screen.tsx`
- [Tomorrow planner](https://github.com/aabaniel/ccm-app-teamnieric/blob/main/components/tomorrow-screen.tsx): `components/tomorrow-screen.tsx`
- [Activity form](https://github.com/aabaniel/ccm-app-teamnieric/blob/main/components/add-activity-form.tsx): `components/add-activity-form.tsx`
- [Day timeline](https://github.com/aabaniel/ccm-app-teamnieric/blob/main/components/day-timeline.tsx): `components/day-timeline.tsx`
- [Today execution](https://github.com/aabaniel/ccm-app-teamnieric/blob/main/components/today-screen.tsx): `components/today-screen.tsx`
- [History](https://github.com/aabaniel/ccm-app-teamnieric/blob/main/components/history-screen.tsx): `components/history-screen.tsx`
- [Progress](https://github.com/aabaniel/ccm-app-teamnieric/blob/main/components/progress-screen.tsx): `components/progress-screen.tsx`
- [Score display](https://github.com/aabaniel/ccm-app-teamnieric/blob/main/components/score-ring.tsx): `components/score-ring.tsx`

### State and persistence

- [App state store](https://github.com/aabaniel/ccm-app-teamnieric/blob/main/lib/storage/store.ts): `lib/storage/store.ts`
- **Browser storage**

### Planning domain

- [Plan lifecycle](https://github.com/aabaniel/ccm-app-teamnieric/blob/main/lib/domain/plans.ts): `lib/domain/plans.ts`
- [Schedule validation](https://github.com/aabaniel/ccm-app-teamnieric/blob/main/lib/domain/schedule.ts): `lib/domain/schedule.ts`
- [Balance scoring](https://github.com/aabaniel/ccm-app-teamnieric/blob/main/lib/domain/scoring.ts): `lib/domain/scoring.ts`
- [Time categories](https://github.com/aabaniel/ccm-app-teamnieric/blob/main/lib/domain/categories.ts): `lib/domain/categories.ts`
- [Focus recommendations](https://github.com/aabaniel/ccm-app-teamnieric/blob/main/lib/domain/recommendations.ts): `lib/domain/recommendations.ts`
- [XP and streaks](https://github.com/aabaniel/ccm-app-teamnieric/blob/main/lib/domain/xp.ts): `lib/domain/xp.ts`
- [Plan optimizer](https://github.com/aabaniel/ccm-app-teamnieric/blob/main/lib/domain/optimizer.ts): `lib/domain/optimizer.ts`
- [Activity classifier](https://github.com/aabaniel/ccm-app-teamnieric/blob/main/lib/domain/classifier.ts): `lib/domain/classifier.ts`

### AI services

- [Classify API](https://github.com/aabaniel/ccm-app-teamnieric/blob/main/app/api/classify/route.ts): `app/api/classify/route.ts`
- [Optimize API](https://github.com/aabaniel/ccm-app-teamnieric/blob/main/app/api/optimize/route.ts): `app/api/optimize/route.ts`
- [Structured AI client](https://github.com/aabaniel/ccm-app-teamnieric/blob/main/lib/ai/openai.ts): `lib/ai/openai.ts`

### Other components

- **User**
- **OpenAI service**

## Connections

- User → App shell: uses (evidence: `README.md`)
- App shell → App state store: loads state (evidence: `components/time-budget-app.tsx`)
- App shell → Onboarding: shows setup (evidence: `components/time-budget-app.tsx`)
- App shell → Tomorrow planner: opens planner (evidence: `components/time-budget-app.tsx`)
- App shell → Today execution: opens execution (evidence: `components/time-budget-app.tsx`)
- App shell → History: opens history (evidence: `components/time-budget-app.tsx`)
- App shell → Progress: opens progress (evidence: `components/time-budget-app.tsx`)
- Onboarding → App state store: completes setup (evidence: `components/time-budget-app.tsx`)
- Tomorrow planner → App state store: edits plan (evidence: `components/tomorrow-screen.tsx`)
- Tomorrow planner → Activity form: renders form (evidence: `components/tomorrow-screen.tsx`)
- Tomorrow planner → Day timeline: renders schedule (evidence: `components/tomorrow-screen.tsx`)
- Tomorrow planner → Score display: shows score (evidence: `components/tomorrow-screen.tsx`)
- Today execution → App state store: updates activity (evidence: `components/today-screen.tsx`)
- Today execution → Score display: shows score (evidence: `components/today-screen.tsx`)
- Today execution → Focus recommendations: gets focus (evidence: `components/today-screen.tsx`)
- Today execution → Balance scoring: calculates actuals (evidence: `components/today-screen.tsx`)
- Today execution → XP and streaks: reads level (evidence: `components/today-screen.tsx`)
- History → App state store: reads plans (evidence: `components/history-screen.tsx`)
- History → Day timeline: renders schedule (evidence: `components/history-screen.tsx`)
- History → Balance scoring: shows balance (evidence: `components/history-screen.tsx`)
- Progress → App state store: reads progress (evidence: `components/progress-screen.tsx`)
- Progress → XP and streaks: shows levels (evidence: `components/progress-screen.tsx`)
- App state store → Browser storage: persists state (evidence: `lib/storage/store.ts`)
- App state store → Plan lifecycle: creates plans (evidence: `lib/storage/store.ts`)
- App state store → Schedule validation: shifts activities (evidence: `lib/storage/store.ts`)
- App state store → XP and streaks: awards XP (evidence: `lib/storage/store.ts`)
- Plan lifecycle → Balance scoring: recalculates score (evidence: `lib/domain/plans.ts`)
- Plan lifecycle → XP and streaks: updates progress (evidence: `lib/domain/plans.ts`)
- Balance scoring → Time categories: scores categories (evidence: `lib/domain/scoring.ts`)
- Plan optimizer → Schedule validation: validates intervals (evidence: `lib/domain/optimizer.ts`)
- Classify API → Activity classifier: uses fallback (evidence: `app/api/classify/route.ts`)
- Classify API → Structured AI client: requests AI (evidence: `app/api/classify/route.ts`)
- Optimize API → Plan optimizer: uses fallback (evidence: `app/api/optimize/route.ts`)
- Optimize API → Structured AI client: requests AI (evidence: `app/api/optimize/route.ts`)
- Structured AI client → OpenAI service: sends request (evidence: `lib/ai/openai.ts`)
- Tomorrow planner → Optimize API: requests optimization
- User → Classify API: requests classification
