# perseusnomit/syncednotepad architecture

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

- Interactive diagram: https://gitdiagram.com/perseusnomit/syncednotepad
- Repository: https://github.com/perseusnomit/syncednotepad

## Overview

##### Frontend Layer
- Client-side application contained in the `public` directory
- Three main frontend components:
- HTML (index.html) - User Interface
- JavaScript (app.js) - Client-side logic
- CSS (style.css) - Styling

##### Backend Layer
- Node.js server (server.js)
- File-based storage system (notes-db.json)

##### Communication Layer
- HTTP/REST API endpoints between frontend and backend

- [Client Layer]
- ↕
- [Server Layer]
- ↕
- [Data Storage]

##### Component Details

Client Layer (Top):
- "UI (index.html)"
- "Client Logic (app.js)"
- "Styles (style.css)"

Server Layer (Middle):
- Main server component (server.js)
- API endpoints for note operations (GET, POST, PUT, DELETE)

Data Storage (Bottom):
- JSON file storage (notes-db.json)
- File-based persistence mechanism

##### Connection Flows
- Data persistence flows between server and JSON file
- Bidirectional synchronization paths for notes

##### Additional Elements
- Notes about the synchronization mechanism
- Port number the server listens on

Important Considerations:

##### Simplicity
- Don't over-complicate the representation as this is a straightforward application

##### Synchronization Focus
- Note synchronization paths
- How data flows between client and server

##### Storage Mechanism
- File-based storage approach
- Relationship between server and JSON file

##### API Layer
- Main API endpoints
- RESTful nature of the communication

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        UI["UI"]:::frontend
        CL["Client Logic"]:::frontend
        UI --- CL
    end

    subgraph Backend
        SV["Server"]:::backend
        API["API"]:::api
        SV --- API
    end

    DB["JSON Storage"]:::storage

    CL --> API
    API --> CL
    SV --> DB

    click UI "https://github.com/perseusnomit/SyncedNotepad/blob/main/public/index.html"
    click CL "https://github.com/perseusnomit/SyncedNotepad/blob/main/public/app.js"
    click SV "https://github.com/perseusnomit/SyncedNotepad/blob/main/server.js"
    click DB "https://github.com/perseusnomit/SyncedNotepad/blob/main/notes-db.json"

    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef api fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef storage fill:#f1c40f,stroke:#f39c12,color:black
```
