# ikitzu/easynotes architecture

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

- Interactive diagram: https://gitdiagram.com/ikitzu/easynotes
- Repository: https://github.com/ikitzu/easynotes

## Overview

##### Main Components
- User Interface (Frontend):
- HTML views (e.g., index.html, signup.html)
- CSS assets for styling (files in assets/css)
- JavaScript scripts for dynamic behavior (files in assets/js like script.js, scriptLogin.js, signup.js, and screen.js)
- Client-side Storage:
- Local Storage (current storage mechanism for notes)
- Future API / Backend Service:
- API endpoints to manage notes (create, read, update, delete)
- Authentication logic using JWT (planned feature for securing user accounts)
- Database (to eventually replace Local Storage and store notes securely)
- External Dependencies or Assets:
- Assets such as fonts and images that support the UI

##### Out Relationships and Interactions
- The user interacts with the web pages (HTML) in the browser.
- The UI layer processes user actions (e.g., note creation, editing, searching) using JavaScript.
- The JavaScript layer reads from and writes to Local Storage to persist data.
- In the near-future architecture, JavaScript will send/receive data via API calls to a backend service.
- The backend will use JWT for authentication, ensuring secure access to the notes.
- A database will store notes and possibly user account information.

##### Architectural Patterns and Design Principles
- Model-View-Controller (MVC) Approach:
- View: HTML and CSS files that form the presentation layer.
- Controller: JavaScript functions that handle user interactions and data manipulation.
- Model: Data storage represented by Local Storage (with the eventual move to a database in the backend).
- Layered Architectural Design:
- Presentation Layer (Frontend UI)
- Business Logic Layer (JS handling the application logic)
- Data Access Layer (Local Storage now; planned API + database later)
- Progressive Enhancement:
- Start simple (client-side implementation) while anticipating expansion into a full-stack design.

##### Relevant Technologies
- HTML/CSS/JavaScript as the primary frontend technologies.
- Local Storage for immediate data persistence.
- Planned technologies for backend integration (RESTful API, a database system, and JWT for authentication) as mentioned in the README.
- External assets such as fonts and images to enhance the UI experience.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend UI Subgraph
    subgraph "Frontend UI"
        subgraph "HTML Views"
            UI_Index["index.html"]:::ui
            UI_EasyNotes["EasyNotes.html"]:::ui
            UI_Signup["signup.html"]:::ui
        end
        subgraph "CSS Styles"
            CSS1["styleEN.css"]:::css
            CSS2["styles.css"]:::css
            CSS3["variable.css"]:::css
        end
    end

    %% Business Logic (JS Controllers) Subgraph
    subgraph "Business Logic (JS Controllers)"
        JS1["script.js"]:::logic
        JS2["scriptLogin.js"]:::logic
        JS3["signup.js"]:::logic
        JS4["screen.js"]:::logic
        JS5["logout.js"]:::logic
    end

    %% External Assets Subgraph
    subgraph "External Assets"
        EA_Fonts["Fonts"]:::assets
        EA_Images["Images"]:::assets
    end

    %% Client-side Storage Node
    Storage["Local Storage"]:::storage

    %% Future Backend Subgraph
    subgraph "Backend (Future)"
        API["Backend API"]:::backend
        DB["Database"]:::backend
        JWT["JWT Auth Module"]:::backend
    end

    %% Connections
    %% User Interaction: External Assets enhance UI
    EA_Fonts -->|"supports"| UI_Index
    EA_Images -->|"supports"| UI_Index

    %% UI triggers Business Logic
    UI_Index -->|"triggers"| JS1
    UI_EasyNotes -->|"triggers"| JS1
    UI_Signup -->|"triggers"| JS1

    %% Business Logic interacts with Local Storage
    JS1 -->|"reads/writes"| Storage
    JS2 -->|"reads/writes"| Storage
    JS3 -->|"reads/writes"| Storage
    JS4 -->|"reads/writes"| Storage
    JS5 -->|"reads/writes"| Storage

    %% Business Logic and Future API Integration
    JS1 -->|"API_call"| API
    JS2 -->|"API_call"| API
    JS3 -->|"API_call"| API
    JS4 -->|"API_call"| API
    JS5 -->|"API_call"| API
    API -->|"response"| JS1

    %% Backend API interactions
    API -->|"stores"| DB

    %% JWT Authentication interactions
    UI_Index -->|"auth_request"| JWT
    JWT -->|"validates"| API

    %% Styling Definitions
    classDef ui fill:#D1E8FF,stroke:#1F78C1,stroke-width:2px;
    classDef css fill:#FEF9C7,stroke:#D4AC0D,stroke-width:2px;
    classDef logic fill:#D5F5E3,stroke:#27AE60,stroke-width:2px;
    classDef assets fill:#FADBD8,stroke:#C0392B,stroke-width:2px;
    classDef storage fill:#E8DAEF,stroke:#8E44AD,stroke-width:2px;
    classDef backend fill:#FAD7A0,stroke:#E67E22,stroke-width:2px;

    %% Click Events for UI HTML Views
    click UI_Index "https://github.com/ikitzu/easynotes/blob/main/index.html"
    click UI_EasyNotes "https://github.com/ikitzu/easynotes/blob/main/assets/view/EasyNotes.html"
    click UI_Signup "https://github.com/ikitzu/easynotes/blob/main/assets/view/signup.html"

    %% Click Events for CSS Styles
    click CSS1 "https://github.com/ikitzu/easynotes/blob/main/assets/css/styleEN.css"
    click CSS2 "https://github.com/ikitzu/easynotes/blob/main/assets/css/styles.css"
    click CSS3 "https://github.com/ikitzu/easynotes/blob/main/assets/css/variable.css"

    %% Click Events for JavaScript Controllers
    click JS1 "https://github.com/ikitzu/easynotes/blob/main/assets/js/script.js"
    click JS2 "https://github.com/ikitzu/easynotes/blob/main/assets/js/scriptLogin.js"
    click JS3 "https://github.com/ikitzu/easynotes/blob/main/assets/js/signup.js"
    click JS4 "https://github.com/ikitzu/easynotes/blob/main/assets/js/screen.js"
    click JS5 "https://github.com/ikitzu/easynotes/blob/main/assets/js/logout.js"

    %% Click Events for External Assets
    click EA_Fonts "https://github.com/ikitzu/easynotes/tree/main/assets/font/Nunito"
    click EA_Images "https://github.com/ikitzu/easynotes/tree/main/assets/img"
```
