# dorkochavi/unlock-app architecture

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

- Interactive diagram: https://gitdiagram.com/dorkochavi/unlock-app
- Repository: https://github.com/dorkochavi/unlock-app

## Overview

UNLOCK is a Hebrew-first adaptive learning application. Learners access courses, answer scheduled or manual-practice questions, and build progress over time; the product describes the learner model and next-best action as central. Instructors create and manage courses and questions, with import and learner-analysis capabilities. The README documents an app → application → domain layering, with infrastructure implementing persistence/provider boundaries. Source excerpts show concrete course and daily-plan wiring; several other feature branches are represented by their documented modules, but their internal calls were not sampled.

Main entry points: [`src/app/api/courses`](https://github.com/dorkochavi/unlock-app/tree/main/src/app/api/courses) (Course API), [`src/app/api/daily-plan/today/route.ts`](https://github.com/dorkochavi/unlock-app/blob/main/src/app/api/daily-plan/today/route.ts) (Today plan API), [`src/application/course`](https://github.com/dorkochavi/unlock-app/tree/main/src/application/course) (Course and question authoring), [`src/application/dailyPlan`](https://github.com/dorkochavi/unlock-app/tree/main/src/application/dailyPlan) (Daily plan service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_learner["Learner experience"]
  node_learner_ui["Learner screens"]
  node_today_api["Today plan API<br/>[route.ts]"]
  node_daily_handler["Today plan handler"]
  node_practice["Manual practice"]
  node_progress["Learning progress"]
end

subgraph group_authoring["Course authoring"]
  node_instructor_ui["Instructor screens"]
  node_course_api["Course API"]
  node_course_authoring["Course and question authoring"]
  node_imports["Material import"]
  node_insights["Course insights"]
end

subgraph group_app["Application and domain"]
  node_domain["Learning model"]
  node_daily_app["Daily plan service"]
end

subgraph group_infra["Persistence and identity"]
  node_auth["Supabase authentication"]
  node_pg_pool["Postgres pool<br/>[pg-pool.ts]"]
  node_course_repo[("Course repositories")]
  node_membership_repo[("Membership repository")]
  node_daily_repo[("Daily plan repository")]
end

node_learner(("Learner"))
node_instructor(("Instructor"))

node_learner -->|"uses"| node_learner_ui
node_learner_ui -.->|"requests plan"| node_today_api
node_today_api -->|"dispatches"| node_daily_handler
node_daily_handler -->|"invokes"| node_daily_app
node_instructor -->|"uses"| node_instructor_ui
node_instructor_ui -.->|"requests authoring"| node_course_api
node_course_api -->|"dispatches"| node_course_authoring
node_course_authoring -.->|"supports import"| node_imports
node_course_authoring -.->|"supports analysis"| node_insights
node_practice -->|"uses learning rules"| node_domain
node_daily_app -->|"uses learning rules"| node_domain
node_progress -->|"uses learning model"| node_domain
node_today_api -->|"authenticates via"| node_auth
node_today_api -->|"constructs on demand"| node_pg_pool
node_course_api -->|"authenticates via"| node_auth
node_course_api -->|"constructs on demand"| node_pg_pool
node_course_api -->|"wires repository"| node_course_repo
node_course_api -->|"wires repository"| node_membership_repo
node_daily_app -.->|"persists plans"| node_daily_repo

click node_learner_ui "https://github.com/dorkochavi/unlock-app/tree/main/src/app/(learner)"
click node_today_api "https://github.com/dorkochavi/unlock-app/blob/main/src/app/api/daily-plan/today/route.ts"
click node_daily_handler "https://github.com/dorkochavi/unlock-app/blob/main/src/app/api/daily-plan/today/handle-get-daily-plan-today.ts"
click node_practice "https://github.com/dorkochavi/unlock-app/tree/main/src/application/practice"
click node_progress "https://github.com/dorkochavi/unlock-app/tree/main/src/application/progress"
click node_instructor_ui "https://github.com/dorkochavi/unlock-app/tree/main/src/app/instructor"
click node_course_api "https://github.com/dorkochavi/unlock-app/tree/main/src/app/api/courses"
click node_course_authoring "https://github.com/dorkochavi/unlock-app/tree/main/src/application/course"
click node_imports "https://github.com/dorkochavi/unlock-app/tree/main/src/application/import"
click node_insights "https://github.com/dorkochavi/unlock-app/tree/main/src/application/insights"
click node_domain "https://github.com/dorkochavi/unlock-app/tree/main/src/domain/learning"
click node_daily_app "https://github.com/dorkochavi/unlock-app/tree/main/src/application/dailyPlan"
click node_auth "https://github.com/dorkochavi/unlock-app/blob/main/src/infrastructure/supabase/require-authenticated-user.ts"
click node_pg_pool "https://github.com/dorkochavi/unlock-app/blob/main/src/infrastructure/postgres/pg-pool.ts"
click node_course_repo "https://github.com/dorkochavi/unlock-app/blob/main/src/infrastructure/postgres/course-repository.ts"
click node_membership_repo "https://github.com/dorkochavi/unlock-app/blob/main/src/infrastructure/postgres/course-membership-repository.ts"
click node_daily_repo "https://github.com/dorkochavi/unlock-app/blob/main/src/infrastructure/postgres/daily-plan-repository.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_learner_ui,node_today_api,node_daily_handler,node_practice,node_progress toneBlue
class node_instructor_ui,node_course_api,node_course_authoring,node_imports,node_insights toneAmber
class node_domain,node_daily_app toneMint
class node_auth,node_pg_pool,node_course_repo,node_membership_repo,node_daily_repo toneRose
class node_learner,node_instructor toneIndigo
```

## Components

### Learner experience

- [Learner screens](https://github.com/dorkochavi/unlock-app/tree/main/src/app/(learner)): `src/app/(learner)`
- [Today plan API](https://github.com/dorkochavi/unlock-app/blob/main/src/app/api/daily-plan/today/route.ts): `src/app/api/daily-plan/today/route.ts`
- [Today plan handler](https://github.com/dorkochavi/unlock-app/blob/main/src/app/api/daily-plan/today/handle-get-daily-plan-today.ts): `src/app/api/daily-plan/today/handle-get-daily-plan-today.ts`
- [Manual practice](https://github.com/dorkochavi/unlock-app/tree/main/src/application/practice): `src/application/practice`
- [Learning progress](https://github.com/dorkochavi/unlock-app/tree/main/src/application/progress): `src/application/progress`

### Course authoring

- [Instructor screens](https://github.com/dorkochavi/unlock-app/tree/main/src/app/instructor): `src/app/instructor`
- [Course API](https://github.com/dorkochavi/unlock-app/tree/main/src/app/api/courses): `src/app/api/courses`
- [Course and question authoring](https://github.com/dorkochavi/unlock-app/tree/main/src/application/course): `src/application/course`
- [Material import](https://github.com/dorkochavi/unlock-app/tree/main/src/application/import): `src/application/import`
- [Course insights](https://github.com/dorkochavi/unlock-app/tree/main/src/application/insights): `src/application/insights`

### Application and domain

- [Learning model](https://github.com/dorkochavi/unlock-app/tree/main/src/domain/learning): `src/domain/learning`
- [Daily plan service](https://github.com/dorkochavi/unlock-app/tree/main/src/application/dailyPlan): `src/application/dailyPlan`

### Persistence and identity

- [Supabase authentication](https://github.com/dorkochavi/unlock-app/blob/main/src/infrastructure/supabase/require-authenticated-user.ts): `src/infrastructure/supabase/require-authenticated-user.ts`
- [Postgres pool](https://github.com/dorkochavi/unlock-app/blob/main/src/infrastructure/postgres/pg-pool.ts): `src/infrastructure/postgres/pg-pool.ts`
- [Course repositories](https://github.com/dorkochavi/unlock-app/blob/main/src/infrastructure/postgres/course-repository.ts): `src/infrastructure/postgres/course-repository.ts`
- [Membership repository](https://github.com/dorkochavi/unlock-app/blob/main/src/infrastructure/postgres/course-membership-repository.ts): `src/infrastructure/postgres/course-membership-repository.ts`
- [Daily plan repository](https://github.com/dorkochavi/unlock-app/blob/main/src/infrastructure/postgres/daily-plan-repository.ts): `src/infrastructure/postgres/daily-plan-repository.ts`

### Other components

- **Learner**
- **Instructor**

## Connections

- Learner → Learner screens: uses (evidence: `README.md`)
- Learner screens → Today plan API: requests plan
- Today plan API → Today plan handler: dispatches (evidence: `src/app/api/daily-plan/today/route.ts`)
- Today plan handler → Daily plan service: invokes (evidence: `src/app/api/daily-plan/today/route.ts`)
- Instructor → Instructor screens: uses (evidence: `README.md`)
- Instructor screens → Course API: requests authoring
- Course API → Course and question authoring: dispatches (evidence: `src/app/api/courses/[courseId]/manage/route.ts`)
- Course and question authoring → Material import: supports import
- Course and question authoring → Course insights: supports analysis
- Manual practice → Learning model: uses learning rules (evidence: `README.md`)
- Daily plan service → Learning model: uses learning rules (evidence: `README.md`)
- Learning progress → Learning model: uses learning model (evidence: `README.md`)
- Today plan API → Supabase authentication: authenticates via (evidence: `src/app/api/daily-plan/today/route.ts`)
- Today plan API → Postgres pool: constructs on demand (evidence: `src/app/api/daily-plan/today/route.ts`)
- Course API → Supabase authentication: authenticates via (evidence: `src/app/api/courses/route.ts`)
- Course API → Postgres pool: constructs on demand (evidence: `src/app/api/courses/route.ts`)
- Course API → Course repositories: wires repository (evidence: `src/app/api/courses/mine/route.ts`)
- Course API → Membership repository: wires repository (evidence: `src/app/api/courses/mine/route.ts`)
- Daily plan service → Daily plan repository: persists plans (evidence: `src/infrastructure/postgres/daily-plan-repository.ts`)
