# cpe3a-tolentino-ronstephen/orbittest architecture

> Architecture diagram of the GitHub repository cpe3a-tolentino-ronstephen/orbittest, 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/cpe3a-tolentino-ronstephen/orbittest
- Repository: https://github.com/cpe3a-tolentino-ronstephen/orbittest

## Overview

1. This repository is a two-part monorepo:
   - `orbit/client`: a Vite + React single-page application.
   - `orbit/server`: a Node/Express backend API.
   The architecture is split cleanly between a browser UI and an HTTP service layer.

2. The client is the main presentation layer. Its top-level entry is `src/main.jsx`, which mounts `App.jsx` and wraps the app with global styling and shared context. The app is organized into pages rather than route-heavy feature modules.

3. Client pages define the user-facing flows:
   - `LandingPage.jsx` for the public entry experience.
   - `AuthPage.jsx` for sign-in/sign-up related interactions.
   - `DashboardPage.jsx`, `MapPage.jsx`, and `StatisticsPage.jsx` for the authenticated analytics views.
   This suggests the product is centered on exploring disease/country risk data rather than generic CRUD.

4. Shared layout is separated from page content. `AppLayout.jsx` composes the persistent shell, with `Header`, `Sidebar`, and `Footer` in `src/components/layout`. This boundary indicates a stable navigation frame around changing page content.

5. Reusable UI is factored into domain-specific components in `src/components/ui`:
   - `CountryTable`, `CountryDetail`
   - `DiseaseTabs`
   - `RiskBadge`
   - `StatCard`
   - `Skeleton`
   These are not generic widgets; they encode the domain model around countries, diseases, and risk/statistics.

6. Client state and data access are split into a few focused layers:
   - `context/AuthContext.jsx` handles authentication state for the app shell.
   - `hooks/useDisease.js` encapsulates disease-related fetching or derived state.
   - `services/api.js` is the client-side HTTP boundary to the backend.
   This keeps UI components mostly declarative and pushes remote communication into dedicated modules.

7. The server is a small Express API surface. `server/index.js` is the entry point, and the only route modules are `routes/auth.js` and `routes/disease.js`. That implies the backend is organized around authentication and disease data retrieval rather than a broad domain model.

8. Server configuration is externalized in `config/`:
   - `config/disease.js`
   - `config/dataSources.js`
   This strongly suggests the API is at least partly configuration-driven and may aggregate from one or more upstream data sources instead of relying on a local database layer, since no DB models or persistence folders are present.

9. The main data flow is:
   browser page/component → client service/hook → Express route → config/data-source logic → response back to UI.
   The UI appears to consume disease/country/risk data through a single API boundary, then render tables, cards, badges, and map/statistical views.

10. Authentication is a cross-cutting concern but not the core domain. The presence of `AuthContext` on the client and `routes/auth.js` on the server indicates login/session handling is part of the app shell, with auth state likely controlling access to the dashboard-style pages.

11. The project also has deployment/runtime boundaries:
   - The client uses Vite (`vite.config.js`) and is configured for Vercel (`vercel.json`).
   - The server is a standalone Node package with its own `package.json`.
   This means frontend and backend can be deployed independently, with the client likely calling the server over HTTP.

12. Overall, the repository is best diagrammed as:
   - a React SPA with shared layout, auth context, and domain-specific dashboard pages;
   - a thin Express API with auth and disease endpoints;
   - config-driven disease/data-source logic on the server;
   - no obvious database or worker subsystem in the tree.
   The dominant architectural boundary is UI vs API, with the disease/risk domain flowing through both sides.

