# databasediisc/deemak architecture

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

- Interactive diagram: https://gitdiagram.com/databasediisc/deemak
- Repository: https://github.com/databasediisc/deemak

## Overview

##### Project type and purpose
- This is a Rust-based interactive explorer called “deemak” that can be run in two modes:
- Terminal (CLI) version, driven by commands (echo, ls, go, read, whereami, help)
- Web version, using an HTTP server to serve a single-page UI (static/index.html + index.css) and backend logic
- It lets users navigate a virtual file world (“sekai” folder) with text files and JSON metadata.

##### File structure
- Top level:
- Cargo.toml / Cargo.lock: Rust project definition
- src/: contains core application code
- static/: contains web frontend assets
- sekai/: the data store (files/JSON) that represents the world
- In src/:
- main.rs: entry point for CLI
- server.rs: entry point for web server mode
- lib.rs: core library, shared by CLI and server
- commands/: implementations of individual commands (ls, go, read, etc.)
- menu/: code for interactive menus (about, menu options)
- utils/: helper modules for locating root, reading info JSON, etc.
- log.rs, screen.rs, keys.rs: platform-specific I/O and logging

##### README for additional insights
- Two run commands:
- `cargo run` for terminal
- `cargo run web` for web
- Browser interface available at http://localhost:8000

##### Elements
- CLI → Core Library → Utils → Data Store
- Browser → HTTP Server → Core Library → Utils → Data Store
- HTTP Server → Static Assets → Browser
- Server/Library in another
- Data store in a third
- Static assets in a fourth

##### Details
- Utils modules: find_root, info_reader
- That server.rs will parse URL paths and invoke the commands API
- Port 8000 for HTTP communication

- Clearly separates frontend (CLI vs. web) from backend logic
- Shows reuse of the Core Library across both modes
- Captures how data flows through utils into the sekai file store

This will give any stakeholder or new engineer an at-a-glance understanding of “deemak”’s architecture.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "UI Layer"
        CLI["CLI Client"]:::ui
        Browser["Browser"]:::ui
    end

    subgraph "Backend Layer"
        subgraph "HTTP Server"
            HTTP["HTTP Server<br/>port 8000"]:::server
        end
        subgraph "Core Library"
            Lib["Core Library"]:::lib
            subgraph "Commands"
                Echo["echo"]:::cmd
                Go["go"]:::cmd
                Ls["ls"]:::cmd
                Read["read"]:::cmd
                Whereami["whereami"]:::cmd
                Help["help"]:::cmd
                Cmds["cmds"]:::cmd
            end
            subgraph "Menu"
                About["about"]:::menu
                MenuOpts["menu_options"]:::menu
            end
            subgraph "Utils"
                FindRoot["find_root"]:::util
                InfoReader["info_reader"]:::util
            end
        end
    end

    subgraph "Static Assets"
        HTML["index.html"]:::static
        CSS["index.css"]:::static
    end

    subgraph "Data Store"
        Sekai["sekai/"]:::data
    end

    CLI -->|uses| Lib
    Browser -->|HTTP| HTTP
    HTTP -->|calls| Lib
    Lib -->|uses| FindRoot
    Lib -->|uses| InfoReader
    FindRoot -->|reads/writes| Sekai
    InfoReader -->|reads| Sekai
    HTTP -->|serves| HTML
    HTTP -->|serves| CSS
    HTML -->|renders| Browser
    CSS -->|styles| Browser

    click CLI "https://github.com/databasediisc/deemak/blob/main/src/main.rs"
    click CLI "https://github.com/databasediisc/deemak/blob/main/src/keys.rs"
    click CLI "https://github.com/databasediisc/deemak/blob/main/src/log.rs"
    click CLI "https://github.com/databasediisc/deemak/blob/main/src/screen.rs"
    click Echo "https://github.com/databasediisc/deemak/blob/main/src/commands/echo.rs"
    click Go "https://github.com/databasediisc/deemak/blob/main/src/commands/go.rs"
    click Ls "https://github.com/databasediisc/deemak/blob/main/src/commands/ls.rs"
    click Read "https://github.com/databasediisc/deemak/blob/main/src/commands/read.rs"
    click Whereami "https://github.com/databasediisc/deemak/blob/main/src/commands/whereami.rs"
    click Help "https://github.com/databasediisc/deemak/blob/main/src/commands/help.rs"
    click Cmds "https://github.com/databasediisc/deemak/blob/main/src/commands/cmds.rs"
    click About "https://github.com/databasediisc/deemak/blob/main/src/menu/about.rs"
    click MenuOpts "https://github.com/databasediisc/deemak/blob/main/src/menu/menu_options.rs"
    click Lib "https://github.com/databasediisc/deemak/blob/main/src/lib.rs"
    click HTTP "https://github.com/databasediisc/deemak/blob/main/src/server.rs"
    click FindRoot "https://github.com/databasediisc/deemak/blob/main/src/utils/find_root.rs"
    click InfoReader "https://github.com/databasediisc/deemak/blob/main/src/utils/info_reader.rs"
    click Sekai "https://github.com/databasediisc/deemak/tree/main/sekai/"
    click HTML "https://github.com/databasediisc/deemak/blob/main/static/index.html"
    click CSS "https://github.com/databasediisc/deemak/blob/main/static/index.css"

    classDef ui fill:#E8F0FE,stroke:#4285F4
    classDef server fill:#FFF4E5,stroke:#FBBC05
    classDef lib fill:#E6F4EA,stroke:#34A853
    classDef cmd fill:#FCE8E6,stroke:#EA4335
    classDef menu fill:#EDE7F6,stroke:#A142F4
    classDef util fill:#F1F3F4,stroke:#5F6368
    classDef static fill:#E0F7FA,stroke:#00ACC1
    classDef data fill:#FFF3E0,stroke:#FB8C00
```
