# lambor590/kaizen architecture

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

- Interactive diagram: https://gitdiagram.com/lambor590/kaizen
- Repository: https://github.com/lambor590/kaizen

## Overview

##### Project Type and Purpose
- Kaizen is a desktop application built using modern web technologies and Rust, integrating Tauri as the bridge between the web front end and native desktop capabilities.
- Its purpose is to offer several tools (“herramientas”) to save time and keep a team operating efficiently.

##### Analyzing the File Structure
- Notice the separation between the web frontend and the Tauri (Rust) backend:
– The frontend is built with the Astro framework (e.g., astro.config.mjs, src/pages, src/components, layouts) using TypeScript/TSX.
– The Tauri-specific backend resides in the “src-tauri” directory, clearly organized with Rust files (main.rs, build.rs, Cargo.toml, and modules/tools like cleaner.rs and downloader.rs).
- Other files include configuration (tailwind.config.js, tsconfig.json, GitHub workflows) and public assets (public/splash.html) which support the UI and deployment processes.

a. Main Components to Include:
– Frontend Web/UI: Built with Astro; includes pages, layouts, and React/TSX components.
– Tauri Backend: Implemented in Rust; handles native OS interactions, business logic for tools (Cleaner, Downloader), and exposes APIs to the frontend.
– Build & Deployment: Include GitHub Actions (under .github/workflows) and configuration files for both the frontend (package.json, astro.config.mjs) and backend (Cargo.toml, tauri.conf.json).

b. Relationships and Interactions:
▫ The frontend sends commands and receives responses via Tauri’s messaging API, triggering actions like cleaning and downloading.
▫ The backend, implemented in Rust, processes these requests, interacts with local system resources, and sends back status updates.
– Include the build/deployment pipeline interacting with both parts, highlighting CI/CD flows (e.g., release workflows from .github/workflows).

c. Architectural Patterns and Design Principles:
– The project follows a multi-tier architecture where presentation (Astro-based UI) is decoupled from business logic and native integrations (Tauri backend).
– Emphasize modularity by showcasing separate tools (Cleaner, Downloader) as distinct modules/components.
– The Tauri integration embodies the principle of “separation of concerns” by isolating web technologies from system-level operations.

d. Technologies, Frameworks, and Libraries:
– Astro (for rendering pages and layouts)
– TypeScript/TSX for UI components
– Tauri (to bridge web and native functionalities)
– Rust (for backend logic and interfacing with OS capabilities)
– Tailwind CSS (as evident from tailwind.config.js) for styling
– GitHub Actions (for CI/CD and deployment automation)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        FE["Frontend (Astro+TSX UI)"]:::frontend
        AstroConfig["Astro Config (astro.config.mjs)"]:::frontend
        Pages["Pages (src/pages/)"]:::frontend
        Components["Components (src/components/)"]:::frontend
        Layout["Layout (src/layouts/Layout.astro)"]:::frontend
        FE_Cleaner["Cleaner Tool UI (Cleaner.tsx)"]:::frontend
        FE_Downloader["Downloader Tool UI (Downloader.tsx)"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        BE["Tauri Backend (Rust Core & Tools)"]:::backend
        MainRS["Main (main.rs)"]:::backend
        TauriConf["Tauri Conf (tauri.conf.json)"]:::backend
        Cargo["Cargo.toml"]:::backend
        BuildRS["Build Script (build.rs)"]:::backend
        BE_Cleaner["Cleaner Module (cleaner.rs)"]:::backend
        BE_Downloader["Downloader Module (downloader.rs)"]:::backend
        WindowsAPI["Windows API (windows_api.rs)"]:::backend
    end

    %% Build & Deployment
    subgraph "Build & Deployment"
        CI["CI/CD Pipeline (GitHub Actions)"]:::deployment
        PackageJSON["Package.json"]:::deployment
        Tailwind["Tailwind Config (tailwind.config.js)"]:::deployment
        TSConfig["TSConfig (tsconfig.json)"]:::deployment
        Splash["Splash Asset (public/splash.html)"]:::deployment
    end

    %% Interactions and Data Flow
    FE -->|"sends commands"| BE
    BE -->|"returns status"| FE
    FE_Cleaner -->|"triggers"| BE_Cleaner
    FE_Downloader -->|"triggers"| BE_Downloader
    CI ---|"integrates"| FE
    CI ---|"integrates"| BE
    PackageJSON ---|"supports"| FE
    Tailwind ---|"supports"| FE
    TSConfig ---|"supports"| FE
    Splash ---|"provides asset for"| FE

    %% Internal Frontend Structure
    FE --> AstroConfig
    FE --> Pages
    FE --> Components
    FE --> Layout
    Components --> FE_Cleaner
    Components --> FE_Downloader

    %% Internal Backend Structure
    BE --> MainRS
    BE --> TauriConf
    BE --> Cargo
    BE --> BuildRS
    BE --> WindowsAPI
    BE --> BE_Cleaner
    BE --> BE_Downloader

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#003366,stroke-width:2px;
    classDef backend fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef deployment fill:#fff3cd,stroke:#856404,stroke-width:2px;

    %% Click Events for Frontend Components
    click FE "https://github.com/lambor590/kaizen/tree/master/src/"
    click AstroConfig "https://github.com/lambor590/kaizen/blob/master/astro.config.mjs"
    click Pages "https://github.com/lambor590/kaizen/tree/master/src/pages/"
    click Components "https://github.com/lambor590/kaizen/tree/master/src/components/"
    click Layout "https://github.com/lambor590/kaizen/blob/master/src/layouts/Layout.astro"
    click FE_Cleaner "https://github.com/lambor590/kaizen/blob/master/src/components/content/Cleaner.tsx"
    click FE_Downloader "https://github.com/lambor590/kaizen/blob/master/src/components/content/Downloader.tsx"

    %% Click Events for Tauri Backend Components
    click BE "https://github.com/lambor590/kaizen/tree/master/src-tauri/"
    click MainRS "https://github.com/lambor590/kaizen/blob/master/src-tauri/src/main.rs"
    click TauriConf "https://github.com/lambor590/kaizen/blob/master/src-tauri/tauri.conf.json"
    click Cargo "https://github.com/lambor590/kaizen/blob/master/Cargo.toml"
    click BuildRS "https://github.com/lambor590/kaizen/blob/master/build.rs"
    click BE_Cleaner "https://github.com/lambor590/kaizen/blob/master/src-tauri/src/tools/cleaner.rs"
    click BE_Downloader "https://github.com/lambor590/kaizen/blob/master/src-tauri/src/tools/downloader.rs"
    click WindowsAPI "https://github.com/lambor590/kaizen/blob/master/src-tauri/src/windows_api.rs"

    %% Click Events for Build & Deployment Components
    click CI "https://github.com/lambor590/kaizen/blob/master/.github/workflows/release.yml"
    click PackageJSON "https://github.com/lambor590/kaizen/blob/master/package.json"
    click Tailwind "https://github.com/lambor590/kaizen/blob/master/tailwind.config.js"
    click TSConfig "https://github.com/lambor590/kaizen/blob/master/tsconfig.json"
    click Splash "https://github.com/lambor590/kaizen/blob/master/public/splash.html"
```
