# immagiov4/nous architecture

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

- Interactive diagram: https://gitdiagram.com/immagiov4/nous
- Repository: https://github.com/immagiov4/nous

## Overview

Nous Reader is an AI-powered learning product: learners provide documents or researched topics and receive personalized courses, lessons, reflection prompts, and application exercises with AI feedback. The principal flow runs from the reader/library interface through backend course and lesson workflows to persisted projects and generated learning content. The graph also shows project storage, AI-provider access, and lesson playback as separate capabilities. Some connections are supported only by README statements or SOURCE INDEX references; unsampled implementation details are not inferred.

Main entry points: [`apps/web/hooks/workspace/controller/createWorkspaceController.ts`](https://github.com/immagiov4/nous/blob/main/apps/web/hooks/workspace/controller/createWorkspaceController.ts) (Workspace controls), [`apps/backend/src/server.ts`](https://github.com/immagiov4/nous/blob/main/apps/backend/src/server.ts) (HTTP API server), [`apps/backend/src/routes/openRouterProxy.ts`](https://github.com/immagiov4/nous/blob/main/apps/backend/src/routes/openRouterProxy.ts) (AI provider proxy), [`apps/backend/src/workflows/courseGenerationWorkflow.ts`](https://github.com/immagiov4/nous/blob/main/apps/backend/src/workflows/courseGenerationWorkflow.ts) (Course generation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Reader experience"]
  node_reader["Reader and library"]
  node_workspace["Workspace controls"]
  node_library_state["Project library state"]
  node_web_auth["Web authentication<br/>[supabaseAuth.ts]"]
  node_web_repo["Project repository client"]
end

subgraph group_generation["Course generation"]
  node_course_workflow["Course generation"]
  node_research_routing["Research source planning"]
  node_lesson_workflow["Lesson generation"]
  node_lesson_stages["Lesson generation stages"]
  node_diagnostics["Prior-knowledge diagnostics"]
  node_playback["Lesson playback"]
end

subgraph group_platform["Backend platform"]
  node_api["HTTP API server<br/>[server.ts]"]
  node_runtime["Workflow runtime"]
  node_worker["Workflow worker"]
end

subgraph group_integrations["AI and storage"]
  node_project_store[("Project storage")]
  node_model_config["AI model configuration<br/>[modelConfig.ts]"]
  node_ai_proxy["AI provider proxy<br/>[openRouterProxy.ts]"]
end

node_learner(("Learner"))
node_providers{{"AI providers"}}

node_learner -->|"uses"| node_reader
node_reader -.->|"opens learning"| node_workspace
node_workspace -.->|"starts generation"| node_course_workflow
node_workspace -.->|"requests lesson"| node_lesson_workflow
node_workspace -.->|"requests diagnostic"| node_diagnostics
node_workspace -.->|"requests playback"| node_playback
node_library_state -->|"uses"| node_web_repo
node_library_state -->|"uses"| node_web_auth
node_web_repo -->|"uses server API"| node_api
node_api -->|"starts runtime"| node_runtime
node_api -->|"provides store"| node_project_store
node_course_workflow -.->|"plans sources"| node_research_routing
node_research_routing -->|"generates course object"| node_course_workflow
node_lesson_workflow -.->|"uses stages"| node_lesson_stages
node_api -.->|"registers routes"| node_ai_proxy
node_ai_proxy -->|"resolves provider"| node_model_config
node_ai_proxy -->|"streams requests"| node_providers
node_runtime -.->|"runs workflows"| node_worker
node_worker -->|"accesses project assets"| node_project_store
node_learner -.->|"may use assigned Codex"| node_providers

click node_reader "https://github.com/immagiov4/nous/blob/main/apps/web/components/library/LibraryScreenContainer.tsx"
click node_workspace "https://github.com/immagiov4/nous/blob/main/apps/web/hooks/workspace/controller/createWorkspaceController.ts"
click node_library_state "https://github.com/immagiov4/nous/blob/main/apps/web/hooks/library/useProjectLibrary.ts"
click node_web_auth "https://github.com/immagiov4/nous/blob/main/apps/web/services/auth/supabaseAuth.ts"
click node_web_repo "https://github.com/immagiov4/nous/blob/main/apps/web/services/projects/projectRepository.ts"
click node_course_workflow "https://github.com/immagiov4/nous/blob/main/apps/backend/src/workflows/courseGenerationWorkflow.ts"
click node_research_routing "https://github.com/immagiov4/nous/blob/main/apps/backend/src/services/researchSourceRouting.ts"
click node_lesson_workflow "https://github.com/immagiov4/nous/blob/main/apps/backend/src/workflows/lessonGenerationWorkflow.ts"
click node_lesson_stages "https://github.com/immagiov4/nous/blob/main/apps/backend/src/workflows/lessonGenerationStageServices.ts"
click node_diagnostics "https://github.com/immagiov4/nous/blob/main/apps/backend/src/workflows/courseDiagnosticWorkflow.ts"
click node_playback "https://github.com/immagiov4/nous/blob/main/apps/backend/src/workflows/lessonPlaybackWorkflow.ts"
click node_api "https://github.com/immagiov4/nous/blob/main/apps/backend/src/server.ts"
click node_runtime "https://github.com/immagiov4/nous/blob/main/apps/backend/src/workflows/runtime/workflowRuntimeComposition.ts"
click node_worker "https://github.com/immagiov4/nous/blob/main/apps/backend/src/workflows/runtime/workflowRuntimeWorker.ts"
click node_project_store "https://github.com/immagiov4/nous/blob/main/apps/backend/src/projects/postgresProjectStore.ts"
click node_model_config "https://github.com/immagiov4/nous/blob/main/apps/backend/src/config/modelConfig.ts"
click node_ai_proxy "https://github.com/immagiov4/nous/blob/main/apps/backend/src/routes/openRouterProxy.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_reader,node_workspace,node_library_state,node_web_auth,node_web_repo toneBlue
class node_course_workflow,node_research_routing,node_lesson_workflow,node_lesson_stages,node_diagnostics,node_playback toneAmber
class node_api,node_runtime,node_worker toneMint
class node_project_store,node_model_config,node_ai_proxy toneRose
class node_learner,node_providers toneIndigo
```

## Components

### Reader experience

- [Reader and library](https://github.com/immagiov4/nous/blob/main/apps/web/components/library/LibraryScreenContainer.tsx): `apps/web/components/library/LibraryScreenContainer.tsx`
- [Workspace controls](https://github.com/immagiov4/nous/blob/main/apps/web/hooks/workspace/controller/createWorkspaceController.ts): `apps/web/hooks/workspace/controller/createWorkspaceController.ts`
- [Project library state](https://github.com/immagiov4/nous/blob/main/apps/web/hooks/library/useProjectLibrary.ts): `apps/web/hooks/library/useProjectLibrary.ts`
- [Web authentication](https://github.com/immagiov4/nous/blob/main/apps/web/services/auth/supabaseAuth.ts): `apps/web/services/auth/supabaseAuth.ts`
- [Project repository client](https://github.com/immagiov4/nous/blob/main/apps/web/services/projects/projectRepository.ts): `apps/web/services/projects/projectRepository.ts`

### Course generation

- [Course generation](https://github.com/immagiov4/nous/blob/main/apps/backend/src/workflows/courseGenerationWorkflow.ts): `apps/backend/src/workflows/courseGenerationWorkflow.ts`
- [Research source planning](https://github.com/immagiov4/nous/blob/main/apps/backend/src/services/researchSourceRouting.ts): `apps/backend/src/services/researchSourceRouting.ts`
- [Lesson generation](https://github.com/immagiov4/nous/blob/main/apps/backend/src/workflows/lessonGenerationWorkflow.ts): `apps/backend/src/workflows/lessonGenerationWorkflow.ts`
- [Lesson generation stages](https://github.com/immagiov4/nous/blob/main/apps/backend/src/workflows/lessonGenerationStageServices.ts): `apps/backend/src/workflows/lessonGenerationStageServices.ts`
- [Prior-knowledge diagnostics](https://github.com/immagiov4/nous/blob/main/apps/backend/src/workflows/courseDiagnosticWorkflow.ts): `apps/backend/src/workflows/courseDiagnosticWorkflow.ts`
- [Lesson playback](https://github.com/immagiov4/nous/blob/main/apps/backend/src/workflows/lessonPlaybackWorkflow.ts): `apps/backend/src/workflows/lessonPlaybackWorkflow.ts`

### Backend platform

- [HTTP API server](https://github.com/immagiov4/nous/blob/main/apps/backend/src/server.ts): `apps/backend/src/server.ts`
- [Workflow runtime](https://github.com/immagiov4/nous/blob/main/apps/backend/src/workflows/runtime/workflowRuntimeComposition.ts): `apps/backend/src/workflows/runtime/workflowRuntimeComposition.ts`
- [Workflow worker](https://github.com/immagiov4/nous/blob/main/apps/backend/src/workflows/runtime/workflowRuntimeWorker.ts): `apps/backend/src/workflows/runtime/workflowRuntimeWorker.ts`

### AI and storage

- [Project storage](https://github.com/immagiov4/nous/blob/main/apps/backend/src/projects/postgresProjectStore.ts): `apps/backend/src/projects/postgresProjectStore.ts`
- [AI model configuration](https://github.com/immagiov4/nous/blob/main/apps/backend/src/config/modelConfig.ts): `apps/backend/src/config/modelConfig.ts`
- [AI provider proxy](https://github.com/immagiov4/nous/blob/main/apps/backend/src/routes/openRouterProxy.ts): `apps/backend/src/routes/openRouterProxy.ts`

### Other components

- **Learner**
- **AI providers**

## Connections

- Learner → Reader and library: uses (evidence: `README.md`)
- Reader and library → Workspace controls: opens learning
- Workspace controls → Course generation: starts generation
- Workspace controls → Lesson generation: requests lesson
- Workspace controls → Prior-knowledge diagnostics: requests diagnostic
- Workspace controls → Lesson playback: requests playback
- Project library state → Project repository client: uses (evidence: `apps/web/hooks/library/useProjectLibrary.ts`)
- Project library state → Web authentication: uses (evidence: `apps/web/hooks/library/useProjectLibrary.ts`)
- Project repository client → HTTP API server: uses server API (evidence: `README.md`)
- HTTP API server → Workflow runtime: starts runtime (evidence: `apps/backend/src/server.ts`)
- HTTP API server → Project storage: provides store (evidence: `apps/backend/src/server.ts`)
- Course generation → Research source planning: plans sources
- Research source planning → Course generation: generates course object (evidence: `apps/backend/src/services/researchSourceRouting.ts`)
- Lesson generation → Lesson generation stages: uses stages (evidence: `apps/backend/src/workflows/lessonGenerationStageServices.ts`)
- HTTP API server → AI provider proxy: registers routes
- AI provider proxy → AI model configuration: resolves provider (evidence: `apps/backend/src/routes/openRouterProxy.ts`)
- AI provider proxy → AI providers: streams requests (evidence: `apps/backend/src/routes/openRouterProxy.ts`)
- Workflow runtime → Workflow worker: runs workflows
- Workflow worker → Project storage: accesses project assets (evidence: `apps/backend/src/workflows/runtime/workflowRuntimeWorker.ts`)
- Learner → AI providers: may use assigned Codex (evidence: `README.md`)
