# onedesign/craft-starter architecture

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

- Interactive diagram: https://gitdiagram.com/onedesign/craft-starter
- Repository: https://github.com/onedesign/craft-starter

## Overview

##### Main Components
- DDEV Infrastructure: Clearly illustrate that local development is containerized through DDEV. Represent the Docker containers (for PHP/Apache/Nginx, Node, and possibly a separate database container) and highlight that commands like “ddev composer”, “ddev npm”, and “ddev craft” are consistently used.
- Craft CMS Application ("app" directory): Show the core backend, including:
- Application bootstrap (bootstrap.php)
- Configuration files (in app/config, app/config/project, etc.)
- Template rendering (Twig templates in app/templates)
- Craft plugins (like Servd, CKEditor, Imager X, etc.) integrated as part of the business logic.
- Storage and routing (e.g., .env file, routes.php)
- Entry point and assets (src/entry.html, src/scripts/main.js)
- Styles (Tailwind CSS setup with postcss.config.js and tailwind.config.js, SCSS files in src/styles)
- Static assets (images and fonts in src/static)
- Theme configurations (theme/config files for additional customization)
- External Services or Plugins: Identify key Craft plugins such as Servd for assets and hosting, CKEditor, SEOMatic, etc. Also, note any external database and hosting interactions if available.

##### Relationships and Data Flow
- Data flow between the frontend build process (Vite, Tailwind CSS) and the Craft backend. For example, show how the built CSS and JavaScript files are injected into the Twig templates.
- Dependency flows from configuration files to runtime behavior (e.g., composer.json for PHP backend dependencies and package.json for Node dependencies).

##### Architectural Patterns and Design Principles
- Separation of Concerns: Illustrate that the project cleanly divides frontend (Vite, assets, styling) from backend (Craft CMS, PHP, database connections) logic.
- Containerization: Emphasize how DDEV and Docker localize and encapsulate the environment, ensuring consistency across development and production.
- Modular Configuration: Highlight the extensive use of configuration files in the “app/config” and “app/config/project” directories, which enable environment-specific and project-specific settings.
- Third-Party Integrations: Point out the integration of third-party services via Craft plugins (e.g., Servd for asset management, image optimization with Imager X).

## Diagram (Mermaid)

```mermaid
flowchart TB
    BS["Build System & Package Management"]:::build
    DDEV["DDEV Infrastructure (Docker)"]:::infra

    subgraph "Craft CMS Container"
        CC1["Craft CMS Application - Bootstrap & Configurations"]:::backend
        CC2["Craft CMS Templates & Storage"]:::backend
        CC3["Craft CMS Plugins & Extensions"]:::backend
    end

    subgraph "Node/Vite Container"
        FV1["Frontend Tooling & Assets (Vite & Tailwind)"]:::frontend
        FV2["Theme Configuration & Customization (Theme)"]:::frontend
    end

    %% Connections
    BS --> DDEV
    DDEV --> CC1
    DDEV --> FV1
    DDEV --> CC3
    FV1 -->|"injects_assets"| CC2

    %% Click Events
    click DDEV "https://github.com/onedesign/craft-starter/blob/main/.ddev"
    click CC1 "https://github.com/onedesign/craft-starter/blob/main/app/bootstrap.php"
    click CC2 "https://github.com/onedesign/craft-starter/tree/main/app/templates"
    click CC3 "https://github.com/onedesign/craft-starter/tree/main/app/config"
    click FV1 "https://github.com/onedesign/craft-starter/tree/main/src"
    click FV2 "https://github.com/onedesign/craft-starter/tree/main/theme"
    click BS "https://github.com/onedesign/craft-starter/blob/main/package.json"

    %% Styles
    classDef infra fill:#85C1E9,stroke:#1B4F72,stroke-width:2px;
    classDef backend fill:#A9DFBF,stroke:#145A32,stroke-width:2px;
    classDef frontend fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef build fill:#E8DAEF,stroke:#512E5F,stroke-width:2px;
```
