# frappe/builder architecture

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

- Interactive diagram: https://gitdiagram.com/frappe/builder
- Repository: https://github.com/frappe/builder

## Overview

Based on our analysis of the file tree and README, Frappe Builder is a low-code website builder project that splits its functionality across a Python backend (integrated with the Frappe Framework) and a Vue-based frontend (using Vite and Frappe UI). It is designed not only as a visual page editor with one-click publishing but also to integrate seamlessly into the Frappe ecosystem.

##### Main components
- Frontend Application – This lives under the “frontend” folder and contains the Vue components, pages (e.g., PageBuilder.vue, Dashboard, PagePreview), configuration files (tailwind.config.js, vite.config.mjs), and related assets. It is responsible for the interactive visual builder interface.
- Backend Application – Located in the “builder” directory, this Python-based module handles API endpoints, doctype (document type) definitions, builder components, patches, and integration with Frappe. It implements the core business logic, file templating, and publishing functionality.
- Containerization & Deployment Artifacts – With Docker-related directories and .github workflows (for docker-image, release, tests), it’s valuable to include the deployment pipeline, container orchestration (docker-compose), and CI/CD components.
- External Tools and Dependencies – Highlight integrations with external services such as Frappe’s hosted services (Frappe Cloud) and related external libraries.

##### Relationships and interactions
- Container/deployment layer where Docker and docker-compose bring up services that combine the frontend and backend into a production-ready environment.
- With CI/CD workflows and configuration files (.github/workflows), represent a continuous integration pipeline that automates testing, release notes, and docker image creation.

##### Architectural patterns and design principles
- Separation of Concerns: Distinct modules for frontend (visual builder) and backend (business logic, templating) ensure clarity and modularity.
- MVC / Component-based Patterns: The frontend adheres to a component hierarchy (seen in the “components” folder), while the backend uses discrete doctype modules (like builder_page, builder_component, etc.) to encapsulate functionality.
- Containerization for deployment and a clear CI/CD process as seen in GitHub workflows and Docker configurations.

##### Relevant technologies and frameworks
- Frontend: Vue, Vite, Tailwind CSS, Cypress (for testing), and the Frappe UI library.
- Backend: Python, Frappe Framework, and Frappe-specific configurations (doctype definitions and patches).
- DevOps: Docker, docker-compose, GitHub Actions for integration, and deployment scripts.
- Development Tools: Pre-commit hooks, VSCode settings, and lint configurations.

- Use clear, descriptive labels for each module/component (e.g., “Frontend UI”, “Builder API”, “Frappe CMS Integration”, “Docker Deployment”).
- Configuration components (e.g., docker-compose, CI/CD workflows) that highlight the deployment and testing setup.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Frontend Layer"
        FE("Frontend Application"):::frontend
    end

    subgraph "Backend Layer"
        BE("Backend Application"):::backend
        FR("Frappe Framework Integration"):::backend2
    end

    subgraph "Deployment & CI/CD"
        CI("CI/CD Workflows"):::deployment
        DOCK("Docker Config"):::deployment
        DEV("DevContainer"):::deployment
    end

    subgraph "External Dependencies"
        FEDEP("Frontend Dependencies"):::external
        BEDEP("Backend Dependencies"):::external
    end

    FE -->|"API calls"| BE
    BE -->|"CMS integration"| FR
    CI -->|"Deploys"| DOCK
    DOCK -->|"Includes"| DEV
    DOCK -->|"Deploys"| FE
    DOCK -->|"Deploys"| BE
    FEDEP -->|"Supports"| FE
    BEDEP -->|"Supports"| BE

    click FE "https://github.com/frappe/builder/tree/develop/frontend/"
    click BE "https://github.com/frappe/builder/tree/develop/builder/"
    click FR "https://github.com/frappe/builder/blob/develop/builder/hooks.py"
    click DEV "https://github.com/frappe/builder/tree/develop/.devcontainer/"
    click DOCK "https://github.com/frappe/builder/tree/develop/docker/"
    click CI "https://github.com/frappe/builder/tree/develop/.github/workflows/"
    click FEDEP "https://github.com/frappe/builder/blob/develop/package.json"
    click BEDEP "https://github.com/frappe/builder/blob/develop/pyproject.toml"

    classDef frontend fill:#a2d2ff,stroke:#333,stroke-width:2px;
    classDef backend fill:#ffafcc,stroke:#333,stroke-width:2px;
    classDef backend2 fill:#ffc6ff,stroke:#333,stroke-width:2px;
    classDef deployment fill:#fcf4a3,stroke:#333,stroke-width:2px;
    classDef external fill:#caffbf,stroke:#333,stroke-width:2px;
```
