# heyaryx/pinotes architecture

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

- Interactive diagram: https://gitdiagram.com/heyaryx/pinotes
- Repository: https://github.com/heyaryx/pinotes

## Overview

##### Main components
- Application Logic: The app.js file encompasses all the client-side logic. This includes creating, editing, auto-saving notes, toggling preview modes, encrypting/decrypting notes, and handling user interactions.
- External Dependencies: Include the libraries:
- Marked for Markdown parsing.
- DOMPurify for sanitizing HTML.
- Sharing/Encryption Service: Although it is implemented within the client code, highlight that a special note encryption and sharing mechanism exists, which generates shareable links.

##### Relationships and interactions
- The UI layer (index.html and styles.css) provides the interface for interacting with the note-taking features.
- When a note is created or edited, the app.js logic takes the raw text and processes it using Marked to convert Markdown to HTML, and DOMPurify ensures the generated HTML is safe.
- Encryption logic is also present within app.js to handle the encryption and decryption of shared notes.

##### Architectural patterns and design principles
- Although simple, the app follows a clear separation of concerns: HTML/CSS for presentation and app.js for all business logic.
- The system design promotes a single-page application (SPA) structure, where all logic occurs on the client side without the need for a backend server.

##### Relevant technologies and frameworks
- HTML, CSS, and JavaScript as the core languages.
- Marked, DOMPurify, and FontAwesome as key external libraries.
- The note sharing functionality (via encryption) should be clearly marked as a process that both transforms and secures note data.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Presentation Layer"
        UI["User Interface (index.html + styles.css)"]:::ui
    end

    subgraph "Logic Layer"
        AL["Application Logic (app.js)"]:::logic
        ENC["Note Encryption/Sharing Service"]:::logic
    end

    subgraph "External Libraries"
        MD["Markdown Parser (Marked)"]:::external
        DS["HTML Sanitizer (DOMPurify)"]:::external
        FA["Icon Provider (FontAwesome)"]:::external
    end

    UI -->|"user_interactions"| AL
    AL -->|"parseMarkdown"| MD
    AL -->|"sanitizeHTML"| DS
    AL -->|"encrypt/decrypt"| ENC
    UI -->|"loadIcons"| FA

    click UI "https://github.com/heyaryx/pinotes/blob/main/index.html"
    click UI "https://github.com/heyaryx/pinotes/blob/main/styles.css"
    click AL "https://github.com/heyaryx/pinotes/blob/main/app.js"
    click ENC "https://github.com/heyaryx/pinotes/blob/main/app.js"
    click MD "https://github.com/heyaryx/pinotes/blob/main/app.js"
    click DS "https://github.com/heyaryx/pinotes/blob/main/app.js"
    click FA "https://github.com/heyaryx/pinotes/blob/main/index.html"

    classDef ui fill:#f9f,stroke:#333,stroke-width:2px;
    classDef logic fill:#bbf,stroke:#333,stroke-width:2px;
    classDef external fill:#cfc,stroke:#333,stroke-width:2px;
```
