# System Architecture ## System Overview Static single-page React application (Vite build) served as static files behind nginx on Raspberry Pis (test and production). One route (`/`), hash-based history. Dynamic data: packages via same-origin `GET /api/v1/offerings`. Monitoring: Sentry (via `/sentry-tunnel`) and self-hosted Umami. ## Architecture Diagram ```mermaid graph TD Browser[Browser] --> RP[Reverse-proxy Pi nginx] RP --> WS[Web server Pi - static dist/] RP --> API[CMS and API backend] RP --> Sentry[Sentry tunnel] Browser --> Umami[Umami analytics] subgraph SPA[React SPA] Root[__root route + RootLayout] --> Nav Root --> Landing[LandingPage] Root --> Footer Landing --> Hero Landing --> About Landing --> Packages[PackagesSection + usePackagesQuery] Landing --> Process Landing --> Contact[ContactSection] Nav --> Toggle[ThemeToggle] Toggle --> TP[ThemeProvider] end Packages -->|fetch| API classDef infra fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000; classDef ui fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000; classDef ext fill:#f6e05e,stroke:#c05621,stroke-width:1px,color:#000; class RP,WS,API infra; class Root,Nav,Landing,Footer,Hero,About,Packages,Process,Contact,Toggle,TP ui; class Sentry,Umami,Browser ext; ``` Text alternative: browser reaches nginx reverse proxy, which serves the static React bundle and proxies the API and Sentry tunnel; inside the SPA a root layout wraps nav, landing sections and footer. ## Component Descriptions ### ThemeProvider / tokens.ts / index.css - **Purpose**: Theme state. `ThemeName = 'red' | 'purple'`, stored in localStorage key `slp-software-theme`, applied as class `theme-red`/`theme-purple` on ``; colors are CSS variables mapped to Tailwind colors (`bg`, `surface`, `line`, `text`, `muted`, `accent`...). - **Dependencies**: React context only. - **Type**: Application ### Nav / Footer / RootLayout - **Purpose**: Sticky nav (anchor links, CTA, ThemeToggle, mobile menu), footer, layout shell incl. UmamiAnalytics and SentryTestButton. - **Type**: Application ### Landing feature (`src/features/landing`) - **Purpose**: Sections and static content (`data/content.ts`), packages query hook. - **Type**: Application ## Data Flow ```mermaid sequenceDiagram box rgba(99,179,237,0.4) Client participant U as Visitor participant P as PackagesSection end box rgba(154,230,180,0.4) Server participant A as API offerings end U->>P: open page P->>A: GET /api/v1/offerings A-->>P: PackageCardData array P-->>U: render cards or error text ``` ## Integration Points - **External APIs**: `GET {VITE_API_BASE_URL}/api/v1/offerings` (packages); Sentry envelope via `/sentry-tunnel`. - **Databases**: none in this repo. - **Third-party Services**: Sentry, Umami (self-hosted). ## Infrastructure Components - **Deployment Model**: Gitea Actions (`continuous_integration.yaml`, `deploy.yaml`), static bundle on Raspberry Pi nginx; test and production environments. - **Networking**: reverse-proxy Pi in front of web-server Pi (see feature react-frontend operations docs).