# diogomatheus/taco-visualizer architecture

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

- Interactive diagram: https://gitdiagram.com/diogomatheus/taco-visualizer
- Repository: https://github.com/diogomatheus/taco-visualizer

## Overview

##### Project type and purpose
- This is a single-page web application (Angular front-end) called “TACO Visualizer.”
- It provides nutrition professionals an interface to browse, compare and compose meals using data from the Brazilian Food Composition Table (TACO).

##### File structure
- Top-level build & config files: Dockerfile, compose.yaml, angular.json, tsconfig*, karma.conf.js, protractor.conf.js, GitHub Actions workflows.
- `src/app`: Angular modules, routing, components (`food-list`, `food-dialog`), pages (`home`, `about`, `builder`, `comparator`), shared services & pipes.
- `src/assets/data`: static JSON files (foods.json, food-attribute-groups.json) as the data source.
- `src/assets/i18n`: XLIFF files for translations.
- `e2e`: Protractor end-to-end tests.
- `package.json` & lock: dependencies and scripts.

##### README for additional insights
- Framework: Angular (TypeScript)
- Deployment: Docker Compose sets up a container (likely an Nginx or Node static-server) to serve the built SPA.
- Continuous deployment: GitHub Actions workflows build, test, release artifacts.

a. Main components
- Developer environment (Node + Angular CLI)
- CI/CD pipeline (GitHub Actions)
- Container build & orchestration (Dockerfile + compose.yaml)
- Web server container (e.g., Nginx serving static files)
- Angular Single-Page Application
- Static data store (JSON files under `assets/data`)
- Client browser

b. Relationships & interactions
- Developer → commits → GitHub Actions (build → unit tests → E2E tests → Docker image build → push)
- Docker Compose → brings up Web server container
- Browser → HTTP(S) requests → Web server container → serves `index.html`, JS bundles, JSON assets, translation files
- Angular app (in browser) → calls internal Services → loads JSON → populates Components & Pages

c. Architectural patterns & design principles
- Modular Angular architecture:
- App module / App-bootstrap module
- Feature modules mapped to “pages”
- Shared services & pipes for data access & transformations
- Client-side routing (App-routing module)
- Static data as read-only “micro-service” (no dynamic back-end)
- Containerization for environment parity