Main entry points: [`orbit/client/src/App.jsx`](https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/App.jsx) (App shell), [`orbit/client/src/components/AppLayout.jsx`](https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/components/AppLayout.jsx) (App layout), [`orbit/server/index.js`](https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/server/index.js) (Server entry), [`orbit/client/src/hooks/useDisease.js`](https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/hooks/useDisease.js) (Disease hook)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client SPA"]
  node_client_main(("Main entry<br/>react entry<br/>[main.jsx]"))
  node_client_app["App shell<br/>react shell<br/>[App.jsx]"]
  node_client_layout["App layout<br/>layout composer<br/>[AppLayout.jsx]"]
  node_client_nav["Header bar<br/>layout component<br/>[Header.jsx]"]
  node_client_sidebar["Sidebar<br/>layout component<br/>[Sidebar.jsx]"]
  node_client_footer["Footer<br/>layout component<br/>[Footer.jsx]"]
  node_client_authctx(("Auth context<br/>state context<br/>[AuthContext.jsx]"))
  node_client_api["API client<br/>http boundary<br/>[api.js]"]
  node_client_disease_hook(("Disease hook<br/>data hook<br/>[useDisease.js]"))
  node_client_landing["Landing page<br/>public page<br/>[LandingPage.jsx]"]
  node_client_auth["Auth page<br/>[AuthPage.jsx]"]
  node_client_dashboard["Dashboard<br/>analytics page<br/>[DashboardPage.jsx]"]
  node_client_map["Map view<br/>analytics page<br/>[MapPage.jsx]"]
  node_client_stats["Statistics<br/>analytics page<br/>[StatisticsPage.jsx]"]
  node_client_ui["Domain UI<br/>ui components"]
end

subgraph group_server["Server API"]
  node_server_entry(("Server entry<br/>express entry<br/>[index.js]"))
  node_server_auth["Auth routes<br/>api routes<br/>[auth.js]"]
  node_server_disease["Disease routes<br/>api routes<br/>[disease.js]"]
  node_server_cfg_disease["Disease config<br/>service config<br/>[disease.js]"]
  node_server_cfg_sources["Data sources<br/>service config<br/>[dataSources.js]"]
end

node_client_main -->|"mounts"| node_client_app
node_client_app -->|"wraps"| node_client_layout
node_client_app -->|"shows"| node_client_landing
node_client_app -->|"shows"| node_client_auth
node_client_app -->|"shows"| node_client_dashboard
node_client_app -->|"shows"| node_client_map
node_client_app -->|"shows"| node_client_stats
node_client_layout -->|"contains"| node_client_nav
node_client_layout -->|"contains"| node_client_sidebar
node_client_layout -->|"contains"| node_client_footer
node_client_layout -->|"renders"| node_client_ui
node_client_layout -->|"reads"| node_client_authctx
node_client_dashboard -->|"uses"| node_client_disease_hook
node_client_map -->|"uses"| node_client_disease_hook
node_client_stats -->|"uses"| node_client_disease_hook
node_client_auth -->|"updates"| node_client_authctx
node_client_disease_hook -->|"fetches via"| node_client_api
node_client_api -->|"calls"| node_server_entry
node_server_entry -->|"mounts"| node_server_auth
node_server_entry -->|"mounts"| node_server_disease
node_server_disease -->|"uses"| node_server_cfg_disease
node_server_disease -->|"uses"| node_server_cfg_sources
node_server_auth -.->|"served by"| node_server_entry

