# erdnaxelaweb/staticfakedesign architecture

> Architecture diagram of the GitHub repository erdnaxelaweb/staticfakedesign, 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/erdnaxelaweb/staticfakedesign
- Repository: https://github.com/erdnaxelaweb/staticfakedesign

## Overview

##### Main Components
- Symfony Bundle: Center around the bundle (found in the “bundle” directory) which contains controllers, dependency injection configuration, translations, and Twig templates. This is the integration point with the Symfony application.
- Frontend Assets: Organized under the “assets” folder which holds JavaScript, SCSS, and other static files providing the interface logic (including the showroom JavaScript and styling files).
- Core Logic and Domain Classes (“lib”): Contains all the business logic for component declaration, fake data generation, definitions (content, block, taxonomy etc.), templating integrations with Twig, and various utility classes.
- Documentation and Configuration: Includes the “doc” directory (with examples, markdown files, YAML config samples) which explains how to define components and static templates.
- Tests: The “tests” directory houses unit and integration tests that validate behavior of definitions, fake generators, templating, and various components.
- Development Tools: Directories like “.ddev” provide container and deployment configurations.

##### Understand Component Relationships and Interactions
- The frontend assets interact with the Symfony controllers (in the bundle) to render the showroom interface and static versions of templates.
- The controllers in the bundle invoke services from the “lib” layer. These services include the component builders, fake data generators, definition managers, and Twig templating extensions.
- The Dependency Injection and CompilerPass configurations (in “bundle/DependencyInjection”) integrate these services into Symfony’s container.
- Configuration files (YAML in “bundle/Resources/config” as well as those in “doc/example/config”) manage definitions for content, blocks, taxonomy entries, and pagers. These are consumed by the “lib” classes.
- The “lib/Fake” classes represent the logic for generating data placeholders, which are used either by the Twig templates or directly by the controllers.
- The showroom interface (under “bundle/Controller/Showroom”) uses Twig templates (e.g., in “bundle/templates/showroom”) to render component previews.
- The project also uses additional tools like webpack for asset compilation (webpack.config.js) and testing frameworks (PHPStan, ECS, etc.).

##### Architectural Patterns and Design Principles
- MVC/MVT Pattern: The bundle uses a typical Symfony MVC (or MVT) pattern. Controllers handle requests, services in “lib” manage business logic/data generation, and Twig templates (in “bundle/templates” and “doc/example/templates”) render the view.
- Component-based Design: “Component Declaration” and “Component Builder” classes emphasize reusability and encapsulation of UI components.
- Extensibility Through Configuration: The heavy use of definition files (YAML configurations for content, block, taxonomy, etc.) shows an architecture that fosters flexibility and future extension.
- Separation of Concerns: Frontend assets (JS/SCSS), backend logic (PHP in bundle and lib), and configuration/documentation (doc, YAML files) are clearly separated.

##### Relevant Technologies and Frameworks
- Symfony Framework and its Dependency Injection container.
- Twig for templating and view rendering.
- JavaScript/SCSS for client-side logic and styling (notably for the “showroom” interface).
- Composer for PHP dependency management.
- Testing tools like PHPStan, ECS, and the PHPUnit tests in “tests”.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend Assets Layer"
        FA["JavaScript & SCSS – UI Logic/Styling"]:::assets
    end

    subgraph "Symfony Bundle Layer"
        SC["Showroom Controller – renders component previews"]:::bundle
        DIC["Dependency Injection – injects services"]:::bundle
        TT["Twig Templates – renders static previews"]:::bundle
    end

    subgraph "Core Logic (Lib) Layer"
        CB["Component Builder – builds UI components"]:::lib
        FD["Fake Data Generators – generates placeholder data"]:::lib
        DM["Definition Managers – reads YAML definitions"]:::lib
    end

    subgraph "Documentation & Configuration"
        DOC["YAML & Markdown Config – component definitions"]:::doc
    end

    subgraph "Testing Layer"
        TESTS["Unit & Integration Tests – quality assurance"]:::tests
    end

    subgraph "Development Tools"
        DEV["DDEV & Webpack – Deployment & Build Tools"]:::tools
    end

    %% Connections between layers
    FA -->|"triggers"| SC
    SC -->|"calls"| CB
    SC -->|"calls"| FD
    DIC -->|"injects"| CB
    DIC -->|"injects"| FD
    DIC -->|"injects"| DM
    DOC -->|"defines"| DM
    CB -->|"renders_via"| TT
    FD -->|"renders_via"| TT
    DM -->|"renders_via"| TT
    DEV -->|"builds"| FA
    TESTS --- SC
    TESTS --- CB
    TESTS --- FD
    TESTS --- DM

    %% Click Events
    click SC "https://github.com/erdnaxelaweb/staticfakedesign/tree/main/bundle/Controller"
    click DIC "https://github.com/erdnaxelaweb/staticfakedesign/tree/main/bundle/DependencyInjection"
    click TT "https://github.com/erdnaxelaweb/staticfakedesign/tree/main/bundle/templates"
    click FA "https://github.com/erdnaxelaweb/staticfakedesign/tree/main/assets/js"
    click CB "https://github.com/erdnaxelaweb/staticfakedesign/tree/main/lib"
    click FD "https://github.com/erdnaxelaweb/staticfakedesign/tree/main/lib"
    click DM "https://github.com/erdnaxelaweb/staticfakedesign/tree/main/lib"
    click DOC "https://github.com/erdnaxelaweb/staticfakedesign/tree/main/doc"
    click TESTS "https://github.com/erdnaxelaweb/staticfakedesign/tree/main/tests"
    click DEV "https://github.com/erdnaxelaweb/staticfakedesign/blob/main/.ddev"

    %% Styles
    classDef bundle fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef lib fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef assets fill:#FFA500,stroke:#000,stroke-width:2px;
    classDef doc fill:#FFFF99,stroke:#000,stroke-width:2px;
    classDef tests fill:#DDA0DD,stroke:#000,stroke-width:2px;
    classDef tools fill:#D3D3D3,stroke:#000,stroke-width:2px;
```
