# kevinbwrightgmu/metacode architecture

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

- Interactive diagram: https://gitdiagram.com/kevinbwrightgmu/metacode
- Repository: https://github.com/kevinbwrightgmu/metacode

## Overview

MetaCode is a browser-based, AI-assisted research platform. Researchers collect or import social-media data, organize projects and codebooks, apply AI or human coding, assess coder reliability, and analyze engagement or social networks; results can be exported. Separate branches provide Survey Studio, an Ultra-tier AI Coding Lab, and an AI Scraper collector. The server exposes APIs and coordinates scraping, accounts, and AI features, while project and survey data are primarily browser-owned. Connections below follow README-described workflows and shown source references; unsampled implementation details are not inferred.

Main entry points: [`public/js/app.js`](https://github.com/kevinbwrightgmu/metacode/blob/main/public/js/app.js) (Coding app), [`server.js`](https://github.com/kevinbwrightgmu/metacode/blob/main/server.js) (Application server), [`surveys/index.js`](https://github.com/kevinbwrightgmu/metacode/blob/main/surveys/index.js) (Survey API), [`ai-lab/index.js`](https://github.com/kevinbwrightgmu/metacode/blob/main/ai-lab/index.js) (AI Lab API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_research["Research and coding"]
  node_coding_app["Coding app<br/>[app.js]"]
  node_data_import["Data import<br/>[data.js]"]
  node_codebook["Codebook builder<br/>[codebook.js]"]
  node_ai_coding["AI auto-coding<br/>[server.js]"]
  node_human_coding["Human coding<br/>[human-coding.js]"]
  node_reliability["Reliability analysis<br/>[reliability.js]"]
  node_network_analysis["Network analysis"]
  node_metrics["Metrics<br/>[engagement.js]"]
  node_exports["Research exports<br/>[data.js]"]
  node_projects["Projects<br/>[index.js]"]
  node_assistant["MetaCode assistant<br/>[assistant.js]"]
end

subgraph group_collection["Data collection"]
  node_scraper_ui["Scraper interface<br/>[scraper.js]"]
  node_scraper_api["Scraper jobs and API<br/>[index.js]"]
  node_job_manager["Job manager<br/>[job-manager.js]"]
  node_reddit_collection["Reddit collection"]
  node_platform_collection["YouTube and X<br/>[index.js]"]
  node_network_transport["Scraper transport<br/>[network-manager.js]"]
  node_ai_collector["AI Scraper collector<br/>[App.tsx]"]
  node_collector_store[("Collector browser store<br/>[db.ts]")]
end

subgraph group_surveys["Survey Studio"]
  node_survey_studio["Survey editor<br/>[survey-studio.js]"]
  node_survey_api["Survey API<br/>[index.js]"]
  node_survey_store[("Survey persistence<br/>[store.js]")]
end

subgraph group_ai_lab["AI Coding Lab"]
  node_lab_ui["AI Lab workbench<br/>[lab-workbench.js]"]
  node_lab_api["AI Lab API<br/>[index.js]"]
  node_lab_profiles["Coding profiles<br/>[profiles.js]"]
  node_lab_providers["Model providers<br/>[providers.js]"]
end

subgraph group_platform["Server and accounts"]
  node_accounts["Accounts and plans<br/>[index.js]"]
  node_server["Application server<br/>[server.js]"]
end

node_researcher(("Researcher"))

node_researcher -->|"opens"| node_coding_app
node_researcher -->|"collects with"| node_scraper_ui
node_researcher -->|"builds surveys"| node_survey_studio
node_coding_app -->|"imports data"| node_data_import
node_coding_app -->|"defines codes"| node_codebook
node_coding_app -->|"requests coding"| node_ai_coding
node_coding_app -->|"supports coding"| node_human_coding
node_human_coding -->|"compares coders"| node_reliability
node_coding_app -->|"analyzes CSV"| node_network_analysis
node_coding_app -->|"shows metrics"| node_metrics
node_coding_app -->|"exports results"| node_exports
node_coding_app -->|"saves projects"| node_projects
node_coding_app -->|"asks for help"| node_assistant
node_scraper_ui -->|"starts jobs"| node_scraper_api
node_scraper_api -->|"manages jobs"| node_job_manager
node_job_manager -->|"runs scraper"| node_reddit_collection
node_job_manager -->|"runs platform job"| node_platform_collection
node_reddit_collection -->|"sends requests"| node_network_transport
node_scraper_ui -->|"adds posts"| node_coding_app
node_researcher -->|"describes posts"| node_ai_collector
node_ai_collector -->|"stores records"| node_collector_store
node_ai_collector -->|"adds collected posts"| node_coding_app
node_researcher -->|"designs survey"| node_survey_studio
node_survey_studio -->|"publishes survey"| node_survey_api
node_survey_api -->|"reads and writes"| node_survey_store
node_survey_api -->|"sends text answers"| node_coding_app
node_researcher -->|"uses workbench"| node_lab_ui
node_lab_ui -.->|"calls API"| node_lab_api
node_lab_api -->|"uses profiles"| node_lab_profiles
node_lab_api -->|"queries providers"| node_lab_providers
node_server -->|"mounts routes"| node_scraper_api
node_server -->|"mounts routes"| node_survey_api
node_server -->|"mounts routes"| node_lab_api
node_server -->|"mounts routes"| node_accounts
node_accounts -->|"applies policy"| node_scraper_api

click node_coding_app "https://github.com/kevinbwrightgmu/metacode/blob/main/public/js/app.js"
click node_data_import "https://github.com/kevinbwrightgmu/metacode/blob/main/public/js/data.js"
click node_codebook "https://github.com/kevinbwrightgmu/metacode/blob/main/public/js/codebook.js"
click node_ai_coding "https://github.com/kevinbwrightgmu/metacode/blob/main/server.js"
click node_human_coding "https://github.com/kevinbwrightgmu/metacode/blob/main/public/js/human-coding.js"
click node_reliability "https://github.com/kevinbwrightgmu/metacode/blob/main/public/js/reliability.js"
click node_network_analysis "https://github.com/kevinbwrightgmu/metacode/blob/main/python/network_analysis.py"
click node_metrics "https://github.com/kevinbwrightgmu/metacode/blob/main/public/js/engagement.js"
click node_exports "https://github.com/kevinbwrightgmu/metacode/blob/main/public/js/data.js"
click node_projects "https://github.com/kevinbwrightgmu/metacode/blob/main/projects/index.js"
click node_assistant "https://github.com/kevinbwrightgmu/metacode/blob/main/public/js/assistant.js"
click node_scraper_ui "https://github.com/kevinbwrightgmu/metacode/blob/main/public/js/scraper.js"
click node_scraper_api "https://github.com/kevinbwrightgmu/metacode/blob/main/scraper/index.js"
click node_job_manager "https://github.com/kevinbwrightgmu/metacode/blob/main/scraper/jobs/job-manager.js"
click node_reddit_collection "https://github.com/kevinbwrightgmu/metacode/blob/main/scraper/reddit/standard-scraper.js"
click node_platform_collection "https://github.com/kevinbwrightgmu/metacode/blob/main/scraper/platforms/index.js"
click node_network_transport "https://github.com/kevinbwrightgmu/metacode/blob/main/scraper/network/network-manager.js"
click node_ai_collector "https://github.com/kevinbwrightgmu/metacode/blob/main/collector/src/ui/App.tsx"
click node_collector_store "https://github.com/kevinbwrightgmu/metacode/blob/main/collector/src/store/db.ts"
click node_survey_studio "https://github.com/kevinbwrightgmu/metacode/blob/main/public/js/survey/survey-studio.js"
click node_survey_api "https://github.com/kevinbwrightgmu/metacode/blob/main/surveys/index.js"
click node_survey_store "https://github.com/kevinbwrightgmu/metacode/blob/main/surveys/store.js"
click node_lab_ui "https://github.com/kevinbwrightgmu/metacode/blob/main/public/js/ai-lab/lab-workbench.js"
click node_lab_api "https://github.com/kevinbwrightgmu/metacode/blob/main/ai-lab/index.js"
click node_lab_profiles "https://github.com/kevinbwrightgmu/metacode/blob/main/ai-lab/profiles.js"
click node_lab_providers "https://github.com/kevinbwrightgmu/metacode/blob/main/ai-lab/providers.js"
click node_accounts "https://github.com/kevinbwrightgmu/metacode/blob/main/accounts/index.js"
click node_server "https://github.com/kevinbwrightgmu/metacode/blob/main/server.js"

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_coding_app,node_data_import,node_codebook,node_ai_coding,node_human_coding,node_reliability,node_network_analysis,node_metrics,node_exports,node_projects,node_assistant toneBlue
class node_scraper_ui,node_scraper_api,node_job_manager,node_reddit_collection,node_platform_collection,node_network_transport,node_ai_collector,node_collector_store toneAmber
class node_survey_studio,node_survey_api,node_survey_store toneMint
class node_lab_ui,node_lab_api,node_lab_profiles,node_lab_providers toneRose
class node_accounts,node_server,node_researcher toneIndigo
```

## Components

### Research and coding

- [Coding app](https://github.com/kevinbwrightgmu/metacode/blob/main/public/js/app.js): `public/js/app.js`
- [Data import](https://github.com/kevinbwrightgmu/metacode/blob/main/public/js/data.js): `public/js/data.js`
- [Codebook builder](https://github.com/kevinbwrightgmu/metacode/blob/main/public/js/codebook.js): `public/js/codebook.js`
- [AI auto-coding](https://github.com/kevinbwrightgmu/metacode/blob/main/server.js): `server.js`
- [Human coding](https://github.com/kevinbwrightgmu/metacode/blob/main/public/js/human-coding.js): `public/js/human-coding.js`
- [Reliability analysis](https://github.com/kevinbwrightgmu/metacode/blob/main/public/js/reliability.js): `public/js/reliability.js`
- [Network analysis](https://github.com/kevinbwrightgmu/metacode/blob/main/python/network_analysis.py): `python/network_analysis.py`
- [Metrics](https://github.com/kevinbwrightgmu/metacode/blob/main/public/js/engagement.js): `public/js/engagement.js`
- [Research exports](https://github.com/kevinbwrightgmu/metacode/blob/main/public/js/data.js): `public/js/data.js`
- [Projects](https://github.com/kevinbwrightgmu/metacode/blob/main/projects/index.js): `projects/index.js`
- [MetaCode assistant](https://github.com/kevinbwrightgmu/metacode/blob/main/public/js/assistant.js): `public/js/assistant.js`

### Data collection

- [Scraper interface](https://github.com/kevinbwrightgmu/metacode/blob/main/public/js/scraper.js): `public/js/scraper.js`
- [Scraper jobs and API](https://github.com/kevinbwrightgmu/metacode/blob/main/scraper/index.js): `scraper/index.js`
- [Job manager](https://github.com/kevinbwrightgmu/metacode/blob/main/scraper/jobs/job-manager.js): `scraper/jobs/job-manager.js`
- [Reddit collection](https://github.com/kevinbwrightgmu/metacode/blob/main/scraper/reddit/standard-scraper.js): `scraper/reddit/standard-scraper.js`
- [YouTube and X](https://github.com/kevinbwrightgmu/metacode/blob/main/scraper/platforms/index.js): `scraper/platforms/index.js`
- [Scraper transport](https://github.com/kevinbwrightgmu/metacode/blob/main/scraper/network/network-manager.js): `scraper/network/network-manager.js`
- [AI Scraper collector](https://github.com/kevinbwrightgmu/metacode/blob/main/collector/src/ui/App.tsx): `collector/src/ui/App.tsx`
- [Collector browser store](https://github.com/kevinbwrightgmu/metacode/blob/main/collector/src/store/db.ts): `collector/src/store/db.ts`

### Survey Studio

- [Survey editor](https://github.com/kevinbwrightgmu/metacode/blob/main/public/js/survey/survey-studio.js): `public/js/survey/survey-studio.js`
- [Survey API](https://github.com/kevinbwrightgmu/metacode/blob/main/surveys/index.js): `surveys/index.js`
- [Survey persistence](https://github.com/kevinbwrightgmu/metacode/blob/main/surveys/store.js): `surveys/store.js`

### AI Coding Lab

- [AI Lab workbench](https://github.com/kevinbwrightgmu/metacode/blob/main/public/js/ai-lab/lab-workbench.js): `public/js/ai-lab/lab-workbench.js`
- [AI Lab API](https://github.com/kevinbwrightgmu/metacode/blob/main/ai-lab/index.js): `ai-lab/index.js`
- [Coding profiles](https://github.com/kevinbwrightgmu/metacode/blob/main/ai-lab/profiles.js): `ai-lab/profiles.js`
- [Model providers](https://github.com/kevinbwrightgmu/metacode/blob/main/ai-lab/providers.js): `ai-lab/providers.js`

### Server and accounts

- [Accounts and plans](https://github.com/kevinbwrightgmu/metacode/blob/main/accounts/index.js): `accounts/index.js`
- [Application server](https://github.com/kevinbwrightgmu/metacode/blob/main/server.js): `server.js`

### Other components

- **Researcher**

## Connections

- Researcher → Coding app: opens
- Researcher → Scraper interface: collects with
- Researcher → Survey editor: builds surveys
- Coding app → Data import: imports data
- Coding app → Codebook builder: defines codes
- Coding app → AI auto-coding: requests coding
- Coding app → Human coding: supports coding
- Human coding → Reliability analysis: compares coders
- Coding app → Network analysis: analyzes CSV
- Coding app → Metrics: shows metrics
- Coding app → Research exports: exports results
- Coding app → Projects: saves projects
- Coding app → MetaCode assistant: asks for help
- Scraper interface → Scraper jobs and API: starts jobs (evidence: `scraper/index.js`)
- Scraper jobs and API → Job manager: manages jobs (evidence: `scraper/index.js`)
- Job manager → Reddit collection: runs scraper (evidence: `scraper/jobs/job-manager.js`)
- Job manager → YouTube and X: runs platform job (evidence: `scraper/platforms/index.js`)
- Reddit collection → Scraper transport: sends requests (evidence: `scraper/network/network-manager.js`)
- Scraper interface → Coding app: adds posts
- Researcher → AI Scraper collector: describes posts
- AI Scraper collector → Collector browser store: stores records (evidence: `collector/src/ui/App.tsx`)
- AI Scraper collector → Coding app: adds collected posts
- Researcher → Survey editor: designs survey
- Survey editor → Survey API: publishes survey (evidence: `surveys/index.js`)
- Survey API → Survey persistence: reads and writes (evidence: `surveys/index.js`)
- Survey API → Coding app: sends text answers
- Researcher → AI Lab workbench: uses workbench
- AI Lab workbench → AI Lab API: calls API
- AI Lab API → Coding profiles: uses profiles (evidence: `ai-lab/index.js`)
- AI Lab API → Model providers: queries providers (evidence: `ai-lab/index.js`)
- Application server → Scraper jobs and API: mounts routes (evidence: `server.js`)
- Application server → Survey API: mounts routes (evidence: `server.js`)
- Application server → AI Lab API: mounts routes (evidence: `server.js`)
- Application server → Accounts and plans: mounts routes (evidence: `server.js`)
- Accounts and plans → Scraper jobs and API: applies policy (evidence: `accounts/index.js`)
