# ibttf/columbia-notetaker architecture

> Architecture diagram of the GitHub repository ibttf/columbia-notetaker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ibttf/columbia-notetaker
- Repository: https://github.com/ibttf/columbia-notetaker

## Overview

- A frontend browser component (the “front” directory) that contains the core extension assets—manifest, background script, content script, and a React-based popup UI.
- A backend component (the app.py file and associated python virtual environment in “venv”) that likely supports server-side functionality such as handling note requests or serving lecture note content.

##### Main Components
a. Browser Extension Core:
– Manifest & Configuration: Located in front/public (manifest.json, index.html, etc.).
– Background Script: front/public/background.js (handles extension lifecycle, background tasks, etc.).
– Content Script: front/public/contentScript.js (injects behavior into target web pages).
– Popup/User Interface: Located in front/src/components (components like Popup.tsx and Loading.tsx built in React with support from Tailwind, Webpack, etc.). It also utilizes bundling configurations (webpack.config.js, next.config.mjs) and TypeScript (tsconfig.json).
b. Python Backend:
– app.py: Likely a Flask or similar microservice that processes requests from the extension.
– Virtual Environment: “venv” directory ensuring dependency isolation.

##### Relationships/Interactions
– The User operates the Browser.
– When the User navigates to a Columbia video URL (on hosted.panopto.com or columbia.panopto.com), the Content Script (injected by the extension through the manifest) detects the URL.
– This detection triggers the background script to engage the Popup UI (React-based) – communicated via internal messaging channels.
– The extension may communicate with the Python backend (app.py) via HTTP or WebSocket calls for retrieving lecture note data or triggering further processing.
– The backend and extension interact to provide a seamless note-taking experience.

##### Architectural Patterns & Design Principles
– Separation of concerns: the extension’s frontend (UI, content, and background scripts) is clearly separated from the server-side logic.
– Client-side event-driven design: The browser extension listens to URL changes and triggers UI popups.
– Use of modern development tools and frameworks: React for UI, TypeScript for type safety, Tailwind for styling, and bundling via Webpack/Next.js for frontend deployment.
– Modularity: the directory structure indicates a clear modular separation between extension code and backend code.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Browser
    Chrome_Browser("Chrome Browser"):::browser

    %% Browser Extension Subgraph
    subgraph "Browser Extension"
        Manifest_Config("Manifest & Config"):::config
        Build_Config("Build/Config Tools"):::config
        Content_Script("Page Injector (Content Script)"):::frontend
        Background_Processor("Background Processor (Background Script)"):::frontend
        PopupUI_Popup("UI Popup Component (Popup.tsx)"):::popup
        PopupUI_Loading("Loading Component (Loading.tsx)"):::popup
    end

    %% Backend Service Subgraph
    subgraph "Backend Service"
        Backend_API("Backend API / Note Processor (app.py)"):::backend
        Virtual_Env("Dependency Isolation (venv)"):::backend
    end

    %% Relationships/Flow
    Chrome_Browser -->|"navigates_to_URL"| Content_Script
    Manifest_Config -->|"injects_scripts"| Content_Script
    Content_Script -->|"sends_message"| Background_Processor
    Background_Processor -->|"triggers_UI"| PopupUI_Popup
    Background_Processor -->|"triggers_loading"| PopupUI_Loading
    Background_Processor -->|"API_request"| Backend_API
    Backend_API -->|"data_response"| Background_Processor

    %% Click Events for Component Mapping
    click Manifest_Config "https://github.com/ibttf/columbia-notetaker/blob/main/front/public/manifest.json"
    click Build_Config "https://github.com/ibttf/columbia-notetaker/blob/main/front/webpack.config.js"
    click Content_Script "https://github.com/ibttf/columbia-notetaker/blob/main/front/public/contentScript.js"
    click Background_Processor "https://github.com/ibttf/columbia-notetaker/blob/main/front/public/background.js"
    click PopupUI_Popup "https://github.com/ibttf/columbia-notetaker/blob/main/front/src/components/Popup.tsx"
    click PopupUI_Loading "https://github.com/ibttf/columbia-notetaker/blob/main/front/src/components/Loading.tsx"
    click Backend_API "https://github.com/ibttf/columbia-notetaker/blob/main/app.py"
    click Virtual_Env "https://github.com/ibttf/columbia-notetaker/tree/main/venv"

    %% Styles
    classDef browser fill:#FAD02E,stroke:#333,stroke-width:2px;
    classDef frontend fill:#A1C6EA,stroke:#333,stroke-width:2px;
    classDef backend fill:#F28E1C,stroke:#333,stroke-width:2px;
    classDef config fill:#B2E0A1,stroke:#333,stroke-width:2px;
    classDef popup fill:#E4C1F9,stroke:#333,stroke-width:2px;
```
