# luigi-menor/frontend-revida architecture

> Architecture diagram of the GitHub repository luigi-menor/frontend-revida, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/luigi-menor/frontend-revida
- Repository: https://github.com/luigi-menor/frontend-revida

## Overview

1. **Project type and runtime**
   - This is a **single-page React application** built with **Vite**.
   - The repo is organized around client-side routing, shared state, and API-backed data fetching rather than server-rendered pages.

2. **Application entry and composition**
   - `src/main.jsx` is the bootstrap point that mounts the React app.
   - `src/App.jsx` is the top-level composition layer, likely wiring together routing, layout, and route protection.
   - `src/App.css` and `src/index.css` provide global and app-level styling.

3. **Page-level boundaries**
   - `src/pages/` contains the main route targets:
     - `LoginPage.jsx`
     - `RegisterPage.jsx`
     - `DashboardPage.jsx`
     - `FamiliesPage.jsx`
     - `FamilyDetailPage.jsx`
   - These pages represent the app’s main user journeys: authentication, overview/dashboard, browsing families, and viewing a family detail view.

4. **Routing and access control**
   - `src/guards/ProtectedRoute.jsx` indicates a route boundary that blocks unauthenticated access.
   - The protected routes likely cover the dashboard and family-related pages, while login/register remain public.
   - This creates a clear split between public authentication flows and authenticated application areas.

5. **Shared navigation/layout**
   - `src/components/Navbar.jsx` is the main shared UI component in the tree.
   - It likely provides top-level navigation and reflects auth state, such as showing login/logout actions or links to protected sections.
   - This suggests a common shell around the page views rather than fully isolated screens.

6. **Authentication state subsystem**
   - `src/store/authStore.js` is the central auth state store.
   - `src/hooks/useAuth.js` is a custom hook that likely exposes auth state and actions to components.
   - Together, these form the authentication boundary for login status, user identity, and session-related behavior.

7. **Domain state subsystem**
   - `src/store/familiesStore.js` manages the app’s family-related state.
   - This store likely holds the current list of families, selected family details, loading state, and possibly cached results.
   - It is the client-side state boundary for the main business domain outside authentication.

8. **API/data access layer**
   - `src/services/api.js` is the shared API client layer, likely centralizing base URL, request handling, and common HTTP behavior.
   - `src/services/familiesApi.js` is a domain-specific adapter for family-related endpoints.
   - The architecture cleanly separates transport concerns from page and state logic: UI calls stores/hooks, which delegate to service modules.

9. **Data flow through the app**
   - User actions originate in page components.
   - Pages interact with auth/families stores through hooks or direct store usage.
   - Stores call service modules, which use the shared API client to communicate with the backend.
   - Returned data is stored centrally and then rendered back into the page components.

10. **Static assets and build tooling**
   - `src/assets/` holds bundled frontend assets such as images or icons.
   - `vite.config.js` and `package.json` indicate the build/dev environment is managed through Vite and standard npm tooling.
   - `eslint.config.js` shows linting is part of the development workflow.

11. **Testing boundary**
   - `src/App.test.jsx` indicates at least one test layer exists around the app shell.
   - This suggests the architecture includes basic validation of top-level rendering or routing behavior, though the test scope appears small from the tree.

12. **High-level mental model for a diagram**
   - Draw the app as a layered frontend:
     - **UI pages/components**
     - **Auth and domain state stores**
     - **Service/API layer**
     - **External backend**
   - Add a separate control path for **route protection**, which depends on auth state before allowing access to private pages.

