# sgarg5858/dynamic-forms-poc architecture

> Architecture diagram of the GitHub repository sgarg5858/dynamic-forms-poc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sgarg5858/dynamic-forms-poc
- Repository: https://github.com/sgarg5858/dynamic-forms-poc

## Overview

##### Project type and purpose
- This is an Nx-powered Angular monorepo containing:
- A “shell” Angular application (apps/shell) that demonstrates a dynamic form proof-of-concept.
- Several publishable Angular libraries under libs/ (dynamic-forms, input-errors, personal-details, infrastructure/interfaces).
- An end-to-end test project (apps/shell-e2e).
- The goal is to build a highly extensible, component-driven dynamic form system, factoring out each control type into its own library module, with shared interfaces and configurable error handling.

##### File structure
- Top-level configs: angular.json, nx.json, tsconfig.base.json—govern workspace layout, build targets, TypeScript resolution.
- apps/shell: the host Angular application that imports and renders dynamic forms using the libraries.
- apps/shell-e2e: Cypress tests for the shell app.
- libs/dynamic-forms: core dynamic form engine (components, resolver service, pipes, tokens).
- libs/input-errors: library handling error-state matching, directives, error components.
- libs/personal-details: example feature library built on top of dynamic-forms (a form for personal details).
- libs/infrastructure/interfaces: shared TypeScript interfaces (DynamicControlConfig, DynamicFormConfig).
- tools/generators: (empty here) potential Nx code generators for scaffolding.

##### README for additional insights
- It walks through POC “bits” (basic approach, adding form-group support, error handling enhancements).
- Emphasizes SOLID principles, dynamic component resolution via ngComponentOutlet, ViewProviders for ControlContainer, and Configurable ErrorStateMatcher.
- Confirms the tech stack: Angular + Nx + Jest + Cypress.

##### Detailed capture of essential elements
- Nx workspace as the outer container.
- Libs by domain: Core (dynamic-forms, interfaces), Feature (personal-details), Utility (input-errors).
- Injection of ControlContainer and the configurable ErrorStateMatcher pipeline.
- E2E test runner invoking the shell app on localhost, driving UI through Cypress.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Workspace Container
    subgraph "Nx Workspace"
        direction TB
        Workspace["/"]:::tool

        subgraph "Applications"
            direction TB
            Shell["apps/shell"]:::app
            E2E["apps/shell-e2e"]:::test
        end

        subgraph "Libraries"
            direction TB
            subgraph "Core Libraries"
                direction TB
                DynForms["libs/dynamic-forms"]:::lib
                Interfaces["libs/infrastructure/interfaces"]:::lib
            end
            subgraph "Feature Libraries"
                direction TB
                PersonalDetails["libs/personal-details"]:::lib
            end
            subgraph "Utility Libraries"
                direction TB
                InputErrors["libs/input-errors"]:::lib
            end
        end

        subgraph "Tooling"
            direction TB
            Generators["tools/generators"]:::tool
        end

        %% CI/CD
        CICD["Nx Cloud / Build Pipeline"]:::tool
    end

    %% Relationships
    Shell -->|"imports"| DynForms
    Shell -->|"imports"| InputErrors
    Shell -->|"imports"| PersonalDetails

    DynForms -->|"depends on"| Interfaces
    InputErrors -->|"depends on"| Interfaces
    PersonalDetails -->|"depends on"| DynForms
    PersonalDetails -->|"depends on"| Interfaces

    E2E -->|"runs tests against"| Shell
    Workspace -->|"orchestrates builds/tests"| Shell
    Workspace -->|"orchestrates builds/tests"| E2E
    Workspace -->|"orchestrates builds/tests"| DynForms
    Workspace -->|"orchestrates builds/tests"| InputErrors
    Workspace -->|"orchestrates builds/tests"| PersonalDetails
    Workspace -->|"orchestrates builds/tests"| Interfaces
    Workspace -->|"orchestrates builds/tests"| Generators
    Workspace -->|"orchestrates builds/tests"| CICD

    %% Click Events
    click Workspace "https://github.com/sgarg5858/dynamic-forms-poc/tree/main//"
    click Shell "https://github.com/sgarg5858/dynamic-forms-poc/tree/main/apps/shell"
    click E2E "https://github.com/sgarg5858/dynamic-forms-poc/tree/main/apps/shell-e2e"
    click DynForms "https://github.com/sgarg5858/dynamic-forms-poc/tree/main/libs/dynamic-forms"
    click InputErrors "https://github.com/sgarg5858/dynamic-forms-poc/tree/main/libs/input-errors"
    click PersonalDetails "https://github.com/sgarg5858/dynamic-forms-poc/tree/main/libs/personal-details"
    click Interfaces "https://github.com/sgarg5858/dynamic-forms-poc/tree/main/libs/infrastructure/interfaces"
    click Generators "https://github.com/sgarg5858/dynamic-forms-poc/tree/main/tools/generators"

    %% Styles
    classDef app fill:#d0e7ff,stroke:#0066cc,stroke-width:2px
    classDef lib fill:#e0f7e9,stroke:#28a745,stroke-width:2px
    classDef test fill:#ffe8cc,stroke:#ff8800,stroke-width:2px
    classDef tool fill:#f0f0f0,stroke:#888888,stroke-width:2px
```
