# maycon-crz/sdui_craftd_getx architecture

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

## Overview

##### Main Components
- Flutter Frontend: Represent the overall Flutter application. Since this is a cross-platform project, include representations for Android, iOS, web, and desktop clients if needed.
- SDUI Engine: Since the project is built around a server-driven UI, illustrate the component or service that handles the dynamic JSON definitions (from the PHP server) and compiles them into Flutter views.
- API/Networking Layer: Include an API layer with components like the “rest_client.dart” and “api_path.dart”. This layer is critical for integration with the external PHP server.
- Local Database: Show the ObjectBox storage component with its generated files (objectbox.g.dart, database definitions) which are used for caching or offline storage.

##### Relationships and Data Flows
- UI and modules with the local database component (ObjectBox) to indicate state persistence and caching.
- Flow within modules (authentication: loginPage → loginController → loginRepository, etc.) to emphasize MVC/MVVM style separation using GetX.

##### Architectural Patterns and Technologies
- Multi-layered (modular) architecture, showing how modules are isolated by their responsibilities.
- That this SDUI approach involves a dynamic UI generation, so the JSON served by the PHP backend is “compiled” for Flutter representation.
- ObjectBox integration—mention both the dependency configuration (in pubspec.yaml) and the generation of objects (objectbox.g.dart) as part of the database layer.

- Use clear labels on each component (e.g., “Authentication Module”, “Home Module”, “API Client”, “SDUI Engine”, “ObjectBox Database”).

## Diagram (Mermaid)

```mermaid
graph TD
    %% Main Components
    A["Flutter Frontend"]:::frontend
    B["Routing & State Management (GetX)"]:::routing
    C["SDUI Engine"]:::sdui
    D["Custom UI Components"]:::custom
    
    %% Modules
    subgraph "Authentication Module"
        E1["Login Binding"]:::module
        E2["Login Controller"]:::module
        E3["Login Repository"]:::module
        E4["Login Page"]:::module
        E1 --> E2
        E2 --> E3
        E3 --> E4
        %% API integration from repository
        E3 -->|"calls API"| H
        %% Local persistence
        E4 -->|"stores state"| I
    end

    subgraph "Home Module"
        F1["Home Binding"]:::module
        F2["Home Controller"]:::module
        F3["Home Repository"]:::module
        F4["Home Page"]:::module
        F1 --> F2
        F2 --> F3
        F3 --> F4
        %% API integration from repository
        F3 -->|"calls API"| H
        %% Local persistence
        F4 -->|"stores state"| I
    end

    %% API and Storage layers
    H["API/Networking Layer"]:::api
    I["Local Database (ObjectBox)"]:::database
    J["External PHP Server"]:::external

    %% Data Flow Connections
    A -->|"initializes"| B
    A -->|"renders UI"| C
    A -->|"uses"| D
    B -->|"routes to"| E1
    B -->|"routes to"| F1
    C <-->|"fetches JSON"| H
    H -->|"REST calls"| J

    %% Additional connections from modules to local database
    %% (already defined within module subgraphs via login_page/home_page)

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef routing fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef sdui fill:#FFB6C1,stroke:#000,stroke-width:2px;
    classDef custom fill:#FFA07A,stroke:#000,stroke-width:2px;
    classDef module fill:#EEE8AA,stroke:#000,stroke-width:2px;
    classDef api fill:#DDA0DD,stroke:#000,stroke-width:2px;
    classDef database fill:#F0E68C,stroke:#000,stroke-width:2px;
    classDef external fill:#87CEFA,stroke:#000,stroke-width:2px;

    %% Click Events for components
    click A "https://github.com/maycon-crz/sdui_craftd_getx/blob/main/lib/main.dart"
    click B "https://github.com/maycon-crz/sdui_craftd_getx/tree/main/lib/routes"
    click C "https://github.com/maycon-crz/sdui_craftd_getx/blob/main/assets/dynamic.json"
    click C "https://github.com/maycon-crz/sdui_craftd_getx/blob/main/lib/api/rest_client.dart"
    click D "https://github.com/maycon-crz/sdui_craftd_getx/tree/main/lib/custom"
    click H "https://github.com/maycon-crz/sdui_craftd_getx/tree/main/lib/api"
    click I "https://github.com/maycon-crz/sdui_craftd_getx/tree/main/lib/database"
    click E1 "https://github.com/maycon-crz/sdui_craftd_getx/tree/main/lib/modules/authentication"
    click F1 "https://github.com/maycon-crz/sdui_craftd_getx/tree/main/lib/modules/home"
```