click node_client_main "https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/main.jsx"
click node_client_app "https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/App.jsx"
click node_client_layout "https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/components/AppLayout.jsx"
click node_client_nav "https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/components/layout/Header.jsx"
click node_client_sidebar "https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/components/layout/Sidebar.jsx"
click node_client_footer "https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/components/layout/Footer.jsx"
click node_client_authctx "https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/context/AuthContext.jsx"
click node_client_api "https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/services/api.js"
click node_client_disease_hook "https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/hooks/useDisease.js"
click node_client_landing "https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/pages/LandingPage.jsx"
click node_client_auth "https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/pages/AuthPage.jsx"
click node_client_dashboard "https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/pages/DashboardPage.jsx"
click node_client_map "https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/pages/MapPage.jsx"
click node_client_stats "https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/pages/StatisticsPage.jsx"
click node_client_ui "https://github.com/cpe3a-tolentino-ronstephen/orbittest/tree/main/orbit/client/src/components/ui"
click node_server_entry "https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/server/index.js"
click node_server_auth "https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/server/routes/auth.js"
click node_server_disease "https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/server/routes/disease.js"
click node_server_cfg_disease "https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/server/config/disease.js"
click node_server_cfg_sources "https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/server/config/dataSources.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_client_main,node_client_app,node_client_layout,node_client_nav,node_client_sidebar,node_client_footer,node_client_authctx,node_client_api,node_client_disease_hook,node_client_landing,node_client_auth,node_client_dashboard,node_client_map,node_client_stats,node_client_ui toneBlue
class node_server_entry,node_server_auth,node_server_disease,node_server_cfg_disease,node_server_cfg_sources toneAmber
```

## Components

### Client SPA

Vite + React browser app

- [Main entry](https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/main.jsx): react entry · Bootstraps the SPA and mounts the app shell · `orbit/client/src/main.jsx`
- [App shell](https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/App.jsx): react shell · Top-level app composition and view switching · `orbit/client/src/App.jsx`
- [App layout](https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/components/AppLayout.jsx): layout composer · Persistent frame around page content · `orbit/client/src/components/AppLayout.jsx`
- [Header bar](https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/components/layout/Header.jsx): layout component · Top navigation and global actions · `orbit/client/src/components/layout/Header.jsx`
- [Sidebar](https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/components/layout/Sidebar.jsx): layout component · Primary side navigation · `orbit/client/src/components/layout/Sidebar.jsx`
- [Footer](https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/components/layout/Footer.jsx): layout component · Persistent footer area · `orbit/client/src/components/layout/Footer.jsx`
- [Auth context](https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/context/AuthContext.jsx): state context · Global authentication state for the SPA · `orbit/client/src/context/AuthContext.jsx`
- [API client](https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/services/api.js): http boundary · Client-side HTTP calls to the backend · `orbit/client/src/services/api.js`
- [Disease hook](https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/hooks/useDisease.js): data hook · Encapsulates disease data fetching and derived state · `orbit/client/src/hooks/useDisease.js`
- [Landing page](https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/pages/LandingPage.jsx): public page · Public entry experience · `orbit/client/src/pages/LandingPage.jsx`
- [Auth page](https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/pages/AuthPage.jsx): auth page · Sign-in and sign-up flow · `orbit/client/src/pages/AuthPage.jsx`
- [Dashboard](https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/pages/DashboardPage.jsx): analytics page · Authenticated overview of risk data · `orbit/client/src/pages/DashboardPage.jsx`
- [Map view](https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/pages/MapPage.jsx): analytics page · Geographic disease and risk exploration · `orbit/client/src/pages/MapPage.jsx`
- [Statistics](https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/client/src/pages/StatisticsPage.jsx): analytics page · Summary statistics and trends · `orbit/client/src/pages/StatisticsPage.jsx`
- [Domain UI](https://github.com/cpe3a-tolentino-ronstephen/orbittest/tree/main/orbit/client/src/components/ui): ui components · Reusable country, disease, risk, and stats components · `orbit/client/src/components/ui`

### Server API

Express HTTP service

- [Server entry](https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/server/index.js): express entry · Starts the HTTP API · `orbit/server/index.js`
- [Auth routes](https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/server/routes/auth.js): api routes · Authentication endpoint surface · `orbit/server/routes/auth.js`
- [Disease routes](https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/server/routes/disease.js): api routes · Disease and country data endpoint surface · `orbit/server/routes/disease.js`
- [Disease config](https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/server/config/disease.js): service config · Domain configuration for disease logic · `orbit/server/config/disease.js`
- [Data sources](https://github.com/cpe3a-tolentino-ronstephen/orbittest/blob/main/orbit/server/config/dataSources.js): service config · Upstream data-source configuration · `orbit/server/config/dataSources.js`

## Connections

- Main entry → App shell: mounts · Bootstraps the root application
- App shell → App layout: wraps · Provides the persistent application shell
- App shell → Landing page: shows · Public entry view
- App shell → Auth page: shows · Authentication flow
- App shell → Dashboard: shows · Authenticated overview
- App shell → Map view: shows · Map exploration view
- App shell → Statistics: shows · Statistics view
- App layout → Header bar: contains · Persistent top navigation
- App layout → Sidebar: contains · Persistent side navigation
- App layout → Footer: contains · Persistent footer
- App layout → Domain UI: renders · Uses reusable domain UI pieces
- App layout → Auth context: reads · Consumes auth state for shell behavior
- Dashboard → Disease hook: uses · Loads disease data for dashboard views
- Map view → Disease hook: uses · Loads disease data for map views
- Statistics → Disease hook: uses · Loads disease data for statistics views
- Auth page → Auth context: updates · Sets authentication state
- Disease hook → API client: fetches via · Delegates remote data access
- API client → Server entry: calls · HTTP boundary to backend API
- Server entry → Auth routes: mounts · Registers auth routes
- Server entry → Disease routes: mounts · Registers disease routes
- Disease routes → Disease config: uses · Applies domain configuration
- Disease routes → Data sources: uses · Reads upstream data-source configuration
- Auth routes → Server entry: served by · Authentication endpoints live under the API server
