# macasrenata/ipaam-monitoring architecture

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

## Overview

##### Project type and purpose
- This is a Next.js-based full-stack web application (“IPAAM Monitoring App”) for visualizing, filtering, and exporting logging-permit data in the Amazon region.
- The frontend is built with React/Next.js (the “app” directory using Next.js 13+ conventions). The backend consists of Next.js API routes serving JSON (“app/api/dados/route.ts”) and static data files in “public/”.

##### File structure
- Top-level config: next.config.ts, tsconfig.json, vercel.json (indicates Vercel deployment), package.json/.lock.
- app/ directory:
- api/dados/route.ts – serverless API endpoint that reads JSON from public/data*.json
- components/ (Filtro.tsx, Tabela.tsx) – reusable UI widgets
- layout.tsx, globals.css – global layout and styles
- page.tsx & produtos/page.tsx – main routes (“/” and “/produtos”)
- public/: contains data.json & data23.json (source datasets) plus static assets/fonts, etc.

##### README
- Confirms it’s a data-driven dashboard using open data (Sinaflor, DOF) and CSV export.
- No external DB; data is preprocessed and stored as JSON.
- Deployment on Vercel; uses Next.js dev script.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph "Client (Frontend)"
        direction TB
        Home["Home Page"]:::frontend
        Produtos["Produtos Page"]:::frontend
        subgraph "UI Components"
            direction TB
            Filtro["Filtro"]:::frontend
            Tabela["Tabela"]:::frontend
        end
        subgraph "Global Layout & Styles"
            direction TB
            Layout["Layout"]:::frontend
            GlobalsCSS["globals.css"]:::frontend
            PageCSS["page.module.css"]:::frontend
        end
    end

    %% Vercel Hosting
    subgraph "Vercel"
        direction TB
        subgraph "Serverless API (Backend)"
            API["API Route /api/dados"]:::backend
        end
        subgraph "Static Data Store"
            Data1["data.json"]:::datastore
            Data23["data23.json"]:::datastore
        end
        subgraph "Deployment & Config"
            NextConfig["next.config.ts"]:::deployment
            VercelCfg["vercel.json"]:::deployment
            TSConfig["tsconfig.json"]:::deployment
            NextEnv["next-env.d.ts"]:::deployment
        end
    end

    %% External Data
    External["External Data Sources\n(Sinaflor/DOF)"]:::external

    %% Data Flows
    Home -->|"renders"| Filtro
    Home -->|"renders"| Tabela
    Produtos -->|"renders"| Filtro
    Produtos -->|"renders"| Tabela
    Filtro -->|"fetches data"| API
    Tabela -->|"fetches data"| API
    API -->|"reads"| Data1
    API -->|"reads"| Data23
    API -->|"returns JSON"| Home
    API -->|"returns JSON"| Produtos
    External -->|"updates data files"| Data1
    External -->|"updates data files"| Data23

    %% Hosting Relationships
    Vercel -->|"hosts page"| Home
    Vercel -->|"hosts page"| Produtos
    Vercel -->|"hosts API"| API
    Vercel -->|"hosts static files"| Data1
    Vercel -->|"hosts static files"| Data23

    %% Click Events
    click Home "https://github.com/macasrenata/ipaam-monitoring/blob/main/app/page.tsx"
    click Produtos "https://github.com/macasrenata/ipaam-monitoring/blob/main/app/produtos/page.tsx"
    click Filtro "https://github.com/macasrenata/ipaam-monitoring/blob/main/app/components/Filtro.tsx"
    click Tabela "https://github.com/macasrenata/ipaam-monitoring/blob/main/app/components/Tabela.tsx"
    click Layout "https://github.com/macasrenata/ipaam-monitoring/blob/main/app/layout.tsx"
    click GlobalsCSS "https://github.com/macasrenata/ipaam-monitoring/blob/main/app/globals.css"
    click PageCSS "https://github.com/macasrenata/ipaam-monitoring/blob/main/app/page.module.css"
    click API "https://github.com/macasrenata/ipaam-monitoring/blob/main/app/api/dados/route.ts"
    click Data1 "https://github.com/macasrenata/ipaam-monitoring/blob/main/public/data.json"
    click Data23 "https://github.com/macasrenata/ipaam-monitoring/blob/main/public/data23.json"
    click NextConfig "https://github.com/macasrenata/ipaam-monitoring/blob/main/next.config.ts"
    click VercelCfg "https://github.com/macasrenata/ipaam-monitoring/blob/main/vercel.json"
    click TSConfig "https://github.com/macasrenata/ipaam-monitoring/blob/main/tsconfig.json"
    click NextEnv "https://github.com/macasrenata/ipaam-monitoring/blob/main/next-env.d.ts"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366d6,color:#0366d6
    classDef backend fill:#D0FFD0,stroke:#28a745,color:#28a745
    classDef datastore fill:#F0F0F0,stroke:#6a737d,color:#6a737d
    classDef deployment fill:#FFD0FF,stroke:#6f42c1,color:#6f42c1
    classDef external fill:#FFE0B2,stroke:#d9534f,color:#d9534f
```