d. Relevant technologies
- Angular (Components, Modules, Services, Routing, Pipes)
- TypeScript
- Docker & Docker Compose
- GitHub Actions (CI/CD)
- Protractor & Karma (testing)
- XLIFF (i18n)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Developer Workstation"
        Dev["Developer (VSCode, Node, Angular CLI)"]:::developer
        PKG["package.json"]:::developer
        ANGCFG["angular.json"]:::developer
    end
    click PKG "https://github.com/diogomatheus/taco-visualizer/blob/master/package.json"
    click ANGCFG "https://github.com/diogomatheus/taco-visualizer/blob/master/angular.json"

    subgraph "CI/CD Pipeline"
        GH["GitHub Actions"]:::cicd
        WF1["continuous-deployment.yml"]:::cicd
        WF2["release.yml"]:::cicd
    end
    click WF1 "https://github.com/diogomatheus/taco-visualizer/blob/master/.github/workflows/continuous-deployment.yml"
    click WF2 "https://github.com/diogomatheus/taco-visualizer/blob/master/.github/workflows/release.yml"

    Dev --> GH

    subgraph "Container Build & Orchestration"
        DF["Dockerfile"]:::container
        COMP["compose.yaml"]:::container
    end
    click DF "https://github.com/diogomatheus/taco-visualizer/tree/master/Dockerfile"
    click COMP "https://github.com/diogomatheus/taco-visualizer/blob/master/compose.yaml"

    GH --> DF
    DF --> COMP

    subgraph "Web Server Container"
        NGINX["Nginx Static Server"]:::container
    end
    COMP --> NGINX

    subgraph "Runtime Flow"
        Browser["Browser (User)"]:::ui
        Browser -->|"HTTP Request"| NGINX
        NGINX -->|"Serves index.html, bundles, JSON, XLIFF"| Browser
    end

    subgraph "Angular SPA"
        INDEX["index.html"]:::app
        MAIN["main.ts"]:::app
        AppBoot["app-bootstrap.module.ts"]:::app
        AppMod["app.module.ts"]:::app
        AppRoute["app-routing.module.ts"]:::app

        subgraph "Feature Pages"
            Home["home.component.ts"]:::app
            Builder["builder.component.ts"]:::app
            Comparator["comparator.component.ts"]:::app
            About["about.component.ts"]:::app
        end

        subgraph "UI Components"
            FoodList["food-list.component.ts"]:::app
            FoodDialog["food-dialog.component.ts"]:::app
        end

        subgraph "Services"
            FoodSvc["food.service.ts"]:::app
            CatSvc["food-category.service.ts"]:::app
            AttrGrpSvc["food-attribute-group.service.ts"]:::app
            I18nSvc["i18n.service.ts"]:::app
            PagIntlSvc["mat-paginator-intl-i18n.service.ts"]:::app
        end

        subgraph "Pipes"
            AttrPipe["food-attribute-pipe.ts"]:::app
            I18nPipe["i18n-pipe.ts"]:::app
        end

        subgraph "Models"
            MFood["food.ts"]:::app
            MAttr["food-attribute.ts"]:::app
            MAttrGrp["food-attribute-group.ts"]:::app
        end

        INDEX --> MAIN
        MAIN --> AppBoot
        AppBoot --> AppMod
        AppMod --> AppRoute

        AppMod --> Home
        AppMod --> Builder
        AppMod --> Comparator
        AppMod --> About

        AppMod --> FoodList
        AppMod --> FoodDialog

        AppMod --> FoodSvc
        AppMod --> CatSvc
        AppMod --> AttrGrpSvc
        AppMod --> I18nSvc
        AppMod --> PagIntlSvc

        AppMod --> AttrPipe
        AppMod --> I18nPipe

        FoodSvc --> MFood
        FoodSvc --> MAttr
        FoodSvc --> MAttrGrp

        Home --> FoodList
        Builder --> FoodList
        Comparator --> FoodList
        About --> FoodList
    end

    click INDEX "https://github.com/diogomatheus/taco-visualizer/blob/master/src/index.html"
    click MAIN "https://github.com/diogomatheus/taco-visualizer/blob/master/src/main.ts"
    click AppBoot "https://github.com/diogomatheus/taco-visualizer/blob/master/src/app/app-bootstrap.module.ts"
    click AppMod "https://github.com/diogomatheus/taco-visualizer/blob/master/src/app/app.module.ts"
    click AppRoute "https://github.com/diogomatheus/taco-visualizer/blob/master/src/app/app-routing.module.ts"
    click Home "https://github.com/diogomatheus/taco-visualizer/blob/master/src/app/pages/home/home.component.ts"
    click Builder "https://github.com/diogomatheus/taco-visualizer/blob/master/src/app/pages/builder/builder.component.ts"
    click Comparator "https://github.com/diogomatheus/taco-visualizer/blob/master/src/app/pages/comparator/comparator.component.ts"
    click About "https://github.com/diogomatheus/taco-visualizer/blob/master/src/app/pages/about/about.component.ts"
    click FoodList "https://github.com/diogomatheus/taco-visualizer/blob/master/src/app/components/food-list/food-list.component.ts"
    click FoodDialog "https://github.com/diogomatheus/taco-visualizer/blob/master/src/app/components/food-dialog/food-dialog.component.ts"
    click FoodSvc "https://github.com/diogomatheus/taco-visualizer/blob/master/src/app/shared/service/food.service.ts"
    click CatSvc "https://github.com/diogomatheus/taco-visualizer/blob/master/src/app/shared/service/food-category.service.ts"
    click AttrGrpSvc "https://github.com/diogomatheus/taco-visualizer/blob/master/src/app/shared/service/food-attribute-group.service.ts"
    click I18nSvc "https://github.com/diogomatheus/taco-visualizer/blob/master/src/app/shared/service/i18n.service.ts"
    click PagIntlSvc "https://github.com/diogomatheus/taco-visualizer/blob/master/src/app/shared/service/mat-paginator-intl-i18n.service.ts"
    click AttrPipe "https://github.com/diogomatheus/taco-visualizer/blob/master/src/app/shared/pipe/food-attribute-pipe.ts"
    click I18nPipe "https://github.com/diogomatheus/taco-visualizer/blob/master/src/app/shared/pipe/i18n-pipe.ts"
    click MFood "https://github.com/diogomatheus/taco-visualizer/blob/master/src/app/shared/model/food.ts"
    click MAttr "https://github.com/diogomatheus/taco-visualizer/blob/master/src/app/shared/model/food-attribute.ts"
    click MAttrGrp "https://github.com/diogomatheus/taco-visualizer/blob/master/src/app/shared/model/food-attribute-group.ts"

    subgraph "Static Data Store"
        FoodsJSON["foods.json"]:::data
        AttrGrpJSON["food-attribute-groups.json"]:::data
    end
    click FoodsJSON "https://github.com/diogomatheus/taco-visualizer/blob/master/src/assets/data/foods.json"
    click AttrGrpJSON "https://github.com/diogomatheus/taco-visualizer/blob/master/src/assets/data/food-attribute-groups.json"

    Browser -->|"Fetch JSON"| FoodsJSON
    Browser -->|"Fetch JSON"| AttrGrpJSON

    subgraph "i18n Files"
        XLF1["messages.xlf"]:::data
        XLF2["messages.en-US.xlf"]:::data
        XLF3["messages.pt-BR.xlf"]:::data
    end
    click XLF1 "https://github.com/diogomatheus/taco-visualizer/blob/master/src/assets/i18n/messages.xlf"
    click XLF2 "https://github.com/diogomatheus/taco-visualizer/blob/master/src/assets/i18n/messages.en-US.xlf"
    click XLF3 "https://github.com/diogomatheus/taco-visualizer/blob/master/src/assets/i18n/messages.pt-BR.xlf"

    NGINX --> XLF1
    NGINX --> XLF2
    NGINX --> XLF3

    classDef developer fill:#D3C0EB,stroke:#000
    classDef cicd fill:#C8A2C8,stroke:#000
    classDef container fill:#A0C4FF,stroke:#000
    classDef ui fill:#C4FCEF,stroke:#000
    classDef app fill:#E0FFE0,stroke:#000
    classDef data fill:#FFD6A5,stroke:#000
```
