# bashbunni/pjs architecture

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

- Interactive diagram: https://gitdiagram.com/bashbunni/pjs
- Repository: https://github.com/bashbunni/pjs

## Overview

##### Main Components
- Entry Point: The application starts in main.go, which bootstraps the overall process.
- TUI (Text User Interface) Module: Found in the “tui” directory, this module handles command parsing and user interaction (e.g., commands in commands.go, display logic in tui.go, etc.).
- Domain Logic:
– Entry Component: The “entry” directory contains the logic for handling individual journal entries (entry.go, entry_output.go, entry_test.go).
– Project Component: The “project” directory deals with broader project logging and management logic, complete with its own tests.
- Utility Functions: The “utils” directory holds helper functions (e.g., file handling in file-utils.go) that support the core functionality.
- External Components & Build/Infrastructure:
– GitHub workflows, linting, and release configurations suggest robust CI/CD practices.
– Although not explicitly depicted in the file tree, the README mentions backing up to a SQLite database, so include a Database component that interacts with the application’s persistence layer.

##### Relationships and Interactions
- The main entry point (main.go) initializes and connects the various modules.
- The TUI module acts as the primary interface for users. It calls into the Entry and Project modules to log, retrieve, and display journal entries.
- The Domain modules (Entry and Project) encapsulate business logic. They will likely interact with a database layer (SQLite) when saving or retrieving logged information.
- Utility functions are used across the application to support file operations and potentially other I/O processes.

##### Important Architectural Patterns
- Layered Architecture / Separation of Concerns: There is clear separation between the UI (TUI module) and the business logic (Entry and Project modules). The utility functions further separate common operations.
- Testing Strategy: Notice test files (for both entry and project) which suggest testing is a key aspect of the design.
- CI/CD Integration: The GitHub workflows (build, lint, coverage) integrate into the development lifecycle, emphasizing a mature development pipeline.

##### Relevant Technologies and Frameworks
- Primary Language: Go.
- SQLite: For data backup/persistence (mentioned in README).
- TUI-based interaction: All TUI code points toward a text-based user interface.
- CI Tools: GitHub Actions, GolangCI for linting and testing.

##### Detail
- You may also note where testing is integrated by indicating test files in the Entry and Project components as a reminder of the components’ verifiability.

- A top-level entry point (main.go) handing off to the TUI,
- A TUI module that interfaces with the domain (Entry and Project) layers,
- Domain logic that performs journal logging and interacts with a SQLite database for persistence,
- Supporting utility functions which assist in file operations, and
- CI/CD infrastructure indirectly supporting the lifecycle of this project.

## Diagram (Mermaid)

```mermaid
flowchart TD
    User["User"]:::ui
    Main["Main Entry (main.go)"]:::domain
    TUI["TUI Module (tui/)"]:::ui
    Entry["Entry Management (entry/)"]:::domain
    Project["Project Management (project/)"]:::domain
    Utils["Utilities (utils/)"]:::util
    DB["Database (SQLite)"]:::database
    CICD["CI/CD Infrastructure (.github/)"]:::cicd

    %% Relationships
    User -->|"input"| TUI
    Main -->|"bootstraps"| TUI
    TUI -->|"processes commands"| Entry
    TUI -->|"processes commands"| Project
    TUI -->|"calls file utilities"| Utils
    Entry -->|"saves/retrieves"| DB
    Project -->|"saves/retrieves"| DB

    %% CI/CD is an external support mechanism
    CICD ---|"supports build & test"| Main

    %% Click Events
    click Main "https://github.com/bashbunni/pjs/blob/main/main.go"
    click TUI "https://github.com/bashbunni/pjs/tree/main/tui/"
    click Entry "https://github.com/bashbunni/pjs/tree/main/entry/"
    click Project "https://github.com/bashbunni/pjs/tree/main/project/"
    click Utils "https://github.com/bashbunni/pjs/blob/main/utils/file-utils.go"
    click CICD "https://github.com/bashbunni/pjs/tree/main/.github/"

    %% Styles
    classDef ui fill:#F0AD4E,stroke:#333,stroke-width:2px;
    classDef domain fill:#5BC0DE,stroke:#333,stroke-width:2px;
    classDef util fill:#5CB85C,stroke:#333,stroke-width:2px;
    classDef database fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef cicd fill:#D3D3D3,stroke:#333,stroke-width:2px;
```