Main entry points: [`src/App.jsx`](https://github.com/luigi-menor/frontend-revida/blob/main/src/App.jsx) (App), [`src/store/authStore.js`](https://github.com/luigi-menor/frontend-revida/blob/main/src/store/authStore.js) (Auth Store), [`src/hooks/useAuth.js`](https://github.com/luigi-menor/frontend-revida/blob/main/src/hooks/useAuth.js) (useAuth), [`src/store/familiesStore.js`](https://github.com/luigi-menor/frontend-revida/blob/main/src/store/familiesStore.js) (Families Store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_g_ui["UI Shell"]
  node_n_main["main<br/>bootstrap<br/>[main.jsx]"]
  node_n_app["App<br/>shell<br/>[App.jsx]"]
  node_n_nav["Navbar<br/>shared-ui<br/>[Navbar.jsx]"]
  node_n_protected{{"Protected<br/>route-guard<br/>[ProtectedRoute.jsx]"}}
  node_n_login["Login<br/>page<br/>[LoginPage.jsx]"]
  node_n_register["Register<br/>page<br/>[RegisterPage.jsx]"]
  node_n_dashboard["Dashboard<br/>page<br/>[DashboardPage.jsx]"]
  node_n_families["Families<br/>page<br/>[FamiliesPage.jsx]"]
  node_n_family_detail["Family Detail<br/>page"]
end

subgraph group_g_state["State"]
  node_n_useauth["useAuth<br/>hook<br/>[useAuth.js]"]
  node_n_auth_store[("Auth Store<br/>state-store<br/>[authStore.js]")]
  node_n_families_store[("Families Store<br/>state-store<br/>[familiesStore.js]")]
end

subgraph group_g_data["Data Layer"]
  node_n_api["API Client<br/>http-client<br/>[api.js]"]
  node_n_families_api["Families API<br/>domain-api<br/>[familiesApi.js]"]
end

subgraph group_g_build["Build"]
  node_n_app_css["App CSS<br/>styles<br/>[App.css]"]
  node_n_index_css["Global CSS<br/>styles<br/>[index.css]"]
end

node_n_main -->|"mounts"| node_n_app
node_n_app -->|"uses"| node_n_nav
node_n_app -->|"wraps"| node_n_protected
node_n_app -->|"routes to"| node_n_login
node_n_app -->|"routes to"| node_n_register
node_n_app -->|"routes to"| node_n_dashboard
node_n_app -->|"routes to"| node_n_families
node_n_app -->|"routes to"| node_n_family_detail
node_n_protected -->|"checks"| node_n_auth_store
node_n_useauth -->|"reads"| node_n_auth_store
node_n_login -->|"auth flow"| node_n_useauth
node_n_register -->|"auth flow"| node_n_useauth
node_n_dashboard -->|"consumes"| node_n_auth_store
node_n_families -->|"consumes"| node_n_families_store
node_n_family_detail -->|"consumes"| node_n_families_store
node_n_families_store -->|"fetches"| node_n_families_api
node_n_families_api -->|"uses"| node_n_api
node_n_auth_store -->|"uses"| node_n_api
node_n_app -->|"styles"| node_n_app_css
node_n_main -->|"styles"| node_n_index_css

click node_n_main "https://github.com/luigi-menor/frontend-revida/blob/main/src/main.jsx"
click node_n_app "https://github.com/luigi-menor/frontend-revida/blob/main/src/App.jsx"
click node_n_nav "https://github.com/luigi-menor/frontend-revida/blob/main/src/components/Navbar.jsx"
click node_n_protected "https://github.com/luigi-menor/frontend-revida/blob/main/src/guards/ProtectedRoute.jsx"
click node_n_login "https://github.com/luigi-menor/frontend-revida/blob/main/src/pages/LoginPage.jsx"
click node_n_register "https://github.com/luigi-menor/frontend-revida/blob/main/src/pages/RegisterPage.jsx"
click node_n_dashboard "https://github.com/luigi-menor/frontend-revida/blob/main/src/pages/DashboardPage.jsx"
click node_n_families "https://github.com/luigi-menor/frontend-revida/blob/main/src/pages/FamiliesPage.jsx"
click node_n_family_detail "https://github.com/luigi-menor/frontend-revida/blob/main/src/pages/FamilyDetailPage.jsx"
click node_n_useauth "https://github.com/luigi-menor/frontend-revida/blob/main/src/hooks/useAuth.js"
click node_n_auth_store "https://github.com/luigi-menor/frontend-revida/blob/main/src/store/authStore.js"
click node_n_families_store "https://github.com/luigi-menor/frontend-revida/blob/main/src/store/familiesStore.js"
click node_n_api "https://github.com/luigi-menor/frontend-revida/blob/main/src/services/api.js"
click node_n_families_api "https://github.com/luigi-menor/frontend-revida/blob/main/src/services/familiesApi.js"
click node_n_app_css "https://github.com/luigi-menor/frontend-revida/blob/main/src/App.css"
click node_n_index_css "https://github.com/luigi-menor/frontend-revida/blob/main/src/index.css"

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_n_main,node_n_app,node_n_nav,node_n_protected,node_n_login,node_n_register,node_n_dashboard,node_n_families,node_n_family_detail toneBlue
class node_n_useauth,node_n_auth_store,node_n_families_store toneAmber
class node_n_api,node_n_families_api toneMint
class node_n_app_css,node_n_index_css toneRose
```

## Components

### UI Shell

App bootstrap, routing composition, shared layout, and route-level views.

- [main](https://github.com/luigi-menor/frontend-revida/blob/main/src/main.jsx): bootstrap · Mounts the React app into the page. · `src/main.jsx`
- [App](https://github.com/luigi-menor/frontend-revida/blob/main/src/App.jsx): shell · Top-level composition for routing and layout. · `src/App.jsx`
- [Navbar](https://github.com/luigi-menor/frontend-revida/blob/main/src/components/Navbar.jsx): shared-ui · Common navigation and auth-aware actions. · `src/components/Navbar.jsx`
- [Protected](https://github.com/luigi-menor/frontend-revida/blob/main/src/guards/ProtectedRoute.jsx): route-guard · Blocks private routes until auth is valid. · `src/guards/ProtectedRoute.jsx`
- [Login](https://github.com/luigi-menor/frontend-revida/blob/main/src/pages/LoginPage.jsx): page · Public sign-in screen. · `src/pages/LoginPage.jsx`
- [Register](https://github.com/luigi-menor/frontend-revida/blob/main/src/pages/RegisterPage.jsx): page · Public account creation screen. · `src/pages/RegisterPage.jsx`
- [Dashboard](https://github.com/luigi-menor/frontend-revida/blob/main/src/pages/DashboardPage.jsx): page · Authenticated overview landing page. · `src/pages/DashboardPage.jsx`
- [Families](https://github.com/luigi-menor/frontend-revida/blob/main/src/pages/FamiliesPage.jsx): page · Family list and browsing page. · `src/pages/FamiliesPage.jsx`
- [Family Detail](https://github.com/luigi-menor/frontend-revida/blob/main/src/pages/FamilyDetailPage.jsx): page · Single family detail view. · `src/pages/FamilyDetailPage.jsx`

### State

Client-side auth and domain state management.

- [useAuth](https://github.com/luigi-menor/frontend-revida/blob/main/src/hooks/useAuth.js): hook · Hook for auth state and actions. · `src/hooks/useAuth.js`
- [Auth Store](https://github.com/luigi-menor/frontend-revida/blob/main/src/store/authStore.js): state-store · Central session and identity state. · `src/store/authStore.js`
- [Families Store](https://github.com/luigi-menor/frontend-revida/blob/main/src/store/familiesStore.js): state-store · Client state for family lists and selection. · `src/store/familiesStore.js`

### Data Layer

API client and domain-specific service adapters.

- [API Client](https://github.com/luigi-menor/frontend-revida/blob/main/src/services/api.js): http-client · Shared request and transport layer. · `src/services/api.js`
- [Families API](https://github.com/luigi-menor/frontend-revida/blob/main/src/services/familiesApi.js): domain-api · Adapter for family-related endpoints. · `src/services/familiesApi.js`

### Build

Tooling and static app entrypoints.

- [App CSS](https://github.com/luigi-menor/frontend-revida/blob/main/src/App.css): styles · App-level styling rules. · `src/App.css`
- [Global CSS](https://github.com/luigi-menor/frontend-revida/blob/main/src/index.css): styles · Global styling baseline. · `src/index.css`

## Connections

- main → App: mounts · Bootstraps the top-level app component.
- App → Navbar: uses · Renders shared navigation around pages.
- App → Protected: wraps · Applies route protection to private areas.
- App → Login: routes to · Exposes the public login screen.
- App → Register: routes to · Exposes the public registration screen.
- App → Dashboard: routes to · Exposes the authenticated dashboard.
- App → Families: routes to · Exposes the family browsing page.
- App → Family Detail: routes to · Exposes the family detail page.
- Protected → Auth Store: checks · Uses auth state to allow or block access.
- useAuth → Auth Store: reads · Exposes auth state and auth actions.
- Login → useAuth: auth flow · Uses auth actions for sign-in.
- Register → useAuth: auth flow · Uses auth actions for account creation.
- Dashboard → Auth Store: consumes · Reads authenticated user/session state.
- Families → Families Store: consumes · Renders family collection state.
- Family Detail → Families Store: consumes · Renders selected family details.
- Families Store → Families API: fetches · Loads family data through the domain adapter.
- Families API → API Client: uses · Delegates HTTP requests to the shared client.
- Auth Store → API Client: uses · Uses the shared client for session-related requests.
- App → App CSS: styles · Applies app-specific styling.
- main → Global CSS: styles · Loads global styles at startup.
