# mattiasaan/landesk architecture

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

- Interactive diagram: https://gitdiagram.com/mattiasaan/landesk
- Repository: https://github.com/mattiasaan/landesk

## Overview

##### Project type and purpose
- This is a full-stack Progressive Web App (PWA) called “LANdesk,” consisting of:
- A Python backend (in backend_py) exposing REST-style endpoints for user auth, notes, tasks, file uploads/downloads, and user addition.
- A static web UI (in web_ui) built with HTML, CSS, and vanilla JS that registers a service worker and a manifest for offline support.
- The README simply names the project; the file tree shows its note-/task-management focus plus file handling.

##### File structure
- Top-level directories:
- backend_py: modules (add_user.py, auth.py, files.py, notes.py, tasks.py), plus generators (note_sender, task_sender) and main.py.
- web_ui: static assets (HTML pages, scripts per page, style.css, manifest.json, service-worker.js, images).
- No explicit “database” directory—data is likely persisted via file system or an embedded DB accessed by files.py.
- The presence of main.py implies a monolithic Python web server (e.g., Flask, FastAPI, or similar).
- The service-worker.js and manifest.json signal a PWA caching layer for offline use.

##### README for additional insights
- Rely on file names and PWA files to infer layers: UI layer, client-side caching layer, server layer, data-store layer.

##### Detail without overcomplicating
- Python module as its own subcomponent under Business Logic.
- Explicit fetch/XHR calls from each JS controller to its corresponding API endpoint.
- Service-worker intercept path for both static assets and API calls (if the PWA caches API responses).

## Diagram (Mermaid)

```mermaid
graph LR
    subgraph "Browser / PWA Client"
        subgraph "Static Assets"
            IndexHTML["index.html"]:::client
            HomeHTML["home.html"]:::client
            LoginHTML["login.html"]:::client
            NoteHTML["note.html"]:::client
            TasksHTML["tasks.html"]:::client
            FilesHTML["files.html"]:::client
            CSS["style.css"]:::client
            Images["images/"]:::client
        end
        subgraph "Controllers (JS)"
            IndexJS["index-script.js"]:::client
            LoginJS["login.js"]:::client
            NoteJS["note-script.js"]:::client
            TaskJS["task-script.js"]:::client
            FilesJS["files-script.js"]:::client
        end
        Manifest["manifest.json"]:::offline
        SW["service-worker.js"]:::offline
    end

    subgraph "Backend Service"
        APIGateway["main.py"]:::server
        subgraph "Business Logic"
            Auth["auth.py"]:::server
            AddUser["add_user.py"]:::server
            Notes["notes.py"]:::server
            Tasks["tasks.py"]:::server
            FilesMod["files.py"]:::server
        end
        subgraph "Generators"
            NoteSender["note_sender.py"]:::server
            TaskSender["task_sender.py"]:::server
        end
        DataStore["Data Store"]:::db
    end

    External["Email/SMS Gateway"]:::external

    %% Client interactions
    IndexHTML -->|loads| IndexJS
    HomeHTML -->|loads| IndexJS
    LoginHTML -->|loads| LoginJS
    NoteHTML -->|loads| NoteJS
    TasksHTML -->|loads| TaskJS
    FilesHTML -->|loads| FilesJS

    IndexJS -->|fetch API| APIGateway
    LoginJS -->|fetch API| APIGateway
    NoteJS -->|fetch API| APIGateway
    TaskJS -->|fetch API| APIGateway
    FilesJS -->|fetch API| APIGateway

    SW -->|caches| IndexHTML
    SW -->|caches| HomeHTML
    SW -->|caches| LoginHTML
    SW -->|caches| NoteHTML
    SW -->|caches| TasksHTML
    SW -->|caches| FilesHTML
    SW -->|caches| CSS
    SW -->|caches| Images
    SW -->|intercepts| APIGateway

    %% Server flows
    APIGateway -->|calls| Auth
    APIGateway -->|calls| AddUser
    APIGateway -->|calls| Notes
    APIGateway -->|calls| Tasks
    APIGateway -->|calls| FilesMod

    Auth -->|queries| DataStore
    AddUser -->|writes| DataStore
    Notes -->|CRUD| DataStore
    Tasks -->|CRUD| DataStore
    FilesMod -->|store/retrieve| DataStore

    Notes -->|trigger| NoteSender
    Tasks -->|trigger| TaskSender

    NoteSender -->|send notifications| External
    TaskSender -->|send notifications| External

    %% Click Events
    click IndexHTML "https://github.com/mattiasaan/landesk/blob/main/web_ui/index.html"
    click HomeHTML "https://github.com/mattiasaan/landesk/blob/main/web_ui/home.html"
    click LoginHTML "https://github.com/mattiasaan/landesk/blob/main/web_ui/login.html"
    click NoteHTML "https://github.com/mattiasaan/landesk/blob/main/web_ui/note.html"
    click TasksHTML "https://github.com/mattiasaan/landesk/blob/main/web_ui/tasks.html"
    click FilesHTML "https://github.com/mattiasaan/landesk/blob/main/web_ui/files.html"
    click CSS "https://github.com/mattiasaan/landesk/blob/main/web_ui/style.css"
    click Images "https://github.com/mattiasaan/landesk/tree/main/web_ui/images/"
    click Manifest "https://github.com/mattiasaan/landesk/blob/main/web_ui/manifest.json"
    click SW "https://github.com/mattiasaan/landesk/blob/main/web_ui/service-worker.js"
    click IndexJS "https://github.com/mattiasaan/landesk/blob/main/web_ui/index-script.js"
    click LoginJS "https://github.com/mattiasaan/landesk/blob/main/web_ui/login.js"
    click NoteJS "https://github.com/mattiasaan/landesk/blob/main/web_ui/note-script.js"
    click TaskJS "https://github.com/mattiasaan/landesk/blob/main/web_ui/task-script.js"
    click FilesJS "https://github.com/mattiasaan/landesk/blob/main/web_ui/files-script.js"
    click APIGateway "https://github.com/mattiasaan/landesk/blob/main/backend_py/main.py"
    click Auth "https://github.com/mattiasaan/landesk/blob/main/backend_py/auth.py"
    click AddUser "https://github.com/mattiasaan/landesk/blob/main/backend_py/add_user.py"
    click Notes "https://github.com/mattiasaan/landesk/blob/main/backend_py/notes.py"
    click Tasks "https://github.com/mattiasaan/landesk/blob/main/backend_py/tasks.py"
    click FilesMod "https://github.com/mattiasaan/landesk/blob/main/backend_py/files.py"
    click NoteSender "https://github.com/mattiasaan/landesk/blob/main/backend_py/generators/note_sender.py"
    click TaskSender "https://github.com/mattiasaan/landesk/blob/main/backend_py/generators/task_sender.py"

    %% Styles
    classDef client fill:#D0E8FF,stroke:#0066CC,stroke-width:1px
    classDef offline fill:#FFE8B0,stroke:#CC8400,stroke-width:1px
    classDef server fill:#DFFFD8,stroke:#339933,stroke-width:1px
    classDef db fill:#EEEEEE,stroke:#666666,stroke-width:1px,stroke-dasharray: 5 5
    classDef external fill:#FDE2E2,stroke:#CC3333,stroke-width:1px
```
