# lowdefy/lowdefy-example-crud architecture

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

- Interactive diagram: https://gitdiagram.com/lowdefy/lowdefy-example-crud
- Repository: https://github.com/lowdefy/lowdefy-example-crud

## Overview

This project is a Lowdefy application built as a CRUD (Create, Read, Update, Delete) admin interface for managing data records of "brands" and "products". The lowdefy.yaml file indicates that Lowdefy is used as the application framework, and the folder structure along with the README clarifies that MongoDB is used as the underlying database, with a one-to-many relationship from brands to products.

##### Main Components
- Lowdefy Application Core: Representing the Lowdefy framework which is configured via lowdefy.yaml.
- User Interface (UI) Pages: Two main sections are evident – one for managing brands (each with separate pages for listing, creating, editing, and deleting) and another for managing products (where the listing, creation, and editing take place on a single page using drawer components).
- API/Requests Layer: Each page directory (both brands and products) contains “requests” subdirectories with YAML files that define interactions (CRUD operations). These files represent the endpoints that perform database operations.
- Shared Components: Reusable components (like the view_github component) which might be used across various pages.

##### Relationships and Interactions
- Components in "shared" provide common utilities and may interact with both products and brands pages.

##### Important Architectural Patterns and Design Principles
- Clear Separation of Concerns: Each domain (brands and products) is managed separately, with specific pages and request files.
- Modular Design: Use of YAML widgets for different functionalities (page layouts, drawers, CRUD operations) is a key pattern of Lowdefy.
- Data Flow Abstraction: The YAML files abstract direct coding details by defining operations declaratively.

##### Relevant Technologies and Frameworks
- Lowdefy Framework: Responsible for defining pages, configurations, and running the application.
- MongoDB: Handles the persistent storage of brands and products.
- YAML Configuration Files: Used throughout to define components and API endpoints.
- (Optionally) Include any shared libraries or utilities if they are documented as critical to the project’s function.

##### Specific Elements
- Clear labels for each main block: "Lowdefy Core", "Brands Pages", "Products Pages", "API/Requests Services (CRUD)", "Shared Components", and "MongoDB Database".
- From UI pages (brands and products) toward requests (CRUD operations).
- From requests to the database indicating operations (insert, update, delete, query).

##### Detailed Architecture Thinking
- Parts where business logic is abstracted in YAML configurations versus where the persistent data is stored.
- It makes sense to label “Brands API Requests” and “Products API Requests” to communicate that the patterns differ slightly between the two (e.g., products using drawer components on one page, as cited by the README).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        A["Lowdefy Core"]:::frontend
        B["Brands UI Pages"]:::frontend
        C["Products UI Page"]:::frontend
        D["Products Drawer Components"]:::frontend
        E["Shared Components"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        F["Brands API Requests"]:::backend
        G["Products API Requests"]:::backend
        H(["MongoDB Database"]):::db
    end

    %% Data Flow
    A -->|"triggers"| B
    A -->|"triggers"| C
    B -->|"sends CRUD"| F
    C -->|"opens drawer"| D
    D -->|"sends CRUD"| G
    F -->|"executes"| H
    G -->|"executes"| H
    E ---|"reused_by"| B
    E ---|"reused_by"| C

    %% Click Events
    click A "https://github.com/lowdefy/lowdefy-example-crud/blob/main/lowdefy.yaml"
    click B "https://github.com/lowdefy/lowdefy-example-crud/tree/main/pages/brands"
    click F "https://github.com/lowdefy/lowdefy-example-crud/tree/main/pages/brands/requests"
    click C "https://github.com/lowdefy/lowdefy-example-crud/blob/main/pages/products/products.yaml"
    click D "https://github.com/lowdefy/lowdefy-example-crud/tree/main/pages/products/components"
    click G "https://github.com/lowdefy/lowdefy-example-crud/tree/main/pages/products/requests"
    click E "https://github.com/lowdefy/lowdefy-example-crud/blob/main/shared/components/view_github.yaml"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef backend fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef db fill:#FFD700,stroke:#000,stroke-width:2px;
```
