# arrudacaio/fiscaliza architecture

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

## Overview

##### Project type and purpose
- This is a single-page application built with React.js, packaged and served by a minimal Node/Express static server (server.js + Procfile).
- Purpose: let users view and explore ongoing parliamentary spending by fetching data from the external “Dados Abertos” API.

##### File structure
- Top level:
- server.js & Procfile – an Express app that serves the compiled React bundle.
- public/index.html – the HTML entry point.
- package.json / package-lock.json – dependencies and scripts (build, start).
- src/ directory:
- src/index.js + src/App.js – React bootstrap and root component.
- src/routes.js – React Router setup for page navigation.
- src/pages/Main – main view that renders fetched data.
- src/components/Card – reusable Card component with its own styles.
- src/services/api.js – encapsulates all HTTP calls to the external API.
- src/utils – any helper functions.
- No internal database; all data comes from a third-party REST API.

##### README for additional insights
- Describes learning goals (consuming external APIs, React patterns).
- Highlights the external “Dados Abertos” endpoint as the data source.

##### Elements
- Browser → Server (static file fetch)
- React → External API (data fetch)
- CI/CD → Hosting
- Front-end (blue rectangles)
- Server/Deployment (green rectangles)
- External systems (orange ovals)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Clients
    Browser["Browser / Client"]:::frontend

    %% Server
    StaticServer["Node/Express Server"]:::server
    PublicHTML["public/index.html"]:::frontend

    %% React SPA
    subgraph "React SPA"
        direction TB
        IDX["src/index.js"]:::frontend
        App["src/App.js"]:::frontend
        Routes["src/routes.js"]:::frontend
        subgraph "Pages"
            direction TB
            MainPage["src/pages/Main/index.js"]:::frontend
            MainStyles["src/pages/Main/styles.css"]:::frontend
        end
        subgraph "Components"
            direction TB
            CardComp["src/components/Card/Card.js"]:::frontend
            CardStyles["src/components/Card/styles.css"]:::frontend
        end
        subgraph "Services"
            direction TB
            API["src/services/api.js"]:::frontend
        end
        subgraph "Utils"
            direction TB
            Utils["src/utils/index.js"]:::frontend
        end
    end

    %% External API
    ExternalAPI("Dados Abertos API"):::external

    %% Deployment
    GitRepo["Git Repository"]:::deploy
    CI["CI/CD Pipeline (Procfile)"]:::deploy
    Hosting["Hosting (Netlify/Heroku)"]:::deploy

    %% Connections
    Browser -->|HTTP GET index.html| StaticServer
    StaticServer -->|serves HTML| PublicHTML
    StaticServer -->|serves SPA assets| IDX
    PublicHTML --> IDX
    IDX -->|"bootstrap App"| App
    App -->|"loads routes"| Routes
    Routes -->|"renders Main page"| MainPage
    MainPage -->|"uses styles"| MainStyles
    MainPage -->|"renders card"| CardComp
    CardComp -->|"uses styles"| CardStyles
    MainPage -->|"uses utils"| Utils
    MainPage -->|"fetchData()"| API
    API -->|"HTTP GET"| ExternalAPI
    ExternalAPI -->|"JSON response"| API
    API -->|"data"| MainPage

    GitRepo --> CI
    CI -->|npm build & deploy| Hosting

    %% Click Events
    click IDX "https://github.com/arrudacaio/fiscaliza/blob/master/src/index.js"
    click App "https://github.com/arrudacaio/fiscaliza/blob/master/src/App.js"
    click Routes "https://github.com/arrudacaio/fiscaliza/blob/master/src/routes.js"
    click MainPage "https://github.com/arrudacaio/fiscaliza/blob/master/src/pages/Main/index.js"
    click MainStyles "https://github.com/arrudacaio/fiscaliza/blob/master/src/pages/Main/styles.css"
    click CardComp "https://github.com/arrudacaio/fiscaliza/blob/master/src/components/Card/Card.js"
    click CardStyles "https://github.com/arrudacaio/fiscaliza/blob/master/src/components/Card/styles.css"
    click API "https://github.com/arrudacaio/fiscaliza/blob/master/src/services/api.js"
    click Utils "https://github.com/arrudacaio/fiscaliza/blob/master/src/utils/index.js"
    click StaticServer "https://github.com/arrudacaio/fiscaliza/blob/master/server.js"
    click PublicHTML "https://github.com/arrudacaio/fiscaliza/blob/master/public/index.html"
    click CI "https://github.com/arrudacaio/fiscaliza/tree/master/Procfile"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef server fill:#90EE90,stroke:#000,stroke-width:1px
    classDef external fill:#FFA500,stroke:#000,stroke-width:1px
    classDef deploy fill:#C0C0C0,stroke:#000,stroke-width:1px
```
