# manohark98/synthenote architecture

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

- Interactive diagram: https://gitdiagram.com/manohark98/synthenote
- Repository: https://github.com/manohark98/synthenote

## Overview

##### Main Components
a. Frontend (React SPA)
- Runs in the user’s browser
- Components: PDFUploader, TextEditor, SavedTexts
b. Backend (Python service)
- Exposes HTTP endpoints (e.g., /upload, /summarize, /notes)
- Implements business logic in app.py/main.py
c. Persistence Layer
- Local file storage (`backend/saved_texts/*.txt`)
d. External AI Service
- OpenAI (or similar) API for text summarization

##### Relationships & Data Flows
- Browser → Frontend SPA
- User clicks “Upload PDF” in PDFUploader
- Frontend → Backend (HTTP)
- POST PDF → /upload
- POST text → /summarize
- GET/POST notes → /notes
- Backend → External AI Service
- Sends paper text, receives summary
- Backend → Persistence
- Saves/reads .txt files in `saved_texts`

##### Architectural Patterns
- Full‐stack, client‐server (SPA + REST API)
- Single Node process for backend (monolithic microservice)
- File‐system storage (can swap in a database later)
- Third-party dependency for AI (external service integration)

## Diagram (Mermaid)

```mermaid
flowchart TB
    User["User's Browser"]:::user

    subgraph "Frontend (React SPA)"
        FE["React SPA<br/>(JSX, fetch API)"]:::frontend
        Entry["Index.js"]:::frontend
        Root["App.js"]:::frontend
        PDFU["PDFUploader.js"]:::frontend
        TE["TextEditor.js"]:::frontend
        ST["SavedTexts.js"]:::frontend
        HTML["index.html"]:::frontend
    end

    subgraph "Backend (Python Service)"
        BE["Python API Service<br/>(Flask/FastAPI)"]:::backend
        APP["app.py"]:::backend
        MAIN["main.py"]:::backend
        CONFIG["pyproject.toml"]:::backend
        ENV[".env"]:::backend
    end

    subgraph "Saved Texts"
        FS["backend/saved_texts/"]:::storage
        Note1["seq.txt"]:::storage
        Note2["untitled.txt"]:::storage
    end

    AI["OpenAI API"]:::external

    User -->|"loads SPA"| FE
    FE --> Entry
    Entry --> Root
    Root --> PDFU
    Root --> TE
    Root --> ST
    FE -->|serves HTML| HTML

    FE -->|"POST application/pdf"| BE
    BE --> APP
    APP --> MAIN
    APP --> CONFIG
    APP --> ENV

    BE -->|"REST API call"| AI
    BE -->|"read/write .txt"| FS
    FS --> Note1
    FS --> Note2

    click FE "https://github.com/manohark98/synthenote/tree/main/frontend/"
    click Entry "https://github.com/manohark98/synthenote/blob/main/frontend/src/index.js"
    click Root "https://github.com/manohark98/synthenote/blob/main/frontend/src/App.js"
    click PDFU "https://github.com/manohark98/synthenote/blob/main/frontend/src/components/PDFUploader.js"
    click TE "https://github.com/manohark98/synthenote/blob/main/frontend/src/components/TextEditor.js"
    click ST "https://github.com/manohark98/synthenote/blob/main/frontend/src/components/SavedTexts.js"
    click HTML "https://github.com/manohark98/synthenote/blob/main/frontend/public/index.html"
    click BE "https://github.com/manohark98/synthenote/tree/main/backend/"
    click APP "https://github.com/manohark98/synthenote/blob/main/backend/app.py"
    click MAIN "https://github.com/manohark98/synthenote/blob/main/backend/main.py"
    click FS "https://github.com/manohark98/synthenote/tree/main/backend/saved_texts/"
    click Note1 "https://github.com/manohark98/synthenote/blob/main/backend/saved_texts/seq.txt"
    click Note2 "https://github.com/manohark98/synthenote/blob/main/backend/saved_texts/untitled.txt"
    click CONFIG "https://github.com/manohark98/synthenote/blob/main/pyproject.toml"
    click ENV "https://github.com/manohark98/synthenote/blob/main/frontend/.env"

    classDef frontend fill:#cce5ff,stroke:#004085,color:#004085
    classDef backend fill:#d4edda,stroke:#155724,color:#155724
    classDef storage fill:#e2e3e5,stroke:#6c757d,color:#343a40
    classDef external fill:#fff3cd,stroke:#856404,color:#856404
    classDef user fill:#f8f9fa,stroke:#6c757d,color:#343a40
```
