# antonny890/rutas-beta architecture

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

- Interactive diagram: https://gitdiagram.com/antonny890/rutas-beta
- Repository: https://github.com/antonny890/rutas-beta

## Overview

ENRUTA is an Arequipa public-transit interface for passengers, drivers, and administrators. The main passenger workflow is to explore live bus and route information, choose a route or stops, and request a fare estimate; authenticated users enter role-specific workspaces. Shared React context holds user, fleet, route, and fare state, with sample transit data and geographic fare calculations supporting the interface. The supplied excerpts show a mock-data-backed frontend, not a connected transit backend. Some driver and administrative details are visible only through imports or UI excerpts, so their internal behavior is summarized conservatively.

Main entry points: [`src/App.tsx`](https://github.com/antonny890/rutas-beta/blob/main/src/App.tsx) (Role workspace), [`src/context/AppContext.tsx`](https://github.com/antonny890/rutas-beta/blob/main/src/context/AppContext.tsx) (Application state), [`src/components/passenger/PassengerView.tsx`](https://github.com/antonny890/rutas-beta/blob/main/src/components/passenger/PassengerView.tsx) (Passenger workspace), [`src/data/mockData.ts`](https://github.com/antonny890/rutas-beta/blob/main/src/data/mockData.ts) (Transit sample data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application shell"]
  node_app["Role workspace<br/>[App.tsx]"]
end

subgraph group_passenger["Passenger tools"]
  node_passenger_view["Passenger workspace<br/>[PassengerView.tsx]"]
  node_live_map["Live transit map<br/>[ArequipaMap.tsx]"]
  node_trip_planner["Trip fare planner<br/>[TripPlanner.tsx]"]
  node_route_catalog["Route catalog<br/>[RoutesCatalog.tsx]"]
  node_bus_detail["Bus details<br/>[BusDetailModal.tsx]"]
end

subgraph group_operations["Transit operations"]
  node_driver["Driver workspace<br/>[DriverView.tsx]"]
  node_admin["Admin dashboard<br/>[AdminView.tsx]"]
end

subgraph group_shared["Shared state and data"]
  node_geo["Fare and geography<br/>[geoUtils.ts]"]
  node_context["Application state<br/>[AppContext.tsx]"]
  node_mock["Transit sample data<br/>[mockData.ts]"]
  node_types["Transit domain types<br/>[index.ts]"]
end

subgraph group_access["Access and navigation"]
  node_login["Login screen<br/>[LoginScreen.tsx]"]
  node_auth["Authentication modal<br/>[AuthModal.tsx]"]
  node_header["Role header<br/>[Header.tsx]"]
  node_bottom_nav["Bottom navigation<br/>[BottomNav.tsx]"]
  node_toast["Toast notifications<br/>[ToastContainer.tsx]"]
end

node_user(("Transit user"))

node_user -->|"opens"| node_app
node_app -->|"provides state"| node_context
node_app -->|"shows when signed out"| node_login
node_app -->|"renders"| node_auth
node_app -->|"renders"| node_header
node_app -->|"renders"| node_bottom_nav
node_app -->|"renders"| node_toast
node_app -->|"selects by role"| node_passenger_view
node_app -->|"selects by role"| node_driver
node_app -->|"selects by role"| node_admin
node_passenger_view -->|"reads state"| node_context
node_passenger_view -->|"renders"| node_live_map
node_passenger_view -->|"renders"| node_trip_planner
node_passenger_view -->|"renders"| node_route_catalog
node_passenger_view -->|"renders"| node_bus_detail
node_trip_planner -->|"calculates fare"| node_geo
node_trip_planner -->|"reads state"| node_context
node_route_catalog -->|"reads routes"| node_context
node_live_map -->|"reads fleet state"| node_context
node_live_map -->|"uses map center"| node_mock
node_bus_detail -->|"reads state"| node_context
node_driver -->|"uses shared state"| node_context
node_admin -->|"reads and updates"| node_context
node_auth -->|"updates access state"| node_context
node_auth -->|"uses default users"| node_mock
node_context -->|"initializes transit state"| node_mock
node_context -->|"uses geographic helpers"| node_geo
node_geo -->|"uses coverage constants"| node_mock
node_mock -->|"types transit records"| node_types
node_geo -->|"returns fare quote"| node_types

click node_app "https://github.com/antonny890/rutas-beta/blob/main/src/App.tsx"
click node_passenger_view "https://github.com/antonny890/rutas-beta/blob/main/src/components/passenger/PassengerView.tsx"
click node_live_map "https://github.com/antonny890/rutas-beta/blob/main/src/components/map/ArequipaMap.tsx"
click node_trip_planner "https://github.com/antonny890/rutas-beta/blob/main/src/components/passenger/TripPlanner.tsx"
click node_route_catalog "https://github.com/antonny890/rutas-beta/blob/main/src/components/passenger/RoutesCatalog.tsx"
click node_bus_detail "https://github.com/antonny890/rutas-beta/blob/main/src/components/passenger/BusDetailModal.tsx"
click node_geo "https://github.com/antonny890/rutas-beta/blob/main/src/utils/geoUtils.ts"
click node_driver "https://github.com/antonny890/rutas-beta/blob/main/src/components/driver/DriverView.tsx"
click node_admin "https://github.com/antonny890/rutas-beta/blob/main/src/components/admin/AdminView.tsx"
click node_context "https://github.com/antonny890/rutas-beta/blob/main/src/context/AppContext.tsx"
click node_mock "https://github.com/antonny890/rutas-beta/blob/main/src/data/mockData.ts"
click node_types "https://github.com/antonny890/rutas-beta/blob/main/src/types/index.ts"
click node_login "https://github.com/antonny890/rutas-beta/blob/main/src/components/auth/LoginScreen.tsx"
click node_auth "https://github.com/antonny890/rutas-beta/blob/main/src/components/auth/AuthModal.tsx"
click node_header "https://github.com/antonny890/rutas-beta/blob/main/src/components/common/Header.tsx"
click node_bottom_nav "https://github.com/antonny890/rutas-beta/blob/main/src/components/common/BottomNav.tsx"
click node_toast "https://github.com/antonny890/rutas-beta/blob/main/src/components/common/ToastContainer.tsx"

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_app,node_user toneBlue
class node_passenger_view,node_live_map,node_trip_planner,node_route_catalog,node_bus_detail toneAmber
class node_driver,node_admin toneMint
class node_geo,node_context,node_mock,node_types toneRose
class node_login,node_auth,node_header,node_bottom_nav,node_toast toneIndigo
```

## Components

### Application shell

- [Role workspace](https://github.com/antonny890/rutas-beta/blob/main/src/App.tsx): `src/App.tsx`

### Passenger tools

- [Passenger workspace](https://github.com/antonny890/rutas-beta/blob/main/src/components/passenger/PassengerView.tsx): `src/components/passenger/PassengerView.tsx`
- [Live transit map](https://github.com/antonny890/rutas-beta/blob/main/src/components/map/ArequipaMap.tsx): `src/components/map/ArequipaMap.tsx`
- [Trip fare planner](https://github.com/antonny890/rutas-beta/blob/main/src/components/passenger/TripPlanner.tsx): `src/components/passenger/TripPlanner.tsx`
- [Route catalog](https://github.com/antonny890/rutas-beta/blob/main/src/components/passenger/RoutesCatalog.tsx): `src/components/passenger/RoutesCatalog.tsx`
- [Bus details](https://github.com/antonny890/rutas-beta/blob/main/src/components/passenger/BusDetailModal.tsx): `src/components/passenger/BusDetailModal.tsx`

### Transit operations

- [Driver workspace](https://github.com/antonny890/rutas-beta/blob/main/src/components/driver/DriverView.tsx): `src/components/driver/DriverView.tsx`
- [Admin dashboard](https://github.com/antonny890/rutas-beta/blob/main/src/components/admin/AdminView.tsx): `src/components/admin/AdminView.tsx`

### Shared state and data

- [Fare and geography](https://github.com/antonny890/rutas-beta/blob/main/src/utils/geoUtils.ts): `src/utils/geoUtils.ts`
- [Application state](https://github.com/antonny890/rutas-beta/blob/main/src/context/AppContext.tsx): `src/context/AppContext.tsx`
- [Transit sample data](https://github.com/antonny890/rutas-beta/blob/main/src/data/mockData.ts): `src/data/mockData.ts`
- [Transit domain types](https://github.com/antonny890/rutas-beta/blob/main/src/types/index.ts): `src/types/index.ts`

### Access and navigation

- [Login screen](https://github.com/antonny890/rutas-beta/blob/main/src/components/auth/LoginScreen.tsx): `src/components/auth/LoginScreen.tsx`
- [Authentication modal](https://github.com/antonny890/rutas-beta/blob/main/src/components/auth/AuthModal.tsx): `src/components/auth/AuthModal.tsx`
- [Role header](https://github.com/antonny890/rutas-beta/blob/main/src/components/common/Header.tsx): `src/components/common/Header.tsx`
- [Bottom navigation](https://github.com/antonny890/rutas-beta/blob/main/src/components/common/BottomNav.tsx): `src/components/common/BottomNav.tsx`
- [Toast notifications](https://github.com/antonny890/rutas-beta/blob/main/src/components/common/ToastContainer.tsx): `src/components/common/ToastContainer.tsx`

### Other components

- **Transit user**

## Connections

- Transit user → Role workspace: opens
- Role workspace → Application state: provides state (evidence: `src/App.tsx`)
- Role workspace → Login screen: shows when signed out (evidence: `src/App.tsx`)
- Role workspace → Authentication modal: renders (evidence: `src/App.tsx`)
- Role workspace → Role header: renders (evidence: `src/App.tsx`)
- Role workspace → Bottom navigation: renders (evidence: `src/App.tsx`)
- Role workspace → Toast notifications: renders (evidence: `src/App.tsx`)
- Role workspace → Passenger workspace: selects by role (evidence: `src/App.tsx`)
- Role workspace → Driver workspace: selects by role (evidence: `src/App.tsx`)
- Role workspace → Admin dashboard: selects by role (evidence: `src/App.tsx`)
- Passenger workspace → Application state: reads state (evidence: `src/components/passenger/PassengerView.tsx`)
- Passenger workspace → Live transit map: renders (evidence: `src/components/passenger/PassengerView.tsx`)
- Passenger workspace → Trip fare planner: renders (evidence: `src/components/passenger/PassengerView.tsx`)
- Passenger workspace → Route catalog: renders (evidence: `src/components/passenger/PassengerView.tsx`)
- Passenger workspace → Bus details: renders (evidence: `src/components/passenger/PassengerView.tsx`)
- Trip fare planner → Fare and geography: calculates fare (evidence: `src/components/passenger/TripPlanner.tsx`)
- Trip fare planner → Application state: reads state (evidence: `src/components/passenger/TripPlanner.tsx`)
- Route catalog → Application state: reads routes (evidence: `src/components/passenger/RoutesCatalog.tsx`)
- Live transit map → Application state: reads fleet state (evidence: `src/components/map/ArequipaMap.tsx`)
- Live transit map → Transit sample data: uses map center (evidence: `src/components/map/ArequipaMap.tsx`)
- Bus details → Application state: reads state (evidence: `src/components/passenger/BusDetailModal.tsx`)
- Driver workspace → Application state: uses shared state (evidence: `src/components/driver/DriverView.tsx`)
- Admin dashboard → Application state: reads and updates (evidence: `src/components/admin/AdminView.tsx`)
- Authentication modal → Application state: updates access state (evidence: `src/components/auth/AuthModal.tsx`)
- Authentication modal → Transit sample data: uses default users (evidence: `src/components/auth/AuthModal.tsx`)
- Application state → Transit sample data: initializes transit state (evidence: `src/context/AppContext.tsx`)
- Application state → Fare and geography: uses geographic helpers (evidence: `src/context/AppContext.tsx`)
- Fare and geography → Transit sample data: uses coverage constants (evidence: `src/utils/geoUtils.ts`)
- Transit sample data → Transit domain types: types transit records (evidence: `src/data/mockData.ts`)
- Fare and geography → Transit domain types: returns fare quote (evidence: `src/utils/geoUtils.ts`)
