# ahamedamansoor/coder-pod architecture

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

- Interactive diagram: https://gitdiagram.com/ahamedamansoor/coder-pod
- Repository: https://github.com/ahamedamansoor/coder-pod

## Overview

#### Purpose and runtime
This is a Next.js/TypeScript learning platform with tutorial topics, roadmaps, cheatsheets, interview preparation, notes, completion tracking, collaborative interviews, and AI-assisted tools. The App Router is the main delivery surface; the root UI begins at `src/app/layout.tsx` and `src/app/page.tsx`, with app-wide client providers in `src/app/providers.tsx`.

#### Route and UI composition
Route segments organize major product areas: language learning under `src/app/languages`, dashboard functions in `src/app/dashboard/page.tsx`, and preparation content in `src/app/prepare/page.tsx`. Dynamic `[topic]` routes pair language-specific layouts/contexts with reusable content-display components, for example `src/app/languages/javascript/[topic]/page.tsx`, `src/app/languages/javascript/javascript-context.tsx`, and `src/components/languages/javascript/javascript-content-display.tsx`.

#### Curriculum content model
Curriculum is predominantly repository-managed static TypeScript/TSX content. Language metadata and navigation structures live in `src/data/languages/index.ts` and individual language files such as `src/data/languages/react.ts`; roadmaps are similarly data-driven in `src/data/roadmaps/index.ts`. Renderable detailed lessons are distributed by subject under `src/components/languages/*/topics`, e.g. `src/components/languages/react/topics/index.ts`.

#### Shared learning experience
Generic UI layers provide topic navigation, learning-path/roadmap presentation, code snippets, playgrounds, modals, and media features. These abstractions separate course shell behavior from subject-specific content: `src/components/shared/generic-content-display.tsx`, `src/components/shared/learning/generic-learning-roadmap.tsx`, and `src/components/shared/playground/code-editor-sheet.tsx`.

#### User state, authentication, and persistence
Supabase is the evident identity and persistence boundary. Authentication is represented by `src/contexts/SupabaseAuthContext.tsx` and `src/lib/supabase.ts`; auth callback handling enters through `src/app/auth/callback/route.ts`. Completion, notes, and user data use service-layer adapters, including `src/services/unified-completion.service.ts`, `src/services/supabase-notes.service.ts`, and `src/services/supabase-user.service.ts`. SQL migrations define at least notes and interview-session persistence in `supabase-migrations/create_notes_table.sql` and `supabase-migrations/create_interview_sessions.sql`.

#### AI and interactive-service boundary
AI capabilities are isolated in Genkit-oriented flows under `src/ai`, covering Q&A, learning generation, interview simulation, simplification, text-to-speech, code compilation/transpilation, and API-key validation. Key orchestration points are `src/ai/genkit.ts`, `src/ai/flows/interview-flow.ts`, and `src/ai/flows/generate-learning-content.ts`. HTTP boundaries expose selected actions through App Router handlers such as `src/app/api/interview/route.ts` and `src/app/api/validate-ai-key/route.ts`; Gemini-key UI/hooks indicate user-provided AI credentials (`src/hooks/use-gemini-key.ts`).

#### Collaboration, offline delivery, and deployment
Collaborative interview sessions have a feature/service boundary in `src/components/shared/collaborative-interview.tsx`, `src/services/collaborative-session.service.ts`, and `src/app/collaborative-interview/[roomCode]/page.tsx`. The browser client includes service-worker assets for offline/PWA behavior in `public/register-sw.js` and `public/sw.js`. Hosting automation targets Firebase through `.github/workflows/firebase-hosting-merge.yml` and `.github/workflows/firebase-hosting-pull-request.yml`; a separate `deploy-vercel.sh` indicates an additional deployment path.

