# cesardmn/vfipe architecture

> Architecture diagram of the GitHub repository cesardmn/vfipe, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cesardmn/vfipe
- Repository: https://github.com/cesardmn/vfipe

## Overview

V FIPE is a Next.js vehicle-price lookup app backed by FIPE data. The principal workflow loads reference tables, then lets users choose a vehicle type, brand, model and model year before showing prices, fuel and vehicle details. Components use shared Zustand state and a fetch service that caches responses in browser local storage. The README documents the official FIPE integration and the lookup capabilities; API routes are listed in the tree, but their implementations were not excerpted, so route-to-service relationships are documented rather than verified from source.

Main entry points: [`src/services/FetchData.js`](https://github.com/cesardmn/vfipe/blob/main/src/services/FetchData.js) (Fetch and cache), [`src/store/fipeStore.jsx`](https://github.com/cesardmn/vfipe/blob/main/src/store/fipeStore.jsx) (Lookup state), [`src/app/page.jsx`](https://github.com/cesardmn/vfipe/blob/main/src/app/page.jsx) (Home page), [`src/app/components/Content.jsx`](https://github.com/cesardmn/vfipe/blob/main/src/app/components/Content.jsx) (Lookup content)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User interface"]
  node_page["Home page<br/>[page.jsx]"]
  node_content["Lookup content<br/>[Content.jsx]"]
  node_type["Vehicle type<br/>[TypeButtons.jsx]"]
  node_reference["Reference selector<br/>[ReferenceDrop.jsx]"]
  node_result["Result dispatcher<br/>[Result.jsx]"]
  node_brands["Brand search<br/>[Brands.jsx]"]
  node_models["Model search<br/>[Models.jsx]"]
  node_vehicles["Vehicle prices<br/>[Vehicles.jsx]"]
  node_hero["Intro panel<br/>[Hero.jsx]"]
  node_header["Site header<br/>[Header.jsx]"]
  node_layout["App layout<br/>[layout.jsx]"]
end

subgraph group_lookup["Lookup API"]
  node_reference_api["Reference endpoint<br/>[route.js]"]
  node_brands_api["Brands endpoint<br/>[route.js]"]
  node_models_api["Models endpoint<br/>[route.js]"]
  node_years_api["Model years endpoint<br/>[route.js]"]
  node_vehicle_api["Vehicle endpoint<br/>[route.js]"]
end

subgraph group_state["State and data"]
  node_store["Lookup state<br/>[fipeStore.jsx]"]
  node_fetch["Fetch and cache<br/>[FetchData.js]"]
end

node_user(("Vehicle shopper"))
node_fipe["Official FIPE API"]
node_local[("Browser local storage")]

node_user -->|"opens"| node_page
node_page -->|"renders"| node_hero
node_page -->|"renders"| node_content
node_page -->|"loads reference"| node_fetch
node_page -->|"updates"| node_store
node_layout -->|"renders"| node_header
node_content -->|"renders"| node_reference
node_content -->|"renders"| node_type
node_content -->|"renders"| node_result
node_type -->|"fetches brands"| node_fetch
node_type -->|"updates"| node_store
node_brands -->|"fetches models"| node_fetch
node_brands -->|"updates"| node_store
node_models -->|"fetches model years"| node_fetch
node_models -->|"updates"| node_store
node_vehicles -->|"fetches prices"| node_fetch
node_vehicles -->|"updates"| node_store
node_result -->|"renders"| node_brands
node_result -->|"renders"| node_models
node_result -->|"renders"| node_vehicles
node_reference -->|"reads selection"| node_store
node_fetch -->|"reads and writes"| node_local
node_fetch -->|"requests"| node_reference_api
node_type -->|"requests"| node_brands_api
node_brands -->|"requests"| node_models_api
node_models -->|"requests"| node_years_api
node_vehicles -->|"requests"| node_vehicle_api
node_reference_api -.->|"queries"| node_fipe
node_brands_api -.->|"queries"| node_fipe
node_models_api -.->|"queries"| node_fipe
node_years_api -.->|"queries"| node_fipe
node_vehicle_api -.->|"queries"| node_fipe

click node_page "https://github.com/cesardmn/vfipe/blob/main/src/app/page.jsx"
click node_content "https://github.com/cesardmn/vfipe/blob/main/src/app/components/Content.jsx"
click node_type "https://github.com/cesardmn/vfipe/blob/main/src/app/components/TypeButtons.jsx"
click node_reference "https://github.com/cesardmn/vfipe/blob/main/src/app/components/ReferenceDrop.jsx"
click node_result "https://github.com/cesardmn/vfipe/blob/main/src/app/components/Result.jsx"
click node_brands "https://github.com/cesardmn/vfipe/blob/main/src/app/components/Brands.jsx"
click node_models "https://github.com/cesardmn/vfipe/blob/main/src/app/components/Models.jsx"
click node_vehicles "https://github.com/cesardmn/vfipe/blob/main/src/app/components/Vehicles.jsx"
click node_hero "https://github.com/cesardmn/vfipe/blob/main/src/app/components/Hero.jsx"
click node_header "https://github.com/cesardmn/vfipe/blob/main/src/app/components/Header.jsx"
click node_layout "https://github.com/cesardmn/vfipe/blob/main/src/app/layout.jsx"
click node_reference_api "https://github.com/cesardmn/vfipe/blob/main/src/app/api/referencia/route.js"
click node_brands_api "https://github.com/cesardmn/vfipe/blob/main/src/app/api/marcas/%5BrefId%5D/%5BtypeId%5D/route.js"
click node_models_api "https://github.com/cesardmn/vfipe/blob/main/src/app/api/modelos/%5BrefId%5D/%5BtypeId%5D/%5BbrandId%5D/route.js"
click node_years_api "https://github.com/cesardmn/vfipe/blob/main/src/app/api/anomodelo/%5BrefId%5D/%5BtypeId%5D/%5BbrandId%5D/%5BmodelId%5D/route.js"
click node_vehicle_api "https://github.com/cesardmn/vfipe/blob/main/src/app/api/vehicle/%5BrefId%5D/%5BtypeId%5D/%5BbrandId%5D/%5BmodelId%5D/%5ByearId%5D/route.js"
click node_store "https://github.com/cesardmn/vfipe/blob/main/src/store/fipeStore.jsx"
click node_fetch "https://github.com/cesardmn/vfipe/blob/main/src/services/FetchData.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_page,node_content,node_type,node_reference,node_result,node_brands,node_models,node_vehicles,node_hero,node_header,node_layout toneBlue
class node_reference_api,node_brands_api,node_models_api,node_years_api,node_vehicle_api,node_local toneAmber
class node_store,node_fetch,node_fipe toneMint
class node_user toneIndigo
```

## Components

### User interface

- [Home page](https://github.com/cesardmn/vfipe/blob/main/src/app/page.jsx): `src/app/page.jsx`
- [Lookup content](https://github.com/cesardmn/vfipe/blob/main/src/app/components/Content.jsx): `src/app/components/Content.jsx`
- [Vehicle type](https://github.com/cesardmn/vfipe/blob/main/src/app/components/TypeButtons.jsx): `src/app/components/TypeButtons.jsx`
- [Reference selector](https://github.com/cesardmn/vfipe/blob/main/src/app/components/ReferenceDrop.jsx): `src/app/components/ReferenceDrop.jsx`
- [Result dispatcher](https://github.com/cesardmn/vfipe/blob/main/src/app/components/Result.jsx): `src/app/components/Result.jsx`
- [Brand search](https://github.com/cesardmn/vfipe/blob/main/src/app/components/Brands.jsx): `src/app/components/Brands.jsx`
- [Model search](https://github.com/cesardmn/vfipe/blob/main/src/app/components/Models.jsx): `src/app/components/Models.jsx`
- [Vehicle prices](https://github.com/cesardmn/vfipe/blob/main/src/app/components/Vehicles.jsx): `src/app/components/Vehicles.jsx`
- [Intro panel](https://github.com/cesardmn/vfipe/blob/main/src/app/components/Hero.jsx): `src/app/components/Hero.jsx`
- [Site header](https://github.com/cesardmn/vfipe/blob/main/src/app/components/Header.jsx): `src/app/components/Header.jsx`
- [App layout](https://github.com/cesardmn/vfipe/blob/main/src/app/layout.jsx): `src/app/layout.jsx`

### Lookup API

- [Reference endpoint](https://github.com/cesardmn/vfipe/blob/main/src/app/api/referencia/route.js): `src/app/api/referencia/route.js`
- [Brands endpoint](https://github.com/cesardmn/vfipe/blob/main/src/app/api/marcas/%5BrefId%5D/%5BtypeId%5D/route.js): `src/app/api/marcas/[refId]/[typeId]/route.js`
- [Models endpoint](https://github.com/cesardmn/vfipe/blob/main/src/app/api/modelos/%5BrefId%5D/%5BtypeId%5D/%5BbrandId%5D/route.js): `src/app/api/modelos/[refId]/[typeId]/[brandId]/route.js`
- [Model years endpoint](https://github.com/cesardmn/vfipe/blob/main/src/app/api/anomodelo/%5BrefId%5D/%5BtypeId%5D/%5BbrandId%5D/%5BmodelId%5D/route.js): `src/app/api/anomodelo/[refId]/[typeId]/[brandId]/[modelId]/route.js`
- [Vehicle endpoint](https://github.com/cesardmn/vfipe/blob/main/src/app/api/vehicle/%5BrefId%5D/%5BtypeId%5D/%5BbrandId%5D/%5BmodelId%5D/%5ByearId%5D/route.js): `src/app/api/vehicle/[refId]/[typeId]/[brandId]/[modelId]/[yearId]/route.js`

### State and data

- [Lookup state](https://github.com/cesardmn/vfipe/blob/main/src/store/fipeStore.jsx): `src/store/fipeStore.jsx`
- [Fetch and cache](https://github.com/cesardmn/vfipe/blob/main/src/services/FetchData.js): `src/services/FetchData.js`

### Other components

- **Vehicle shopper**
- **Official FIPE API**
- **Browser local storage**

## Connections

- Vehicle shopper → Home page: opens (evidence: `README.md`)
- Home page → Intro panel: renders (evidence: `src/app/page.jsx`)
- Home page → Lookup content: renders (evidence: `src/app/page.jsx`)
- Home page → Fetch and cache: loads reference (evidence: `src/app/page.jsx`)
- Home page → Lookup state: updates (evidence: `src/app/page.jsx`)
- App layout → Site header: renders (evidence: `src/app/layout.jsx`)
- Lookup content → Reference selector: renders (evidence: `src/app/components/Content.jsx`)
- Lookup content → Vehicle type: renders (evidence: `src/app/components/Content.jsx`)
- Lookup content → Result dispatcher: renders (evidence: `src/app/components/Content.jsx`)
- Vehicle type → Fetch and cache: fetches brands (evidence: `src/app/components/TypeButtons.jsx`)
- Vehicle type → Lookup state: updates (evidence: `src/app/components/TypeButtons.jsx`)
- Brand search → Fetch and cache: fetches models (evidence: `src/app/components/Brands.jsx`)
- Brand search → Lookup state: updates (evidence: `src/app/components/Brands.jsx`)
- Model search → Fetch and cache: fetches model years (evidence: `src/app/components/Models.jsx`)
- Model search → Lookup state: updates (evidence: `src/app/components/Models.jsx`)
- Vehicle prices → Fetch and cache: fetches prices (evidence: `src/app/components/Vehicles.jsx`)
- Vehicle prices → Lookup state: updates (evidence: `src/app/components/Vehicles.jsx`)
- Result dispatcher → Brand search: renders (evidence: `src/app/components/Result.jsx`)
- Result dispatcher → Model search: renders (evidence: `src/app/components/Result.jsx`)
- Result dispatcher → Vehicle prices: renders (evidence: `src/app/components/Result.jsx`)
- Reference selector → Lookup state: reads selection (evidence: `src/app/components/ReferenceDrop.jsx`)
- Fetch and cache → Browser local storage: reads and writes (evidence: `src/services/FetchData.js`)
- Fetch and cache → Reference endpoint: requests
- Vehicle type → Brands endpoint: requests (evidence: `src/app/components/TypeButtons.jsx`)
- Brand search → Models endpoint: requests (evidence: `src/app/components/Brands.jsx`)
- Model search → Model years endpoint: requests (evidence: `src/app/components/Models.jsx`)
- Vehicle prices → Vehicle endpoint: requests (evidence: `src/app/components/Vehicles.jsx`)
- Reference endpoint → Official FIPE API: queries (evidence: `README.md`)
- Brands endpoint → Official FIPE API: queries (evidence: `README.md`)
- Models endpoint → Official FIPE API: queries (evidence: `README.md`)
- Model years endpoint → Official FIPE API: queries (evidence: `README.md`)
- Vehicle endpoint → Official FIPE API: queries (evidence: `README.md`)
