# gohwenzhe/cognita architecture

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

- Interactive diagram: https://gitdiagram.com/gohwenzhe/cognita
- Repository: https://github.com/gohwenzhe/cognita

## Overview

Cognita is a Next.js presentation hub for the owner’s software projects. Interviewers browse a featured/catalog home page, open system presentations, and access summaries, media, documents, and optional demo/source links. The owner signs in to administer systems and their assets; data is stored in PostgreSQL, with uploads served from S3-compatible storage or local files. The graph follows documented routes and indexed imports; unsampled details such as middleware behavior are not asserted.

Main entry points: [`src/app/systems/[slug]/page.tsx`](https://github.com/gohwenzhe/cognita/blob/main/src/app/systems/%5Bslug%5D/page.tsx) (System presentation), [`src/app/admin/actions.ts`](https://github.com/gohwenzhe/cognita/blob/main/src/app/admin/actions.ts) (Admin actions), [`src/lib/prisma.ts`](https://github.com/gohwenzhe/cognita/blob/main/src/lib/prisma.ts) (Prisma client), [`src/lib/storage.ts`](https://github.com/gohwenzhe/cognita/blob/main/src/lib/storage.ts) (Asset storage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public presentations"]
  node_home["Catalog home<br/>[page.tsx]"]
  node_system_page["System presentation<br/>[page.tsx]"]
  node_resume["Resume page<br/>[page.tsx]"]
  node_contact["Contact page<br/>[page.tsx]"]
  node_system_card["System card<br/>[system-card.tsx]"]
  node_rich_html["Rich summary renderer<br/>[rich-html.tsx]"]
  node_site_header["Site navigation<br/>[site-header.tsx]"]
end

subgraph group_admin["Owner administration"]
  node_admin_ui["Admin pages<br/>[page.tsx]"]
  node_system_form["System editor<br/>[system-form.tsx]"]
  node_summary_editor["Summary editor<br/>[summary-editor.tsx]"]
  node_asset_manager["Asset manager<br/>[asset-manager.tsx]"]
  node_login_form["Login form<br/>[login-form.tsx]"]
  node_admin_actions["Admin actions<br/>[actions.ts]"]
  node_auth_routes["Auth routes<br/>[route.ts]"]
  node_logout_route["Logout route<br/>[route.ts]"]
end

subgraph group_core["Application services"]
  node_auth["Session and site config<br/>[auth.ts]"]
  node_files_route["File delivery route<br/>[route.ts]"]
end

subgraph group_persistence["Data and files"]
  node_prisma["Prisma client<br/>[prisma.ts]"]
  node_database[("PostgreSQL<br/>[schema.prisma]")]
  node_storage["Asset storage<br/>[storage.ts]"]
  node_object_store[("S3 or local files")]
end

node_interviewer(("Interviewer"))
node_owner(("Owner"))

node_interviewer -->|"browses"| node_home
node_interviewer -->|"opens"| node_system_page
node_interviewer -->|"views"| node_resume
node_interviewer -->|"visits"| node_contact
node_home -->|"queries catalog"| node_prisma
node_home -->|"renders"| node_system_card
node_system_page -->|"loads system"| node_prisma
node_system_page -->|"renders summary"| node_rich_html
node_system_page -->|"builds file links"| node_storage
node_system_page -->|"reads site config"| node_auth
node_prisma -->|"accesses"| node_database
node_owner -->|"signs in"| node_login_form
node_login_form -.->|"submits credentials"| node_auth_routes
node_auth_routes -->|"checks and creates session"| node_auth
node_logout_route -->|"clears session"| node_auth
node_owner -->|"manages catalog"| node_admin_ui
node_admin_ui -->|"loads systems"| node_prisma
node_admin_ui -->|"opens editor"| node_system_form
node_system_form -->|"embeds editor"| node_summary_editor
node_system_form -->|"submits changes"| node_admin_actions
node_asset_manager -->|"submits asset changes"| node_admin_actions
node_asset_manager -->|"builds file links"| node_storage
node_admin_actions -->|"checks owner session"| node_auth
node_admin_actions -->|"persists catalog"| node_prisma
node_admin_actions -->|"stores uploads"| node_storage
node_files_route -->|"reads requested file"| node_storage
node_storage -->|"reads and writes"| node_object_store

click node_home "https://github.com/gohwenzhe/cognita/blob/main/src/app/page.tsx"
click node_system_page "https://github.com/gohwenzhe/cognita/blob/main/src/app/systems/%5Bslug%5D/page.tsx"
click node_resume "https://github.com/gohwenzhe/cognita/blob/main/src/app/resume/page.tsx"
click node_contact "https://github.com/gohwenzhe/cognita/blob/main/src/app/contact/page.tsx"
click node_system_card "https://github.com/gohwenzhe/cognita/blob/main/src/components/system-card.tsx"
click node_rich_html "https://github.com/gohwenzhe/cognita/blob/main/src/components/rich-html.tsx"
click node_site_header "https://github.com/gohwenzhe/cognita/blob/main/src/components/site-header.tsx"
click node_admin_ui "https://github.com/gohwenzhe/cognita/blob/main/src/app/admin/page.tsx"
click node_system_form "https://github.com/gohwenzhe/cognita/blob/main/src/components/system-form.tsx"
click node_summary_editor "https://github.com/gohwenzhe/cognita/blob/main/src/components/summary-editor.tsx"
click node_asset_manager "https://github.com/gohwenzhe/cognita/blob/main/src/components/asset-manager.tsx"
click node_login_form "https://github.com/gohwenzhe/cognita/blob/main/src/components/login-form.tsx"
click node_admin_actions "https://github.com/gohwenzhe/cognita/blob/main/src/app/admin/actions.ts"
click node_auth_routes "https://github.com/gohwenzhe/cognita/blob/main/src/app/api/auth/login/route.ts"
click node_logout_route "https://github.com/gohwenzhe/cognita/blob/main/src/app/api/auth/logout/route.ts"
click node_auth "https://github.com/gohwenzhe/cognita/blob/main/src/lib/auth.ts"
click node_files_route "https://github.com/gohwenzhe/cognita/blob/main/src/app/api/files/%5B...key%5D/route.ts"
click node_prisma "https://github.com/gohwenzhe/cognita/blob/main/src/lib/prisma.ts"
click node_database "https://github.com/gohwenzhe/cognita/blob/main/prisma/schema.prisma"
click node_storage "https://github.com/gohwenzhe/cognita/blob/main/src/lib/storage.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_home,node_system_page,node_resume,node_contact,node_system_card,node_rich_html,node_site_header,node_interviewer toneBlue
class node_admin_ui,node_system_form,node_summary_editor,node_asset_manager,node_login_form,node_admin_actions,node_auth_routes,node_logout_route toneAmber
class node_auth,node_files_route toneMint
class node_prisma,node_database,node_storage,node_object_store toneRose
class node_owner toneIndigo
```

## Components

### Public presentations

- [Catalog home](https://github.com/gohwenzhe/cognita/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [System presentation](https://github.com/gohwenzhe/cognita/blob/main/src/app/systems/%5Bslug%5D/page.tsx): `src/app/systems/[slug]/page.tsx`
- [Resume page](https://github.com/gohwenzhe/cognita/blob/main/src/app/resume/page.tsx): `src/app/resume/page.tsx`
- [Contact page](https://github.com/gohwenzhe/cognita/blob/main/src/app/contact/page.tsx): `src/app/contact/page.tsx`
- [System card](https://github.com/gohwenzhe/cognita/blob/main/src/components/system-card.tsx): `src/components/system-card.tsx`
- [Rich summary renderer](https://github.com/gohwenzhe/cognita/blob/main/src/components/rich-html.tsx): `src/components/rich-html.tsx`
- [Site navigation](https://github.com/gohwenzhe/cognita/blob/main/src/components/site-header.tsx): `src/components/site-header.tsx`

### Owner administration

- [Admin pages](https://github.com/gohwenzhe/cognita/blob/main/src/app/admin/page.tsx): `src/app/admin/page.tsx`
- [System editor](https://github.com/gohwenzhe/cognita/blob/main/src/components/system-form.tsx): `src/components/system-form.tsx`
- [Summary editor](https://github.com/gohwenzhe/cognita/blob/main/src/components/summary-editor.tsx): `src/components/summary-editor.tsx`
- [Asset manager](https://github.com/gohwenzhe/cognita/blob/main/src/components/asset-manager.tsx): `src/components/asset-manager.tsx`
- [Login form](https://github.com/gohwenzhe/cognita/blob/main/src/components/login-form.tsx): `src/components/login-form.tsx`
- [Admin actions](https://github.com/gohwenzhe/cognita/blob/main/src/app/admin/actions.ts): `src/app/admin/actions.ts`
- [Auth routes](https://github.com/gohwenzhe/cognita/blob/main/src/app/api/auth/login/route.ts): `src/app/api/auth/login/route.ts`
- [Logout route](https://github.com/gohwenzhe/cognita/blob/main/src/app/api/auth/logout/route.ts): `src/app/api/auth/logout/route.ts`

### Application services

- [Session and site config](https://github.com/gohwenzhe/cognita/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [File delivery route](https://github.com/gohwenzhe/cognita/blob/main/src/app/api/files/%5B...key%5D/route.ts): `src/app/api/files/[...key]/route.ts`

### Data and files

- [Prisma client](https://github.com/gohwenzhe/cognita/blob/main/src/lib/prisma.ts): `src/lib/prisma.ts`
- [PostgreSQL](https://github.com/gohwenzhe/cognita/blob/main/prisma/schema.prisma): `prisma/schema.prisma`
- [Asset storage](https://github.com/gohwenzhe/cognita/blob/main/src/lib/storage.ts): `src/lib/storage.ts`
- **S3 or local files**

### Other components

- **Interviewer**
- **Owner**

## Connections

- Interviewer → Catalog home: browses (evidence: `README.md`)
- Interviewer → System presentation: opens (evidence: `README.md`)
- Interviewer → Resume page: views (evidence: `README.md`)
- Interviewer → Contact page: visits (evidence: `README.md`)
- Catalog home → Prisma client: queries catalog (evidence: `src/app/page.tsx`)
- Catalog home → System card: renders (evidence: `src/app/page.tsx`)
- System presentation → Prisma client: loads system (evidence: `src/app/systems/[slug]/page.tsx`)
- System presentation → Rich summary renderer: renders summary (evidence: `src/app/systems/[slug]/page.tsx`)
- System presentation → Asset storage: builds file links (evidence: `src/app/systems/[slug]/page.tsx`)
- System presentation → Session and site config: reads site config (evidence: `src/app/systems/[slug]/page.tsx`)
- Prisma client → PostgreSQL: accesses (evidence: `src/lib/prisma.ts`)
- Owner → Login form: signs in (evidence: `README.md`)
- Login form → Auth routes: submits credentials
- Auth routes → Session and site config: checks and creates session (evidence: `src/app/api/auth/login/route.ts`)
- Logout route → Session and site config: clears session (evidence: `src/app/api/auth/logout/route.ts`)
- Owner → Admin pages: manages catalog (evidence: `README.md`)
- Admin pages → Prisma client: loads systems (evidence: `src/app/admin/page.tsx`)
- Admin pages → System editor: opens editor
- System editor → Summary editor: embeds editor (evidence: `src/components/system-form.tsx`)
- System editor → Admin actions: submits changes (evidence: `src/components/system-form.tsx`)
- Asset manager → Admin actions: submits asset changes (evidence: `src/components/asset-manager.tsx`)
- Asset manager → Asset storage: builds file links (evidence: `src/components/asset-manager.tsx`)
- Admin actions → Session and site config: checks owner session (evidence: `src/app/admin/actions.ts`)
- Admin actions → Prisma client: persists catalog (evidence: `src/app/admin/actions.ts`)
- Admin actions → Asset storage: stores uploads (evidence: `src/app/admin/actions.ts`)
- File delivery route → Asset storage: reads requested file (evidence: `src/app/api/files/[...key]/route.ts`)
- Asset storage → S3 or local files: reads and writes (evidence: `src/lib/storage.ts`)
