# lironer/bundlemon architecture

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

- Interactive diagram: https://gitdiagram.com/lironer/bundlemon
- Repository: https://github.com/lironer/bundlemon

## Overview

##### Main Components
The system consists of several key components that should be represented:

a. Core Components:
- CLI Tool (packages/bundlemon)
- Service Backend (apps/service)
- Web Interface (apps/website)
- Utility Packages (packages/bundlemon-utils, packages/bundlemon-markdown-output)

b. External Integrations:
- GitHub API
- CI Systems (GitHub Actions, Travis, CircleCI, Codefresh)
- MongoDB (for data storage)

**┌─ Client Layer ─────────────────────────────────────┐**
- Web Interface (React)                            │
- CLI Tool                                         │
- ┘
- ↕
**┌─ API Layer ──────────────────────────────────────┐**
- REST API Endpoints                             │
- Authentication Middleware                      │
- GitHub Integration                             │
- ┘
- ↕
**┌─ Service Layer ───────────────────────────────────┐**
- Bundle Analysis                                 │
- Report Generation                               │
- Project Management                              │
- ┘
- ↕
**┌─ Data Layer ─────────────────────────────────────┐**
- MongoDB                                        │
- File Storage                                   │
- ┘

##### Component Details

For each component, show:

a. CLI Tool:
- File Analyzer
- Report Generator
- CI Integration
- GitHub Integration

b. Service Backend:
- API Routes
- Controllers
- Authentication
- Project Management
- Record Management

c. Web Interface:
- User Management
- Project Dashboard
- Reports Visualization
- Settings Management

Following interactions:
- CLI → Service (Bundle analysis submission)
- Service → GitHub (Status updates, comments)
- Web Interface → Service (API requests)
- Service → Database (Data persistence)

##### Additional Elements

Important aspects:
- Security boundaries
- API endpoints
- Authentication flow
- CI/CD integration points

##### Notes

Important notes about:
- Scalability points
- Security measures
- Integration requirements
- Configuration options

##### Security boundaries and authentication flows

Remember to maintain a balance between detail and clarity, focusing on the architectural decisions that impact the system's functionality and scalability.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef frontend fill:#e1f5fe,stroke:#01579b
    classDef backend fill:#e8f5e9,stroke:#1b5e20
    classDef database fill:#fff3e0,stroke:#e65100
    classDef external fill:#f3e5f5,stroke:#4a148c
    classDef cli fill:#e8eaf6,stroke:#1a237e
    classDef utils fill:#fce4ec,stroke:#880e4f

    %% Client Layer
    subgraph ClientLayer
        WebUI["Web Interface"]
        CLI["CLI Tool"]
    end

    %% API Layer
    subgraph APILayer
        API["REST API"]
        AuthMiddleware["Authentication Middleware"]
        GithubIntegration["GitHub Integration"]
    end

    %% Service Layer
    subgraph ServiceLayer
        BundleAnalysis["Bundle Analysis"]
        ReportGen["Report Generation"]
        ProjectMgmt["Project Management"]
        RecordMgmt["Record Management"]
    end

    %% Data Layer
    subgraph DataLayer
        MongoDB[(MongoDB)]
        FileStorage["File Storage"]
    end

    %% External Systems
    GithubAPI["GitHub API"]
    CISystems["CI Systems"]

    %% Utility Packages
    BundleMonUtils["BundleMon Utils"]
    MarkdownOutput["Markdown Output"]

    %% Relationships
    CLI --> API
    CLI --> CISystems
    WebUI --> API
    API --> AuthMiddleware
    API --> GithubIntegration
    GithubIntegration --> GithubAPI
    AuthMiddleware --> ServiceLayer
    BundleAnalysis --> ReportGen
    ServiceLayer --> MongoDB
    ServiceLayer --> FileStorage
    BundleMonUtils --> CLI
    MarkdownOutput --> ReportGen

    %% Click Events
    click CLI "https://github.com/LironEr/bundlemon/blob/main/packages/bundlemon/bin/bundlemon.ts"
    click BundleAnalysis "https://github.com/LironEr/bundlemon/tree/main/packages/bundlemon/lib/main/analyzer/"
    click ReportGen "https://github.com/LironEr/bundlemon/tree/main/packages/bundlemon/lib/main/report/"
    click GithubIntegration "https://github.com/LironEr/bundlemon/blob/main/packages/bundlemon/lib/main/outputs/outputs/github.ts"
    click API "https://github.com/LironEr/bundlemon/tree/main/apps/service/src/routes/api/"
    click AuthMiddleware "https://github.com/LironEr/bundlemon/blob/main/apps/service/src/middlewares/auth.ts"
    click ProjectMgmt "https://github.com/LironEr/bundlemon/blob/main/apps/service/src/controllers/projectsController.ts"
    click RecordMgmt "https://github.com/LironEr/bundlemon/blob/main/apps/service/src/controllers/commitRecordsController.ts"
    click WebUI "https://github.com/LironEr/bundlemon/blob/main/apps/website/src/pages/HomePage.tsx"
    click BundleMonUtils "https://github.com/LironEr/bundlemon/tree/main/packages/bundlemon-utils/"
    click MarkdownOutput "https://github.com/LironEr/bundlemon/tree/main/packages/bundlemon-markdown-output/"
    click MongoDB "https://github.com/LironEr/bundlemon/tree/main/apps/service/src/framework/mongo/"

    %% Styling
    class WebUI frontend
    class CLI cli
    class API,AuthMiddleware,GithubIntegration backend
    class BundleAnalysis,ReportGen,ProjectMgmt,RecordMgmt backend
    class MongoDB,FileStorage database
    class GithubAPI,CISystems external
    class BundleMonUtils,MarkdownOutput utils
```
