# evatorc/agencia_test architecture

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

- Interactive diagram: https://gitdiagram.com/evatorc/agencia_test
- Repository: https://github.com/evatorc/agencia_test

## Overview

Rumbo Viajes is a React travel-booking frontend: users browse destinations, compare flights and hotels, select options into a trip plan, review its total, and submit a reservation. REST supplies destination data; GraphQL supplies availability and details and handles reservations. MSW mocks both APIs. The graph preserves the documented freshness, fallback, and cache behavior. Some mock and reservation implementation files were not excerpted, so those links reflect README documentation rather than inspected implementation.

Main entry points: [`src/App.jsx`](https://github.com/evatorc/agencia_test/blob/main/src/App.jsx) (Route views), [`src/pages/MiViaje.jsx`](https://github.com/evatorc/agencia_test/blob/main/src/pages/MiViaje.jsx) (Trip summary & booking), [`src/components/OpcionesViaje.jsx`](https://github.com/evatorc/agencia_test/blob/main/src/components/OpcionesViaje.jsx) (Flight & hotel options), [`src/hooks/useApi.js`](https://github.com/evatorc/agencia_test/blob/main/src/hooks/useApi.js) (REST data hook)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Travel experience"]
  node_router["Route views<br/>[App.jsx]"]
  node_home["Home<br/>[Inicio.jsx]"]
  node_destinations["Destination search<br/>[Destinos.jsx]"]
  node_destination["Destination detail<br/>[DestinoDetalle.jsx]"]
  node_options["Flight &amp; hotel options<br/>[OpcionesViaje.jsx]"]
  node_flight["Flight detail<br/>[VueloDetalle.jsx]"]
  node_hotel["Hotel detail<br/>[HotelDetalle.jsx]"]
  node_tripview["Trip summary &amp; booking<br/>[MiViaje.jsx]"]
end

subgraph group_data["Data access"]
  node_rest_hook["REST data hook<br/>[useApi.js]"]
  node_rest_store["REST cache &amp; client<br/>[api.js]"]
  node_graphql_queries["GraphQL operations<br/>[consultas.js]"]
  node_apollo["Apollo client<br/>[cliente.js]"]
  node_freshness["GraphQL freshness"]
  node_error_map["GraphQL error mapping<br/>[errores.js]"]
end

subgraph group_plan["Trip planning"]
  node_trip_state["Trip state provider"]
  node_trip_context["Trip state context"]
  node_totals["Trip totals &amp; formatting<br/>[formato.js]"]
end

subgraph group_mock["Mock backend"]
  node_msw["MSW mock handlers<br/>[handlers.js]"]
  node_mock_schema["GraphQL mock schema<br/>[schema.js]"]
  node_mock_data[("Mock travel data<br/>[data.js]")]
  node_browser_worker["Browser worker setup<br/>[browser.js]"]
end

node_traveler(("Traveler"))

node_traveler -->|"navigates"| node_router
node_router -->|"routes to"| node_home
node_router -->|"routes to"| node_destinations
node_router -->|"routes to"| node_destination
node_router -->|"routes to"| node_flight
node_router -->|"routes to"| node_hotel
node_router -->|"routes to"| node_tripview
node_home -->|"reads destinations"| node_rest_hook
node_destinations -->|"reads destinations"| node_rest_hook
node_destination -->|"reads destination"| node_rest_hook
node_rest_hook -->|"subscribes &amp; revalidates"| node_rest_store
node_destination -->|"renders"| node_options
node_options -->|"queries availability"| node_freshness
node_options -->|"uses operation"| node_graphql_queries
node_flight -->|"queries detail"| node_freshness
node_hotel -->|"queries detail"| node_freshness
node_tripview -->|"submits reservation"| node_graphql_queries
node_freshness -->|"uses Apollo query"| node_apollo
node_tripview -->|"translates errors"| node_error_map
node_options -->|"translates errors"| node_error_map
node_tripview -->|"reads and updates plan"| node_trip_state
node_options -->|"selects options"| node_trip_state
node_trip_state -->|"provides context"| node_trip_context
node_tripview -->|"calculates total"| node_totals
node_browser_worker -->|"starts mock handlers"| node_msw
node_rest_store -->|"requests REST endpoints"| node_msw
node_apollo -->|"sends GraphQL requests"| node_msw
node_msw -->|"executes GraphQL"| node_mock_schema
node_mock_schema -.->|"resolves from data"| node_mock_data
node_tripview -->|"uses mutation cache"| node_apollo

click node_router "https://github.com/evatorc/agencia_test/blob/main/src/App.jsx"
click node_home "https://github.com/evatorc/agencia_test/blob/main/src/pages/Inicio.jsx"
click node_destinations "https://github.com/evatorc/agencia_test/blob/main/src/pages/Destinos.jsx"
click node_destination "https://github.com/evatorc/agencia_test/blob/main/src/pages/DestinoDetalle.jsx"
click node_options "https://github.com/evatorc/agencia_test/blob/main/src/components/OpcionesViaje.jsx"
click node_flight "https://github.com/evatorc/agencia_test/blob/main/src/pages/VueloDetalle.jsx"
click node_hotel "https://github.com/evatorc/agencia_test/blob/main/src/pages/HotelDetalle.jsx"
click node_tripview "https://github.com/evatorc/agencia_test/blob/main/src/pages/MiViaje.jsx"
click node_rest_hook "https://github.com/evatorc/agencia_test/blob/main/src/hooks/useApi.js"
click node_rest_store "https://github.com/evatorc/agencia_test/blob/main/src/services/api.js"
click node_graphql_queries "https://github.com/evatorc/agencia_test/blob/main/src/graphql/consultas.js"
click node_apollo "https://github.com/evatorc/agencia_test/blob/main/src/graphql/cliente.js"
click node_freshness "https://github.com/evatorc/agencia_test/blob/main/src/hooks/useConsultaVigente.js"
click node_error_map "https://github.com/evatorc/agencia_test/blob/main/src/graphql/errores.js"
click node_trip_state "https://github.com/evatorc/agencia_test/blob/main/src/context/PlanViajeProvider.jsx"
click node_trip_context "https://github.com/evatorc/agencia_test/blob/main/src/context/PlanViajeContext.js"
click node_totals "https://github.com/evatorc/agencia_test/blob/main/src/utils/formato.js"
click node_msw "https://github.com/evatorc/agencia_test/blob/main/src/mocks/handlers.js"
click node_mock_schema "https://github.com/evatorc/agencia_test/blob/main/src/mocks/schema.js"
click node_mock_data "https://github.com/evatorc/agencia_test/blob/main/src/mocks/data.js"
click node_browser_worker "https://github.com/evatorc/agencia_test/blob/main/src/mocks/browser.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_router,node_home,node_destinations,node_destination,node_options,node_flight,node_hotel,node_tripview toneBlue
class node_rest_hook,node_rest_store,node_graphql_queries,node_apollo,node_freshness,node_error_map toneAmber
class node_trip_state,node_trip_context,node_totals toneMint
class node_msw,node_mock_schema,node_mock_data,node_browser_worker toneRose
class node_traveler toneIndigo
```

## Components

### Travel experience

- [Route views](https://github.com/evatorc/agencia_test/blob/main/src/App.jsx): `src/App.jsx`
- [Home](https://github.com/evatorc/agencia_test/blob/main/src/pages/Inicio.jsx): `src/pages/Inicio.jsx`
- [Destination search](https://github.com/evatorc/agencia_test/blob/main/src/pages/Destinos.jsx): `src/pages/Destinos.jsx`
- [Destination detail](https://github.com/evatorc/agencia_test/blob/main/src/pages/DestinoDetalle.jsx): `src/pages/DestinoDetalle.jsx`
- [Flight & hotel options](https://github.com/evatorc/agencia_test/blob/main/src/components/OpcionesViaje.jsx): `src/components/OpcionesViaje.jsx`
- [Flight detail](https://github.com/evatorc/agencia_test/blob/main/src/pages/VueloDetalle.jsx): `src/pages/VueloDetalle.jsx`
- [Hotel detail](https://github.com/evatorc/agencia_test/blob/main/src/pages/HotelDetalle.jsx): `src/pages/HotelDetalle.jsx`
- [Trip summary & booking](https://github.com/evatorc/agencia_test/blob/main/src/pages/MiViaje.jsx): `src/pages/MiViaje.jsx`

### Data access

- [REST data hook](https://github.com/evatorc/agencia_test/blob/main/src/hooks/useApi.js): `src/hooks/useApi.js`
- [REST cache & client](https://github.com/evatorc/agencia_test/blob/main/src/services/api.js): `src/services/api.js`
- [GraphQL operations](https://github.com/evatorc/agencia_test/blob/main/src/graphql/consultas.js): `src/graphql/consultas.js`
- [Apollo client](https://github.com/evatorc/agencia_test/blob/main/src/graphql/cliente.js): `src/graphql/cliente.js`
- [GraphQL freshness](https://github.com/evatorc/agencia_test/blob/main/src/hooks/useConsultaVigente.js): `src/hooks/useConsultaVigente.js`
- [GraphQL error mapping](https://github.com/evatorc/agencia_test/blob/main/src/graphql/errores.js): `src/graphql/errores.js`

### Trip planning

- [Trip state provider](https://github.com/evatorc/agencia_test/blob/main/src/context/PlanViajeProvider.jsx): `src/context/PlanViajeProvider.jsx`
- [Trip state context](https://github.com/evatorc/agencia_test/blob/main/src/context/PlanViajeContext.js): `src/context/PlanViajeContext.js`
- [Trip totals & formatting](https://github.com/evatorc/agencia_test/blob/main/src/utils/formato.js): `src/utils/formato.js`

### Mock backend

- [MSW mock handlers](https://github.com/evatorc/agencia_test/blob/main/src/mocks/handlers.js): `src/mocks/handlers.js`
- [GraphQL mock schema](https://github.com/evatorc/agencia_test/blob/main/src/mocks/schema.js): `src/mocks/schema.js`
- [Mock travel data](https://github.com/evatorc/agencia_test/blob/main/src/mocks/data.js): `src/mocks/data.js`
- [Browser worker setup](https://github.com/evatorc/agencia_test/blob/main/src/mocks/browser.js): `src/mocks/browser.js`

### Other components

- **Traveler**

## Connections

- Traveler → Route views: navigates (evidence: `README.md`)
- Route views → Home: routes to (evidence: `src/App.jsx`)
- Route views → Destination search: routes to (evidence: `src/App.jsx`)
- Route views → Destination detail: routes to (evidence: `src/App.jsx`)
- Route views → Flight detail: routes to (evidence: `src/App.jsx`)
- Route views → Hotel detail: routes to (evidence: `src/App.jsx`)
- Route views → Trip summary & booking: routes to (evidence: `src/App.jsx`)
- Home → REST data hook: reads destinations (evidence: `src/pages/Inicio.jsx`)
- Destination search → REST data hook: reads destinations (evidence: `src/pages/Destinos.jsx`)
- Destination detail → REST data hook: reads destination (evidence: `src/pages/DestinoDetalle.jsx`)
- REST data hook → REST cache & client: subscribes & revalidates (evidence: `src/hooks/useApi.js`)
- Destination detail → Flight & hotel options: renders (evidence: `src/pages/DestinoDetalle.jsx`)
- Flight & hotel options → GraphQL freshness: queries availability (evidence: `src/components/OpcionesViaje.jsx`)
- Flight & hotel options → GraphQL operations: uses operation (evidence: `src/components/OpcionesViaje.jsx`)
- Flight detail → GraphQL freshness: queries detail (evidence: `src/pages/VueloDetalle.jsx`)
- Hotel detail → GraphQL freshness: queries detail (evidence: `src/pages/HotelDetalle.jsx`)
- Trip summary & booking → GraphQL operations: submits reservation (evidence: `README.md`)
- GraphQL freshness → Apollo client: uses Apollo query (evidence: `src/hooks/useConsultaVigente.js`)
- Trip summary & booking → GraphQL error mapping: translates errors (evidence: `src/pages/MiViaje.jsx`)
- Flight & hotel options → GraphQL error mapping: translates errors (evidence: `src/components/OpcionesViaje.jsx`)
- Trip summary & booking → Trip state provider: reads and updates plan (evidence: `src/pages/MiViaje.jsx`)
- Flight & hotel options → Trip state provider: selects options (evidence: `src/components/OpcionesViaje.jsx`)
- Trip state provider → Trip state context: provides context (evidence: `src/context/PlanViajeProvider.jsx`)
- Trip summary & booking → Trip totals & formatting: calculates total (evidence: `src/pages/MiViaje.jsx`)
- Browser worker setup → MSW mock handlers: starts mock handlers (evidence: `README.md`)
- REST cache & client → MSW mock handlers: requests REST endpoints (evidence: `README.md`)
- Apollo client → MSW mock handlers: sends GraphQL requests (evidence: `README.md`)
- MSW mock handlers → GraphQL mock schema: executes GraphQL (evidence: `README.md`)
- GraphQL mock schema → Mock travel data: resolves from data
- Trip summary & booking → Apollo client: uses mutation cache (evidence: `README.md`)
