# mrllama123/dyno-viewer architecture

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

- Interactive diagram: https://gitdiagram.com/mrllama123/dyno-viewer
- Repository: https://github.com/mrllama123/dyno-viewer

## Overview

##### Project Type & Purpose
- This is a terminal-based full-stack (client-only) application focused on interacting with AWS DynamoDB.
- Its primary goal is to provide a lightweight, keyboard-driven UI for viewing and querying DynamoDB tables.
- Key points from the README include key dependencies (AWS CLI for authentication, Textual for UI, poetry for package management) and development notes for local setup and testing.

##### Analyzing the File Structure
- Top-level directories & files:
– The main source is in the “dyno_viewer” directory where the core code resides.
– “dyno_viewer/__main__.py” likely acts as the entry point.
– “dyno_viewer/app.py” and “dyno_viewer/app_types.py” manage the overall application logic and data structures.
- AWS Integration:
– The “dyno_viewer/aws” folder contains modules such as “ddb.py” (likely handling DynamoDB interactions) and “session.py” (managing AWS sessions).
- UI Components:
– The “dyno_viewer/components” directory is divided into subdirectories:
- “css” for styling rules (using .tcss files).
- “help” containing documentation/help content.
- “query” with modules for filtering and sorting queries.
- “screens” where different UI screens (error, help, various selection screens) are implemented.
– “dyno_viewer/components/table.py” suggests that table rendering is modularized.
- Utilities & Tests:
– “dyno_viewer/util” for general utility functions.
– A dedicated “tests” folder provides both unit and manual (interactive) tests, reflecting an emphasis on ensuring stable UI and AWS integrations.

##### Core Components & Their Relationships
- Entry Point: “__main__.py” starts the application and invokes “app.py”.
- Application Core: “app.py” likely orchestrates initialization and routing between UI components and AWS service calls.
- AWS Layer: Encapsulated in “dyno_viewer/aws”, these modules manage AWS sessions and data fetching from DynamoDB.
- UI Layer:
– “components/screens” – Modules here represent different terminal UI screens (help, error, region selection, table selection, etc.) that interact with the user.
– “components/query” – Contains logic to manipulate/filter queries, sorting keys, and formulating the requests.
– “components/css” – Contains styling definitions which influence the UI look and feel.
- Utilities: “dyno_viewer/util” offers supplementary functions to support both AWS interactions and UI operations.

##### Important Architectural Patterns & Design Principles
- Separation of Concerns: The code distinctly separates AWS interactions, UI components, and utility functions.
- Modular Architecture: Components are organized by their function (screens, queries, AWS operations, CSS styling), enabling ease of testing and maintenance.
- Testability: A dedicated “tests” directory shows commitment to unit and integration tests, ensuring each module can be verified independently.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Entry Layer"
        Entry("Entry Point"):::entry
    end

    subgraph "Application Core"
        ApMain("App (app.py)"):::app
        ApTypes("App Types (app_types.py)"):::app
        Entry --> ApMain
        ApMain --> ApTypes
    end

    subgraph "AWS Service Layer"
        ddb("DynamoDB (ddb.py)"):::aws
        session("Session Management (session.py)"):::aws
    end

    subgraph "UI Components"
        subgraph "UI Screens"
            sError("Error Screen (error.py)"):::ui
            sHelp("Help Screen (help.py)"):::ui
            sProfile("Profile Select (profile_select.py)"):::ui
            sQuery("Query Screen (query.py)"):::ui
            sRegion("Region Select (region_select.py)"):::ui
            sTable("Table Select (table_select.py)"):::ui
            sView("View Row (view_row_item.py)"):::ui
        end
        subgraph "Query Handling"
            qFilter("Filter Query (filter_query.py)"):::ui
            qKey("Key Filter (key_filter.py)"):::ui
            qSort("Sort Key Filter (sort_key_filter.py)"):::ui
        end
        subgraph "CSS Styling"
            cssQuery("Query Styling (query.tcss)"):::ui
            cssTable("Table Styling (table.tcss)"):::ui
        end
        tableRender("Table Renderer (table.py)"):::ui
    end

    subgraph "Utilities & Testing"
        util("Utility Functions (util.py)"):::util
        test("Testing Modules"):::test
    end

    %% Relationships
    ApMain -->|"FetchData"| ddb
    ddb -->|"DataResponse"| ApMain
    ApMain -->|"SessionInit"| session
    ApMain -->|"RenderUI"| sQuery
    sQuery -->|"UserInput"| ApMain
    sQuery -->|"ConstructQuery"| qFilter
    qFilter -->|"QueryData"| ApMain
    ApMain -->|"UtilCalls"| util
    ApMain -->|"TestingHooks"| test

    %% Class Definitions for Colors
    classDef entry fill:#FFCC00,stroke:#000,stroke-width:2px;
    classDef app fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef aws fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef ui fill:#FFA07A,stroke:#000,stroke-width:2px;
    classDef util fill:#DDA0DD,stroke:#000,stroke-width:2px;
    classDef test fill:#B0C4DE,stroke:#000,stroke-width:2px;

    %% Click Events
    click Entry "https://github.com/mrllama123/dyno-viewer/blob/master/dyno_viewer/__main__.py"
    click ApMain "https://github.com/mrllama123/dyno-viewer/blob/master/dyno_viewer/app.py"
    click ApTypes "https://github.com/mrllama123/dyno-viewer/blob/master/dyno_viewer/app_types.py"
    click ddb "https://github.com/mrllama123/dyno-viewer/blob/master/dyno_viewer/aws/ddb.py"
    click session "https://github.com/mrllama123/dyno-viewer/blob/master/dyno_viewer/aws/session.py"
    click sError "https://github.com/mrllama123/dyno-viewer/blob/master/dyno_viewer/components/screens/error.py"
    click sHelp "https://github.com/mrllama123/dyno-viewer/blob/master/dyno_viewer/components/screens/help.py"
    click sProfile "https://github.com/mrllama123/dyno-viewer/blob/master/dyno_viewer/components/screens/profile_select.py"
    click sQuery "https://github.com/mrllama123/dyno-viewer/blob/master/dyno_viewer/components/screens/query.py"
    click sRegion "https://github.com/mrllama123/dyno-viewer/blob/master/dyno_viewer/components/screens/region_select.py"
    click sTable "https://github.com/mrllama123/dyno-viewer/blob/master/dyno_viewer/components/screens/table_select.py"
    click sView "https://github.com/mrllama123/dyno-viewer/blob/master/dyno_viewer/components/screens/view_row_item.py"
    click qFilter "https://github.com/mrllama123/dyno-viewer/blob/master/dyno_viewer/components/query/filter_query.py"
    click qKey "https://github.com/mrllama123/dyno-viewer/blob/master/dyno_viewer/components/query/key_filter.py"
    click qSort "https://github.com/mrllama123/dyno-viewer/blob/master/dyno_viewer/components/query/sort_key_filter.py"
    click cssQuery "https://github.com/mrllama123/dyno-viewer/blob/master/dyno_viewer/components/css/query.tcss"
    click cssTable "https://github.com/mrllama123/dyno-viewer/blob/master/dyno_viewer/components/css/table.tcss"
    click tableRender "https://github.com/mrllama123/dyno-viewer/blob/master/dyno_viewer/components/table.py"
    click util "https://github.com/mrllama123/dyno-viewer/blob/master/dyno_viewer/util/util.py"
    click test "https://github.com/mrllama123/dyno-viewer/tree/master/tests"
```
