# meaterick/studysite architecture

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

- Interactive diagram: https://gitdiagram.com/meaterick/studysite
- Repository: https://github.com/meaterick/studysite

## Overview

Aegis is an eight-week AI study site: learners move through curriculum stages, practice and quizzes, then complete a worksheet and submit an assignment for operator review. Progress, feedback, and chat support that learning loop; operators manage members, submissions, settings, and conversations. The graph preserves the documented course, practice, assignment, and operator branches, plus indexed persistence and authentication modules. Several page and action implementations were not sampled, so documented relationships use README evidence; unsampled wiring is omitted rather than inferred.

Main entry points: [`src/app/api/auth/google/callback/route.ts`](https://github.com/meaterick/studysite/blob/main/src/app/api/auth/google/callback/route.ts) (Google sign-in), [`src/lib/db.ts`](https://github.com/meaterick/studysite/blob/main/src/lib/db.ts) (SQLite database), [`src/app/progress/page.tsx`](https://github.com/meaterick/studysite/blob/main/src/app/progress/page.tsx) (Progress dashboard), [`src/app/api/chat/stream/route.ts`](https://github.com/meaterick/studysite/blob/main/src/app/api/chat/stream/route.ts) (Chat event stream)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_learning["Learning experience"]
  node_course["Course navigation<br/>[page.tsx]"]
  node_stage["Learning stages<br/>[page.tsx]"]
  node_labs["Coding labs and quizzes<br/>[page.tsx]"]
  node_worksheet["Worksheet<br/>[page.tsx]"]
  node_assignment["Assignment workspace<br/>[page.tsx]"]
  node_progress["Progress dashboard<br/>[page.tsx]"]
end

subgraph group_content["Course content"]
  node_curriculum["Curriculum catalog<br/>[week1.ts]"]
  node_week2["Week two content<br/>[week2.ts]"]
  node_week3["Week three content<br/>[week3.ts]"]
  node_sections["Section metadata<br/>[sections.ts]"]
  node_tiers["Learning tiers<br/>[tiers.ts]"]
  node_labs_content["Lab and quiz specs<br/>[week7.ts]"]
end

subgraph group_operations["Operations and feedback"]
  node_feedback["Feedback inbox<br/>[page.tsx]"]
  node_operator_submissions["Submission review<br/>[page.tsx]"]
  node_operator_members["Member records<br/>[page.tsx]"]
  node_operator_chat["Operator chat<br/>[page.tsx]"]
  node_chat_api["Chat event stream<br/>[route.ts]"]
  node_chat_views["Chat views<br/>[chatView.ts]"]
end

subgraph group_identity["Identity and access"]
  node_auth["Google sign-in<br/>[route.ts]"]
  node_oauth["OAuth state<br/>[googleOAuth.ts]"]
  node_session["Session tokens<br/>[session.ts]"]
  node_dal["Access checks<br/>[dal.ts]"]
end

subgraph group_platform["Persistence and services"]
  node_users[("User records<br/>[userStore.ts]")]
  node_learning_store[("Learning records<br/>[learningStore.ts]")]
  node_submissions[("Submission records<br/>[submissionStore.ts]")]
  node_chat_store[("Chat records<br/>[chatStore.ts]")]
  node_db[("SQLite database<br/>[db.ts]")]
  node_backup["Backup service<br/>[backup.ts]"]
end

node_learner(("Learner"))
node_google(("Google identity"))

node_learner -->|"opens weeks"| node_course
node_course -->|"opens stages"| node_stage
node_stage -->|"offers practice"| node_labs
node_learner -->|"attempts labs"| node_labs
node_learner -->|"submits work"| node_worksheet
node_learner -->|"writes and submits"| node_assignment
node_learner -->|"checks progress"| node_progress
node_curriculum -->|"provides content"| node_course
node_week2 -->|"joins catalog"| node_curriculum
node_week3 -->|"joins catalog"| node_curriculum
node_sections -.->|"defines checks"| node_stage
node_tiers -->|"categorizes stages"| node_sections
node_labs_content -->|"defines exercises"| node_labs
node_progress -->|"reads progress"| node_learning_store
node_progress -->|"reads assignment state"| node_submissions
node_learner -->|"reviews feedback"| node_feedback
node_operator_submissions -->|"reviews submissions"| node_submissions
node_operator_members -->|"reviews learning records"| node_learning_store
node_operator_chat -->|"receives live updates"| node_chat_api
node_chat_api -->|"subscribes to changes"| node_chat_store
node_chat_api -->|"builds snapshots"| node_chat_views
node_learner -->|"signs in"| node_auth
node_auth -->|"exchanges identity"| node_google
node_auth -->|"validates state"| node_oauth
node_auth -->|"finds or creates user"| node_users
node_auth -->|"issues session"| node_session
node_dal -->|"verifies token"| node_session
node_dal -->|"loads account"| node_users
node_learning_store -->|"reads and writes"| node_db
node_submissions -->|"reads and writes"| node_db
node_chat_store -->|"reads and writes"| node_db
node_backup -->|"backs up database"| node_db

click node_course "https://github.com/meaterick/studysite/blob/main/src/app/weeks/%5Bslug%5D/page.tsx"
click node_stage "https://github.com/meaterick/studysite/blob/main/src/app/weeks/%5Bslug%5D/sections/%5BsectionId%5D/page.tsx"
click node_labs "https://github.com/meaterick/studysite/blob/main/src/app/weeks/%5Bslug%5D/lab/page.tsx"
click node_worksheet "https://github.com/meaterick/studysite/blob/main/src/app/weeks/%5Bslug%5D/worksheet/page.tsx"
click node_assignment "https://github.com/meaterick/studysite/blob/main/src/app/weeks/%5Bslug%5D/assignment/page.tsx"
click node_progress "https://github.com/meaterick/studysite/blob/main/src/app/progress/page.tsx"
click node_curriculum "https://github.com/meaterick/studysite/blob/main/src/content/weeks/week1.ts"
click node_week2 "https://github.com/meaterick/studysite/blob/main/src/content/weeks/week2.ts"
click node_week3 "https://github.com/meaterick/studysite/blob/main/src/content/weeks/week3.ts"
click node_sections "https://github.com/meaterick/studysite/blob/main/src/content/sections.ts"
click node_tiers "https://github.com/meaterick/studysite/blob/main/src/content/tiers.ts"
click node_labs_content "https://github.com/meaterick/studysite/blob/main/src/content/labs/week7.ts"
click node_feedback "https://github.com/meaterick/studysite/blob/main/src/app/feedback/page.tsx"
click node_operator_submissions "https://github.com/meaterick/studysite/blob/main/src/app/operator/submissions/page.tsx"
click node_operator_members "https://github.com/meaterick/studysite/blob/main/src/app/operator/members/page.tsx"
click node_operator_chat "https://github.com/meaterick/studysite/blob/main/src/app/operator/chat/page.tsx"
click node_chat_api "https://github.com/meaterick/studysite/blob/main/src/app/api/chat/stream/route.ts"
click node_chat_views "https://github.com/meaterick/studysite/blob/main/src/lib/chatView.ts"
click node_auth "https://github.com/meaterick/studysite/blob/main/src/app/api/auth/google/callback/route.ts"
click node_oauth "https://github.com/meaterick/studysite/blob/main/src/lib/googleOAuth.ts"
click node_session "https://github.com/meaterick/studysite/blob/main/src/lib/session.ts"
click node_dal "https://github.com/meaterick/studysite/blob/main/src/lib/dal.ts"
click node_users "https://github.com/meaterick/studysite/blob/main/src/lib/userStore.ts"
click node_learning_store "https://github.com/meaterick/studysite/blob/main/src/lib/learningStore.ts"
click node_submissions "https://github.com/meaterick/studysite/blob/main/src/lib/submissionStore.ts"
click node_chat_store "https://github.com/meaterick/studysite/blob/main/src/lib/chatStore.ts"
click node_db "https://github.com/meaterick/studysite/blob/main/src/lib/db.ts"
click node_backup "https://github.com/meaterick/studysite/blob/main/src/lib/backup.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_course,node_stage,node_labs,node_worksheet,node_assignment,node_progress toneBlue
class node_curriculum,node_week2,node_week3,node_sections,node_tiers,node_labs_content toneAmber
class node_feedback,node_operator_submissions,node_operator_members,node_operator_chat,node_chat_api,node_chat_views toneMint
class node_auth,node_oauth,node_session,node_dal toneRose
class node_users,node_learning_store,node_submissions,node_chat_store,node_db,node_backup,node_learner,node_google toneIndigo
```

## Components

### Learning experience

- [Course navigation](https://github.com/meaterick/studysite/blob/main/src/app/weeks/%5Bslug%5D/page.tsx): `src/app/weeks/[slug]/page.tsx`
- [Learning stages](https://github.com/meaterick/studysite/blob/main/src/app/weeks/%5Bslug%5D/sections/%5BsectionId%5D/page.tsx): `src/app/weeks/[slug]/sections/[sectionId]/page.tsx`
- [Coding labs and quizzes](https://github.com/meaterick/studysite/blob/main/src/app/weeks/%5Bslug%5D/lab/page.tsx): `src/app/weeks/[slug]/lab/page.tsx`
- [Worksheet](https://github.com/meaterick/studysite/blob/main/src/app/weeks/%5Bslug%5D/worksheet/page.tsx): `src/app/weeks/[slug]/worksheet/page.tsx`
- [Assignment workspace](https://github.com/meaterick/studysite/blob/main/src/app/weeks/%5Bslug%5D/assignment/page.tsx): `src/app/weeks/[slug]/assignment/page.tsx`
- [Progress dashboard](https://github.com/meaterick/studysite/blob/main/src/app/progress/page.tsx): `src/app/progress/page.tsx`

### Course content

- [Curriculum catalog](https://github.com/meaterick/studysite/blob/main/src/content/weeks/week1.ts): `src/content/weeks/week1.ts`
- [Week two content](https://github.com/meaterick/studysite/blob/main/src/content/weeks/week2.ts): `src/content/weeks/week2.ts`
- [Week three content](https://github.com/meaterick/studysite/blob/main/src/content/weeks/week3.ts): `src/content/weeks/week3.ts`
- [Section metadata](https://github.com/meaterick/studysite/blob/main/src/content/sections.ts): `src/content/sections.ts`
- [Learning tiers](https://github.com/meaterick/studysite/blob/main/src/content/tiers.ts): `src/content/tiers.ts`
- [Lab and quiz specs](https://github.com/meaterick/studysite/blob/main/src/content/labs/week7.ts): `src/content/labs/week7.ts`

### Operations and feedback

- [Feedback inbox](https://github.com/meaterick/studysite/blob/main/src/app/feedback/page.tsx): `src/app/feedback/page.tsx`
- [Submission review](https://github.com/meaterick/studysite/blob/main/src/app/operator/submissions/page.tsx): `src/app/operator/submissions/page.tsx`
- [Member records](https://github.com/meaterick/studysite/blob/main/src/app/operator/members/page.tsx): `src/app/operator/members/page.tsx`
- [Operator chat](https://github.com/meaterick/studysite/blob/main/src/app/operator/chat/page.tsx): `src/app/operator/chat/page.tsx`
- [Chat event stream](https://github.com/meaterick/studysite/blob/main/src/app/api/chat/stream/route.ts): `src/app/api/chat/stream/route.ts`
- [Chat views](https://github.com/meaterick/studysite/blob/main/src/lib/chatView.ts): `src/lib/chatView.ts`

### Identity and access

- [Google sign-in](https://github.com/meaterick/studysite/blob/main/src/app/api/auth/google/callback/route.ts): `src/app/api/auth/google/callback/route.ts`
- [OAuth state](https://github.com/meaterick/studysite/blob/main/src/lib/googleOAuth.ts): `src/lib/googleOAuth.ts`
- [Session tokens](https://github.com/meaterick/studysite/blob/main/src/lib/session.ts): `src/lib/session.ts`
- [Access checks](https://github.com/meaterick/studysite/blob/main/src/lib/dal.ts): `src/lib/dal.ts`

### Persistence and services

- [User records](https://github.com/meaterick/studysite/blob/main/src/lib/userStore.ts): `src/lib/userStore.ts`
- [Learning records](https://github.com/meaterick/studysite/blob/main/src/lib/learningStore.ts): `src/lib/learningStore.ts`
- [Submission records](https://github.com/meaterick/studysite/blob/main/src/lib/submissionStore.ts): `src/lib/submissionStore.ts`
- [Chat records](https://github.com/meaterick/studysite/blob/main/src/lib/chatStore.ts): `src/lib/chatStore.ts`
- [SQLite database](https://github.com/meaterick/studysite/blob/main/src/lib/db.ts): `src/lib/db.ts`
- [Backup service](https://github.com/meaterick/studysite/blob/main/src/lib/backup.ts): `src/lib/backup.ts`

### Other components

- **Learner**
- **Google identity**

## Connections

- Learner → Course navigation: opens weeks
- Course navigation → Learning stages: opens stages
- Learning stages → Coding labs and quizzes: offers practice
- Learner → Coding labs and quizzes: attempts labs
- Learner → Worksheet: submits work
- Learner → Assignment workspace: writes and submits
- Learner → Progress dashboard: checks progress
- Curriculum catalog → Course navigation: provides content
- Week two content → Curriculum catalog: joins catalog (evidence: `src/content/weeks/index.ts`)
- Week three content → Curriculum catalog: joins catalog (evidence: `src/content/weeks/index.ts`)
- Section metadata → Learning stages: defines checks
- Learning tiers → Section metadata: categorizes stages
- Lab and quiz specs → Coding labs and quizzes: defines exercises
- Progress dashboard → Learning records: reads progress (evidence: `src/app/progress/page.tsx`)
- Progress dashboard → Submission records: reads assignment state (evidence: `src/app/progress/page.tsx`)
- Learner → Feedback inbox: reviews feedback
- Submission review → Submission records: reviews submissions
- Member records → Learning records: reviews learning records
- Operator chat → Chat event stream: receives live updates
- Chat event stream → Chat records: subscribes to changes (evidence: `src/app/api/chat/stream/route.ts`)
- Chat event stream → Chat views: builds snapshots (evidence: `src/app/api/chat/stream/route.ts`)
- Learner → Google sign-in: signs in
- Google sign-in → Google identity: exchanges identity (evidence: `src/app/api/auth/google/callback/route.ts`)
- Google sign-in → OAuth state: validates state (evidence: `src/app/api/auth/google/callback/route.ts`)
- Google sign-in → User records: finds or creates user (evidence: `src/app/api/auth/google/callback/route.ts`)
- Google sign-in → Session tokens: issues session (evidence: `src/app/api/auth/google/callback/route.ts`)
- Access checks → Session tokens: verifies token (evidence: `src/lib/dal.ts`)
- Access checks → User records: loads account (evidence: `src/lib/dal.ts`)
- Learning records → SQLite database: reads and writes (evidence: `src/lib/learningStore.ts`)
- Submission records → SQLite database: reads and writes (evidence: `src/lib/submissionStore.ts`)
- Chat records → SQLite database: reads and writes (evidence: `src/lib/chatStore.ts`)
- Backup service → SQLite database: backs up database (evidence: `src/lib/backup.ts`)
