# sinha004/transcript-editor architecture

> Architecture diagram of the GitHub repository sinha004/transcript-editor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sinha004/transcript-editor
- Repository: https://github.com/sinha004/transcript-editor

## Overview

##### Project type and purpose
- Type: Next.js 13+ web application (React-based App Router) used as a front-end transcript editor.
- Purpose: Display a transcript where each word carries timing metadata, allow sequential playback with real-time highlighting, and enable inline word editing (no deletions).

##### File structure
- Root configs: next.config.mjs, jsconfig.json, postcss.config.mjs, tailwind.config.js → control Next.js build, module resolution, PostCSS, and Tailwind CSS.
- package.json / lock file → React, Next.js, Tailwind, etc.
- src/app/
– layout.js → global layout wrapper (fonts, global styles).
– page.js → the transcript page component (renders words, Play button, handles state).
– globals.css & fonts/ → global styling and font assets via next/font.
- src/components/ui/ → reusable UI primitives (Button, Input, Popover).
- src/lib/utils.js → playback scheduler and timing helper functions.
- components.json → likely sample transcript data at build or runtime.

##### Key architectural patterns & principles
- Component-based design (React functional components under src/components).
- Separation of concerns: UI primitives, page composition, and business logic (utils.js).
- Next.js App Router structure: layout.js for shared wrappers, page.js for route.
- Utility-first styling (Tailwind CSS).
- Static vs dynamic data handling (SSG/CSR).

##### Detail orientation
- Drill into sub-components: layout.js vs page.js vs each UI control.
- Timing engine in utils.js as a separate sub-module.
- Separate CSS pipeline (PostCSS/Tailwind) from component styling.
- Future hooks for audio controls or multi-transcript loading.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Build & Deployment Layer
    subgraph "Build & Deployment"
        direction TB
        NConf["Next.js Build (Webpack/TurboPack)"]:::build
        JSC["Module Resolution (jsconfig.json)"]:::build
        PCP["PostCSS Pipeline (postcss.config.mjs)"]:::build
        TWC["Tailwind CSS Config (tailwind.config.js)"]:::build
        Fonts["Font Assets (src/app/fonts/)"]:::build
        GlobalsCSS["Global Stylesheet (src/app/globals.css)"]:::build
        Deployed["Deployed Bundles"]:::build
    end

    Deployed --> CDN["CDN / Vercel"]:::external

    %% Server Runtime Layer
    subgraph "Server Runtime"
        direction TB
        Layout["App Layout Wrapper\n(src/app/layout.js)"]:::server
        PageServer["Next.js App Router\n(page.js)"]:::server
    end

    CDN --> Layout
    Layout --> PageServer
    PageServer --> Deployed

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        componentsJSON[(components.json)]:::data
    end

    PageServer -->|serves JSON| componentsJSON

    %% Client UI Layer
    subgraph "Client UI (Browser)"
        direction TB
        PageUI["Transcript Page\n(src/app/page.js)"]:::ui
        Button["Button UI Primitive\n(src/components/ui/button.jsx)"]:::ui
        Input["Input UI Primitive\n(src/components/ui/input.jsx)"]:::ui
        Popover["Popover UI Primitive\n(src/components/ui/popover.jsx)"]:::ui
    end

    componentsJSON --> PageUI
    PageServer --> PageUI
    PageUI --> Button
    PageUI --> Input
    PageUI --> Popover

    %% Business Logic Layer
    subgraph "Business Logic"
        direction TB
        Utils["Playback Scheduler & Timing Helpers\n(src/lib/utils.js)"]:::util
    end

    PageUI -->|calls scheduler| Utils
    Utils -->|triggers highlights| PageUI

    %% Click Events
    click NConf "https://github.com/sinha004/transcript-editor/blob/main/next.config.mjs"
    click JSC "https://github.com/sinha004/transcript-editor/blob/main/jsconfig.json"
    click PCP "https://github.com/sinha004/transcript-editor/blob/main/postcss.config.mjs"
    click TWC "https://github.com/sinha004/transcript-editor/blob/main/tailwind.config.js"
    click Fonts "https://github.com/sinha004/transcript-editor/tree/main/src/app/fonts/"
    click GlobalsCSS "https://github.com/sinha004/transcript-editor/blob/main/src/app/globals.css"
    click Layout "https://github.com/sinha004/transcript-editor/blob/main/src/app/layout.js"
    click PageServer "https://github.com/sinha004/transcript-editor/blob/main/src/app/page.js"
    click componentsJSON "https://github.com/sinha004/transcript-editor/blob/main/components.json"
    click PageUI "https://github.com/sinha004/transcript-editor/blob/main/src/app/page.js"
    click Button "https://github.com/sinha004/transcript-editor/blob/main/src/components/ui/button.jsx"
    click Input "https://github.com/sinha004/transcript-editor/blob/main/src/components/ui/input.jsx"
    click Popover "https://github.com/sinha004/transcript-editor/blob/main/src/components/ui/popover.jsx"
    click Utils "https://github.com/sinha004/transcript-editor/blob/main/src/lib/utils.js"

    %% Styles
    classDef build fill:#f9c26b,stroke:#333,stroke-width:1px;
    classDef server fill:#c2c2f0,stroke:#333,stroke-width:1px;
    classDef data fill:#d3d3d3,stroke:#333,stroke-width:1px;
    classDef ui fill:#9fd3f1,stroke:#333,stroke-width:1px;
    classDef util fill:#a8e6cf,stroke:#333,stroke-width:1px;
    classDef external fill:#ffffff,stroke:#333,stroke-dasharray: 4 2;
```
