# textilflow-curso-open-source/frontend architecture

> Architecture diagram of the GitHub repository textilflow-curso-open-source/frontend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/textilflow-curso-open-source/frontend
- Repository: https://github.com/textilflow-curso-open-source/frontend

## Overview

##### Project type and purpose
- This is a full-stack prototype (front-end heavy) consisting of an Angular single-page application (SPA) and a lightweight JSON-server “backend” for local testing. The Angular app (“TextilFlowFrontEnd”) implements user authentication, role-based views (businessman, supplier), batch processing, configuration, observations, and requests workflows. It is hosted via Firebase Hosting.

##### File structure
- Top-level:
- src/ – Angular application sources
- public/ – static assets and internationalization files
- server/ – JSON-server configuration (db.json, routes.json, start scripts) for mock API
- firebase.json / .firebaserc – Firebase Hosting config
- angular.json, tsconfig*.json, package.json – build and dependency configs
- Inside src/app/:
- auth/ – models, services, login/register/role-selector views
- batch/, businessman/, supplier/, configuration/, observation/, requests/ – feature modules: each has components, models, services
- core/ – shared UI components (buttons, cards, inputs, notifications, theme switcher) and base services
- app.routes.ts, app.config.ts – application routing and configuration
- Environment config under src/environments/
- Public assets under src/assets/themes and src/public/assets

##### README for additional insights
- Standard Angular CLI project with ng serve, ng build, Karma tests, e2e tests. No explicit backend instructions other than local JSON-server.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Entities
    Browser["Browser (User)"]:::external
    Firebase["Firebase Hosting"]:::gray
    JSONServer["JSON-Server Mock API"]:::api
    DB["db.json (Mock Database)"]:::gray

    %% Angular SPA
    subgraph "Angular SPA" 
        direction TB
        subgraph "Presentation Layer" 
            direction TB
            AuthModule["Auth Module"]:::frontend
            BatchModule["Batch Module"]:::frontend
            BusinessmanModule["Businessman Module"]:::frontend
            SupplierModule["Supplier Module"]:::frontend
            ConfigurationModule["Configuration Module"]:::frontend
            ObservationModule["Observation Module"]:::frontend
            RequestsModule["Requests Module"]:::frontend
        end
        subgraph "Core Services & Components"
            direction TB
            Core["Shared Core (Components & Services)"]:::frontend
        end
        subgraph "Routing & Config"
            direction TB
            Routing["Client-side Routing"]:::frontend
            AppConfig["App Configuration"]:::frontend
            Environments["Environment Configurations"]:::frontend
        end
        subgraph "Assets"
            direction TB
            I18n["i18n JSON Files"]:::frontend
            Themes["Theme Stylesheets"]:::frontend
        end
    end

    %% Startup scripts & routes
    subgraph "JSON-Server Config"
        direction TB
        DbJson["server/db.json"]:::gray
        Routes["server/routes.json"]:::api
        Scripts["server/start scripts"]:::api
    end

    %% Relationships
    Browser -->|"GET index.html"| Firebase
    Firebase -->|Serves SPA| Browser
    Browser -->|Runs Angular App| Routing
    Routing -->|Lazy loads| AuthModule
    Routing -->|Lazy loads| BatchModule
    Routing -->|Lazy loads| BusinessmanModule
    Routing -->|Lazy loads| SupplierModule
    Routing -->|Lazy loads| ConfigurationModule
    Routing -->|Lazy loads| ObservationModule
    Routing -->|Lazy loads| RequestsModule

    AuthModule -->|uses| Core
    BatchModule -->|uses| Core
    BusinessmanModule -->|uses| Core
    SupplierModule -->|uses| Core
    ConfigurationModule -->|uses| Core
    ObservationModule -->|uses| Core
    RequestsModule -->|uses| Core

    Core -->|injects| Routing
    Core -->|reads| AppConfig
    Core -->|reads| Environments
    Core -->|applies| Themes
    Core -->|reads| I18n

    AuthModule -->|HttpClient| JSONServer
    BatchModule -->|HttpClient| JSONServer
    BusinessmanModule -->|HttpClient| JSONServer
    SupplierModule -->|HttpClient| JSONServer
    ConfigurationModule -->|HttpClient| JSONServer
    ObservationModule -->|HttpClient| JSONServer
    RequestsModule -->|HttpClient| JSONServer

    JSONServer -->|uses routes| Routes
    JSONServer -->|reads/writes| DbJson
    Scripts -->|start server| JSONServer

    %% Click Events
    click AuthModule "https://github.com/textilflow-curso-open-source/frontend/tree/main/src/app/auth"
    click BatchModule "https://github.com/textilflow-curso-open-source/frontend/tree/main/src/app/batch"
    click BusinessmanModule "https://github.com/textilflow-curso-open-source/frontend/tree/main/src/app/businessman"
    click SupplierModule "https://github.com/textilflow-curso-open-source/frontend/tree/main/src/app/supplier"
    click ConfigurationModule "https://github.com/textilflow-curso-open-source/frontend/tree/main/src/app/configuration"
    click ObservationModule "https://github.com/textilflow-curso-open-source/frontend/tree/main/src/app/observation"
    click RequestsModule "https://github.com/textilflow-curso-open-source/frontend/tree/main/src/app/requests"
    click Core "https://github.com/textilflow-curso-open-source/frontend/tree/main/src/app/core"
    click Routing "https://github.com/textilflow-curso-open-source/frontend/blob/main/src/app/app.routes.ts"
    click AppConfig "https://github.com/textilflow-curso-open-source/frontend/blob/main/src/app/app.config.ts"
    click Environments "https://github.com/textilflow-curso-open-source/frontend/tree/main/src/environments"
    click I18n "https://github.com/textilflow-curso-open-source/frontend/tree/main/public/assets"
    click Themes "https://github.com/textilflow-curso-open-source/frontend/tree/main/src/assets/themes"
    click DbJson "https://github.com/textilflow-curso-open-source/frontend/blob/main/server/db.json"
    click Routes "https://github.com/textilflow-curso-open-source/frontend/blob/main/server/routes.json"
    click Scripts "https://github.com/textilflow-curso-open-source/frontend/blob/main/server/start.bat"
    click Scripts "https://github.com/textilflow-curso-open-source/frontend/blob/main/server/start.sh"
    click Firebase "https://github.com/textilflow-curso-open-source/frontend/blob/main/firebase.json"
    click Firebase "https://github.com/textilflow-curso-open-source/frontend/blob/main/.firebaserc"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366d6,color:#0366d6
    classDef api fill:#DFF7D8,stroke:#28A745,color:#28A745
    classDef gray fill:#F2F2F2,stroke:#666666,color:#333333
    classDef external fill:#FFF4D6,stroke:#DBA506,color:#DBA506
```
