# friggframework/frigg architecture

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

- Interactive diagram: https://gitdiagram.com/friggframework/frigg
- Repository: https://github.com/friggframework/frigg

## Overview

##### Main Components
- Core Framework Layer: Represent the “core” package, which includes utilities such as assertions, integration routing, error handling, logging, encryption, database connectors, and lambda functionality. This is the backbone of the framework.
- Module Plugin & Integration Layer: Include the “module-plugin” folders in the “packages/core” area that allow developers to load, manage, and interact with integrations. These provide abstractions for different external APIs.
- API Modules: Show the separate API modules and module lists (both under “docs/api-modules” and “api-module-library”) that define configurations and supported methods for various third-party integrations (e.g., Hubspot, Salesforce, ConnectWise, etc.).
- Dev Tools & CLI: Represent the “devtools” package and its CLI (frigg-cli) that streamline creation, testing, and deployment of integrations.
- User Interface: Represent the “ui” package that contains front-end components (React components, integration UI components, etc.) which facilitate configuration and interactive aspects.
- Documentation & Community Support: Although not directly part of the runtime architecture, include a note regarding the comprehensive docs (in “docs”) which support and explain the design, module configuration rules, and integration concepts.
- External Services & Serverless Infrastructure: Highlight the framework’s design for serverless deployment (via lambda functions and infrastructure-as-code approaches) and mention that this layer interacts with external APIs provided by partner services.

##### Out the Interactions and Relationships
- How the Core Layer is the central hub that ties together lower-level integrations (via the integration router, module factory, and sync components).
- Flow of data from incoming requests, through authentication and error handling (using the errors and assertions components), to database operations and logging.
- Optionally, demonstrate how lambda functions encapsulate business logic and scale via a serverless model.
- Integration-specific flows where each integration (for example, hubspot, salesforce, etc.) is implemented as a plugin that gets registered with a routing/system integration manager from the core.

##### Architectural Patterns and Design Principles
- Modular / Plugin Architecture: Stress that different integrations are built as discrete modules that register with the core system.
- Separation of Concerns: Clearly separate the integration logic (API modules), core functionality (database, logging, error handling, lambda execution), and user-facing interactions (CLI and UI).
- Reusability: Show that core functionalities like encryption, assertions, and error handling are abstracted and leveraged by all integration modules.
- Extensibility: Note that the design allows for adding new third-party integrations with minimal friction due to a shared interface and consistent configuration patterns.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Server-side Components"
        A["Core Services"]:::server
        B["Module Plugins"]:::server
        C["API Modules (Docs)"]:::server
        D["API Modules (Library)"]:::server
        J["Module List"]:::server
        E["Dev Tools & CLI"]:::server
        F["Serverless Functions"]:::server
    end

    subgraph "Client-side Components"
        G["UI Components"]:::client
    end

    H["External APIs"]:::external
    I["Documentation & Community"]:::doc

    E -->|"scaffolds"| B
    B -->|"registers"| A
    C -->|"configures"| A
    D -->|"configures"| A
    J -->|"configures"| A
    G -->|"interfaces"| A
    A -->|"calls"| F
    A -->|"integrates"| H
    H -->|"sendsRequest"| A

    click A "https://github.com/friggframework/frigg/tree/main/packages/core"
    click B "https://github.com/friggframework/frigg/tree/main/packages/core/module-plugin"
    click C "https://github.com/friggframework/frigg/tree/main/docs/api-modules"
    click D "https://github.com/friggframework/frigg/tree/main/api-module-library"
    click J "https://github.com/friggframework/frigg/tree/main/docs/api-module-library/module-list"
    click E "https://github.com/friggframework/frigg/tree/main/packages/devtools/frigg-cli"
    click G "https://github.com/friggframework/frigg/tree/main/packages/ui"
    click F "https://github.com/friggframework/frigg/tree/main/packages/core/lambda"
    click I "https://github.com/friggframework/frigg/tree/main/docs"

    classDef server fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef client fill:#98FB98,stroke:#333,stroke-width:2px;
    classDef external fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef doc fill:#FFA07A,stroke:#333,stroke-width:2px;
```
