# smhaider-zaidi/chemcurious architecture

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

- Interactive diagram: https://gitdiagram.com/smhaider-zaidi/chemcurious
- Repository: https://github.com/smhaider-zaidi/chemcurious

## Overview

ChemCurious is a chemistry learning platform: learners explore molecular structures, elements and reactions, take quizzes, and review performance; administrators manage users and educational content. The graph shows the documented learning capabilities and the source-index-supported routes into sampled components and storage. Evidence is limited to the README, indexed references and excerpts; unsampled implementation details and several runtime links are intentionally not inferred.

Main entry points: [`lib/db.ts`](https://github.com/smhaider-zaidi/chemcurious/blob/main/lib/db.ts) (Chemistry database), [`app/api/admin/users/route.ts`](https://github.com/smhaider-zaidi/chemcurious/blob/main/app/api/admin/users/route.ts) (User administration API), [`app/api/molecules/route.ts`](https://github.com/smhaider-zaidi/chemcurious/blob/main/app/api/molecules/route.ts) (Molecule API), [`app/api/molecules/[name]/route.ts`](https://github.com/smhaider-zaidi/chemcurious/blob/main/app/api/molecules/%5Bname%5D/route.ts) (Molecule detail API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_learning["Learning experience"]
  node_molecule_page["Molecule explorer<br/>[page.tsx]"]
  node_periodic_page["Periodic table page<br/>[page.tsx]"]
  node_reactions_page["Reaction explorer<br/>[page.tsx]"]
  node_quiz_page["Quiz entry<br/>[page.tsx]"]
  node_quiz_engine["Quiz interface<br/>[quiz-system.tsx]"]
  node_quiz_api["Quiz catalog API<br/>[route.ts]"]
  node_attempt_api["Quiz attempt API<br/>[route.ts]"]
  node_submit_api["Quiz submission API<br/>[route.ts]"]
end

subgraph group_chemistry["Chemistry content"]
  node_molecule_viewer["3D molecule viewer"]
  node_molecule_api["Molecule API<br/>[route.ts]"]
  node_molecule_detail_api["Molecule detail API<br/>[route.ts]"]
  node_pubchem["PubChem lookup<br/>[pubchem.ts]"]
  node_periodic_table["Periodic table engine<br/>[periodic-table.tsx]"]
  node_reaction_api["Reaction API<br/>[route.ts]"]
end

subgraph group_platform["Accounts and progress"]
  node_dashboard["Student dashboard<br/>[page.tsx]"]
  node_auth_context["Session context<br/>[auth-context.tsx]"]
  node_auth_api["Authentication routes<br/>[route.ts]"]
  node_database[("Chemistry database<br/>[db.ts]")]
end

subgraph group_admin["Administration"]
  node_admin_users["User management<br/>[page.tsx]"]
  node_admin_users_api["User administration API<br/>[route.ts]"]
  node_admin_analytics["Quiz analytics API<br/>[route.ts]"]
  node_admin_guard["Admin authorization<br/>[admin-guard.ts]"]
end

node_learner(("Learner"))

node_learner -->|"explores molecules"| node_molecule_page
node_molecule_page -->|"renders structures"| node_molecule_viewer
node_molecule_api -->|"reads molecules"| node_database
node_molecule_detail_api -->|"reads molecule"| node_database
node_molecule_api -->|"looks up data"| node_pubchem
node_molecule_detail_api -->|"looks up data"| node_pubchem
node_learner -->|"inspects elements"| node_periodic_page
node_periodic_page -->|"renders table"| node_periodic_table
node_learner -->|"explores reactions"| node_reactions_page
node_reaction_api -->|"reads reactions"| node_database
node_learner -->|"takes quizzes"| node_quiz_page
node_quiz_page -->|"renders quiz"| node_quiz_engine
node_quiz_api -->|"reads quizzes"| node_database
node_learner -->|"reviews progress"| node_dashboard
node_dashboard -->|"checks session"| node_auth_context
node_auth_context -->|"authenticates"| node_auth_api
node_admin_users -.->|"manages accounts"| node_admin_users_api
node_admin_users_api -->|"checks access"| node_admin_guard
node_admin_users_api -->|"reads users"| node_database
node_admin_analytics -->|"checks access"| node_admin_guard
node_admin_analytics -->|"queries analytics"| node_database

click node_molecule_page "https://github.com/smhaider-zaidi/chemcurious/blob/main/app/molecules/page.tsx"
click node_molecule_viewer "https://github.com/smhaider-zaidi/chemcurious/blob/main/components/molecular-viewer.tsx"
click node_molecule_api "https://github.com/smhaider-zaidi/chemcurious/blob/main/app/api/molecules/route.ts"
click node_molecule_detail_api "https://github.com/smhaider-zaidi/chemcurious/blob/main/app/api/molecules/%5Bname%5D/route.ts"
click node_pubchem "https://github.com/smhaider-zaidi/chemcurious/blob/main/lib/pubchem.ts"
click node_periodic_page "https://github.com/smhaider-zaidi/chemcurious/blob/main/app/periodic/page.tsx"
click node_periodic_table "https://github.com/smhaider-zaidi/chemcurious/blob/main/components/periodic-table.tsx"
click node_reactions_page "https://github.com/smhaider-zaidi/chemcurious/blob/main/app/reactions/page.tsx"
click node_reaction_api "https://github.com/smhaider-zaidi/chemcurious/blob/main/app/api/reactions/route.ts"
click node_quiz_page "https://github.com/smhaider-zaidi/chemcurious/blob/main/app/quizzes/page.tsx"
click node_quiz_engine "https://github.com/smhaider-zaidi/chemcurious/blob/main/components/quiz-system.tsx"
click node_quiz_api "https://github.com/smhaider-zaidi/chemcurious/blob/main/app/api/quizzes/route.ts"
click node_attempt_api "https://github.com/smhaider-zaidi/chemcurious/blob/main/app/api/quizzes/attempts/route.ts"
click node_submit_api "https://github.com/smhaider-zaidi/chemcurious/blob/main/app/api/quizzes/submit/route.ts"
click node_dashboard "https://github.com/smhaider-zaidi/chemcurious/blob/main/app/dashboard/page.tsx"
click node_auth_context "https://github.com/smhaider-zaidi/chemcurious/blob/main/contexts/auth-context.tsx"
click node_auth_api "https://github.com/smhaider-zaidi/chemcurious/blob/main/app/api/auth/login/route.ts"
click node_database "https://github.com/smhaider-zaidi/chemcurious/blob/main/lib/db.ts"
click node_admin_users "https://github.com/smhaider-zaidi/chemcurious/blob/main/app/admin/users/page.tsx"
click node_admin_users_api "https://github.com/smhaider-zaidi/chemcurious/blob/main/app/api/admin/users/route.ts"
click node_admin_analytics "https://github.com/smhaider-zaidi/chemcurious/blob/main/app/api/admin/analytics/quizzes/route.ts"
click node_admin_guard "https://github.com/smhaider-zaidi/chemcurious/blob/main/lib/admin-guard.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_molecule_page,node_periodic_page,node_reactions_page,node_quiz_page,node_quiz_engine,node_quiz_api,node_attempt_api,node_submit_api toneBlue
class node_molecule_viewer,node_molecule_api,node_molecule_detail_api,node_pubchem,node_periodic_table,node_reaction_api toneAmber
class node_dashboard,node_auth_context,node_auth_api,node_database toneMint
class node_admin_users,node_admin_users_api,node_admin_analytics,node_admin_guard toneRose
class node_learner toneIndigo
```

## Components

### Learning experience

- [Molecule explorer](https://github.com/smhaider-zaidi/chemcurious/blob/main/app/molecules/page.tsx): `app/molecules/page.tsx`
- [Periodic table page](https://github.com/smhaider-zaidi/chemcurious/blob/main/app/periodic/page.tsx): `app/periodic/page.tsx`
- [Reaction explorer](https://github.com/smhaider-zaidi/chemcurious/blob/main/app/reactions/page.tsx): `app/reactions/page.tsx`
- [Quiz entry](https://github.com/smhaider-zaidi/chemcurious/blob/main/app/quizzes/page.tsx): `app/quizzes/page.tsx`
- [Quiz interface](https://github.com/smhaider-zaidi/chemcurious/blob/main/components/quiz-system.tsx): `components/quiz-system.tsx`
- [Quiz catalog API](https://github.com/smhaider-zaidi/chemcurious/blob/main/app/api/quizzes/route.ts): `app/api/quizzes/route.ts`
- [Quiz attempt API](https://github.com/smhaider-zaidi/chemcurious/blob/main/app/api/quizzes/attempts/route.ts): `app/api/quizzes/attempts/route.ts`
- [Quiz submission API](https://github.com/smhaider-zaidi/chemcurious/blob/main/app/api/quizzes/submit/route.ts): `app/api/quizzes/submit/route.ts`

### Chemistry content

- [3D molecule viewer](https://github.com/smhaider-zaidi/chemcurious/blob/main/components/molecular-viewer.tsx): `components/molecular-viewer.tsx`
- [Molecule API](https://github.com/smhaider-zaidi/chemcurious/blob/main/app/api/molecules/route.ts): `app/api/molecules/route.ts`
- [Molecule detail API](https://github.com/smhaider-zaidi/chemcurious/blob/main/app/api/molecules/%5Bname%5D/route.ts): `app/api/molecules/[name]/route.ts`
- [PubChem lookup](https://github.com/smhaider-zaidi/chemcurious/blob/main/lib/pubchem.ts): `lib/pubchem.ts`
- [Periodic table engine](https://github.com/smhaider-zaidi/chemcurious/blob/main/components/periodic-table.tsx): `components/periodic-table.tsx`
- [Reaction API](https://github.com/smhaider-zaidi/chemcurious/blob/main/app/api/reactions/route.ts): `app/api/reactions/route.ts`

### Accounts and progress

- [Student dashboard](https://github.com/smhaider-zaidi/chemcurious/blob/main/app/dashboard/page.tsx): `app/dashboard/page.tsx`
- [Session context](https://github.com/smhaider-zaidi/chemcurious/blob/main/contexts/auth-context.tsx): `contexts/auth-context.tsx`
- [Authentication routes](https://github.com/smhaider-zaidi/chemcurious/blob/main/app/api/auth/login/route.ts): `app/api/auth/login/route.ts`
- [Chemistry database](https://github.com/smhaider-zaidi/chemcurious/blob/main/lib/db.ts): `lib/db.ts`

### Administration

- [User management](https://github.com/smhaider-zaidi/chemcurious/blob/main/app/admin/users/page.tsx): `app/admin/users/page.tsx`
- [User administration API](https://github.com/smhaider-zaidi/chemcurious/blob/main/app/api/admin/users/route.ts): `app/api/admin/users/route.ts`
- [Quiz analytics API](https://github.com/smhaider-zaidi/chemcurious/blob/main/app/api/admin/analytics/quizzes/route.ts): `app/api/admin/analytics/quizzes/route.ts`
- [Admin authorization](https://github.com/smhaider-zaidi/chemcurious/blob/main/lib/admin-guard.ts): `lib/admin-guard.ts`

### Other components

- **Learner**

## Connections

- Learner → Molecule explorer: explores molecules
- Molecule explorer → 3D molecule viewer: renders structures (evidence: `app/molecules/page.tsx`)
- Molecule API → Chemistry database: reads molecules (evidence: `app/api/molecules/route.ts`)
- Molecule detail API → Chemistry database: reads molecule (evidence: `app/api/molecules/[name]/route.ts`)
- Molecule API → PubChem lookup: looks up data (evidence: `app/api/molecules/route.ts`)
- Molecule detail API → PubChem lookup: looks up data (evidence: `app/api/molecules/[name]/route.ts`)
- Learner → Periodic table page: inspects elements
- Periodic table page → Periodic table engine: renders table (evidence: `app/periodic/page.tsx`)
- Learner → Reaction explorer: explores reactions
- Reaction API → Chemistry database: reads reactions (evidence: `app/api/reactions/route.ts`)
- Learner → Quiz entry: takes quizzes
- Quiz entry → Quiz interface: renders quiz (evidence: `app/quizzes/page.tsx`)
- Quiz catalog API → Chemistry database: reads quizzes (evidence: `app/api/quizzes/route.ts`)
- Learner → Student dashboard: reviews progress
- Student dashboard → Session context: checks session (evidence: `app/dashboard/page.tsx`)
- Session context → Authentication routes: authenticates (evidence: `contexts/auth-context.tsx`)
- User management → User administration API: manages accounts
- User administration API → Admin authorization: checks access (evidence: `app/api/admin/users/route.ts`)
- User administration API → Chemistry database: reads users (evidence: `app/api/admin/users/route.ts`)
- Quiz analytics API → Admin authorization: checks access (evidence: `app/api/admin/analytics/quizzes/route.ts`)
- Quiz analytics API → Chemistry database: queries analytics (evidence: `app/api/admin/analytics/quizzes/route.ts`)