Main entry points: [`src/app/layout.tsx`](https://github.com/ahamedamansoor/coder-pod/blob/main/src/app/layout.tsx) (App shell), [`src/lib/supabase.ts`](https://github.com/ahamedamansoor/coder-pod/blob/main/src/lib/supabase.ts) (Supabase), [`src/app/languages`](https://github.com/ahamedamansoor/coder-pod/tree/main/src/app/languages) (Product routes), [`src/app/languages/javascript/[topic]/page.tsx`](https://github.com/ahamedamansoor/coder-pod/blob/main/src/app/languages/javascript/%5Btopic%5D/page.tsx) (Dynamic topic route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Next.js application"]
  node_root["App shell<br/>Next.js App Router<br/>[layout.tsx]"]
  node_routes["Product routes<br/>route segments"]
  node_topic_route["Dynamic topic route<br/>language route<br/>[page.tsx]"]
  node_language_context["Language context<br/>React context"]
  node_content_display["Language content display<br/>subject UI"]
  node_shared_learning_ui["Shared learning UI<br/>reusable components"]
  node_collab_route["Interview room route<br/>dynamic route<br/>[page.tsx]"]
  node_offline["Offline delivery<br/>service worker<br/>[register-sw.js]"]
end

subgraph group_content["Curriculum content"]
  node_language_catalog["Language catalog<br/>static TypeScript data<br/>[index.ts]"]
  node_language_lessons["Subject lessons<br/>TSX topic content<br/>[index.ts]"]
  node_roadmap_data["Roadmap catalog<br/>static TypeScript data<br/>[index.ts]"]
end

subgraph group_services["User and AI services"]
  node_auth["Supabase auth<br/>identity context"]
  node_auth_callback["Auth callback<br/>route handler<br/>[route.ts]"]
  node_user_services["Learning state services<br/>Supabase adapters"]
  node_supabase[("Supabase<br/>auth and persistence<br/>[supabase.ts]")]
  node_migrations["Database schema<br/>SQL migrations"]
  node_ai_api["AI HTTP API<br/>App Router handlers<br/>[route.ts]"]
  node_genkit{{"Genkit orchestration<br/>AI flows<br/>[genkit.ts]"}}
  node_gemini_key["Gemini key hook<br/>client credential state<br/>[use-gemini-key.ts]"]
  node_collaboration["Collaborative interviews<br/>feature and session service"]
end

node_deployment["Deployment automation<br/>Firebase workflow"]

node_root -->|"serves"| node_routes
node_routes -->|"includes"| node_topic_route
node_topic_route -->|"uses"| node_language_context
node_topic_route -->|"renders"| node_content_display
node_content_display -->|"builds on"| node_shared_learning_ui
node_content_display -->|"renders"| node_language_lessons
node_routes -->|"reads navigation"| node_language_catalog
node_shared_learning_ui -->|"presents"| node_roadmap_data
node_root -->|"provides"| node_auth
node_auth_callback -->|"completes session with"| node_supabase
node_auth -->|"uses"| node_supabase
node_user_services -->|"persists through"| node_supabase
node_migrations -.->|"defines schema for"| node_supabase
node_ai_api -->|"invokes"| node_genkit
node_gemini_key -->|"supplies credentials to"| node_ai_api
node_collab_route -->|"hosts"| node_collaboration
node_collaboration -->|"stores session state via"| node_user_services
node_root -->|"registers"| node_offline
node_deployment -.->|"deploys"| node_root

click node_root "https://github.com/ahamedamansoor/coder-pod/blob/main/src/app/layout.tsx"
click node_routes "https://github.com/ahamedamansoor/coder-pod/tree/main/src/app/languages"
click node_topic_route "https://github.com/ahamedamansoor/coder-pod/blob/main/src/app/languages/javascript/%5Btopic%5D/page.tsx"
click node_language_context "https://github.com/ahamedamansoor/coder-pod/blob/main/src/app/languages/javascript/javascript-context.tsx"
click node_content_display "https://github.com/ahamedamansoor/coder-pod/blob/main/src/components/languages/javascript/javascript-content-display.tsx"
click node_shared_learning_ui "https://github.com/ahamedamansoor/coder-pod/blob/main/src/components/shared/generic-content-display.tsx"
click node_language_catalog "https://github.com/ahamedamansoor/coder-pod/blob/main/src/data/languages/index.ts"
click node_language_lessons "https://github.com/ahamedamansoor/coder-pod/blob/main/src/components/languages/react/topics/index.ts"
click node_roadmap_data "https://github.com/ahamedamansoor/coder-pod/blob/main/src/data/roadmaps/index.ts"
click node_auth "https://github.com/ahamedamansoor/coder-pod/blob/main/src/contexts/SupabaseAuthContext.tsx"
click node_auth_callback "https://github.com/ahamedamansoor/coder-pod/blob/main/src/app/auth/callback/route.ts"
click node_user_services "https://github.com/ahamedamansoor/coder-pod/blob/main/src/services/unified-completion.service.ts"
click node_supabase "https://github.com/ahamedamansoor/coder-pod/blob/main/src/lib/supabase.ts"
click node_migrations "https://github.com/ahamedamansoor/coder-pod/blob/main/supabase-migrations/create_notes_table.sql"
click node_ai_api "https://github.com/ahamedamansoor/coder-pod/blob/main/src/app/api/interview/route.ts"
click node_genkit "https://github.com/ahamedamansoor/coder-pod/blob/main/src/ai/genkit.ts"
click node_gemini_key "https://github.com/ahamedamansoor/coder-pod/blob/main/src/hooks/use-gemini-key.ts"
click node_collaboration "https://github.com/ahamedamansoor/coder-pod/blob/main/src/components/shared/collaborative-interview.tsx"
click node_collab_route "https://github.com/ahamedamansoor/coder-pod/blob/main/src/app/collaborative-interview/%5BroomCode%5D/page.tsx"
click node_offline "https://github.com/ahamedamansoor/coder-pod/blob/main/public/register-sw.js"
click node_deployment "https://github.com/ahamedamansoor/coder-pod/blob/main/.github/workflows/firebase-hosting-merge.yml"

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_root,node_routes,node_topic_route,node_language_context,node_content_display,node_shared_learning_ui,node_collab_route,node_offline toneBlue
class node_language_catalog,node_language_lessons,node_roadmap_data toneAmber
class node_auth,node_auth_callback,node_user_services,node_supabase,node_migrations,node_ai_api,node_genkit,node_gemini_key,node_collaboration toneMint
class node_deployment toneNeutral
```

## Components

### Next.js application

- [App shell](https://github.com/ahamedamansoor/coder-pod/blob/main/src/app/layout.tsx): Next.js App Router · Root layout, landing page, and client providers. · `src/app/layout.tsx`
- [Product routes](https://github.com/ahamedamansoor/coder-pod/tree/main/src/app/languages): route segments · Languages, dashboard, and preparation surfaces. · `src/app/languages`
- [Dynamic topic route](https://github.com/ahamedamansoor/coder-pod/blob/main/src/app/languages/javascript/%5Btopic%5D/page.tsx): language route · Composes language context with topic content. · `src/app/languages/javascript/[topic]/page.tsx`
- [Language context](https://github.com/ahamedamansoor/coder-pod/blob/main/src/app/languages/javascript/javascript-context.tsx): React context · `src/app/languages/javascript/javascript-context.tsx`
- [Language content display](https://github.com/ahamedamansoor/coder-pod/blob/main/src/components/languages/javascript/javascript-content-display.tsx): subject UI · `src/components/languages/javascript/javascript-content-display.tsx`
- [Shared learning UI](https://github.com/ahamedamansoor/coder-pod/blob/main/src/components/shared/generic-content-display.tsx): reusable components · Generic content, roadmaps, and code playgrounds. · `src/components/shared/generic-content-display.tsx`
- [Interview room route](https://github.com/ahamedamansoor/coder-pod/blob/main/src/app/collaborative-interview/%5BroomCode%5D/page.tsx): dynamic route · `src/app/collaborative-interview/[roomCode]/page.tsx`
- [Offline delivery](https://github.com/ahamedamansoor/coder-pod/blob/main/public/register-sw.js): service worker · PWA registration and caching. · `public/register-sw.js`

### Curriculum content

- [Language catalog](https://github.com/ahamedamansoor/coder-pod/blob/main/src/data/languages/index.ts): static TypeScript data · Language metadata and navigation. · `src/data/languages/index.ts`
- [Subject lessons](https://github.com/ahamedamansoor/coder-pod/blob/main/src/components/languages/react/topics/index.ts): TSX topic content · Detailed renderable lesson modules. · `src/components/languages/react/topics/index.ts`
- [Roadmap catalog](https://github.com/ahamedamansoor/coder-pod/blob/main/src/data/roadmaps/index.ts): static TypeScript data · `src/data/roadmaps/index.ts`

### User and AI services

- [Supabase auth](https://github.com/ahamedamansoor/coder-pod/blob/main/src/contexts/SupabaseAuthContext.tsx): identity context · Client authentication and session state. · `src/contexts/SupabaseAuthContext.tsx`
- [Auth callback](https://github.com/ahamedamansoor/coder-pod/blob/main/src/app/auth/callback/route.ts): route handler · `src/app/auth/callback/route.ts`
- [Learning state services](https://github.com/ahamedamansoor/coder-pod/blob/main/src/services/unified-completion.service.ts): Supabase adapters · Completion, notes, and user-data persistence. · `src/services/unified-completion.service.ts`
- [Supabase](https://github.com/ahamedamansoor/coder-pod/blob/main/src/lib/supabase.ts): auth and persistence · External identity and database boundary. · `src/lib/supabase.ts`
- [Database schema](https://github.com/ahamedamansoor/coder-pod/blob/main/supabase-migrations/create_notes_table.sql): SQL migrations · Defines notes and interview-session storage. · `supabase-migrations/create_notes_table.sql`
- [AI HTTP API](https://github.com/ahamedamansoor/coder-pod/blob/main/src/app/api/interview/route.ts): App Router handlers · Exposes interview and AI-key actions. · `src/app/api/interview/route.ts`
- [Genkit orchestration](https://github.com/ahamedamansoor/coder-pod/blob/main/src/ai/genkit.ts): AI flows · Interview and generated-learning workflows. · `src/ai/genkit.ts`
- [Gemini key hook](https://github.com/ahamedamansoor/coder-pod/blob/main/src/hooks/use-gemini-key.ts): client credential state · Supports user-provided AI credentials. · `src/hooks/use-gemini-key.ts`
- [Collaborative interviews](https://github.com/ahamedamansoor/coder-pod/blob/main/src/components/shared/collaborative-interview.tsx): feature and session service · Room-based interview sessions. · `src/components/shared/collaborative-interview.tsx`

### Other components

- [Deployment automation](https://github.com/ahamedamansoor/coder-pod/blob/main/.github/workflows/firebase-hosting-merge.yml): Firebase workflow · Firebase hosting deployment path. · `.github/workflows/firebase-hosting-merge.yml`

## Connections

- App shell → Product routes: serves
- Product routes → Dynamic topic route: includes
- Dynamic topic route → Language context: uses
- Dynamic topic route → Language content display: renders
- Language content display → Shared learning UI: builds on
- Language content display → Subject lessons: renders
- Product routes → Language catalog: reads navigation
- Shared learning UI → Roadmap catalog: presents
- App shell → Supabase auth: provides
- Auth callback → Supabase: completes session with
- Supabase auth → Supabase: uses
- Learning state services → Supabase: persists through
- Database schema → Supabase: defines schema for
- AI HTTP API → Genkit orchestration: invokes
- Gemini key hook → AI HTTP API: supplies credentials to
- Interview room route → Collaborative interviews: hosts
- Collaborative interviews → Learning state services: stores session state via
- App shell → Offline delivery: registers
- Deployment automation → App shell: deploys
