Skip to main content

Architecture Diagrams - AquaGen Web Application

This document provides visual diagrams of the complete AquaGen system architecture, data flow, and component relationships.


1. High-Level System Architecture


2. Application Bootstrap Flow


3. Nx Monorepo Structure


4. Dependency Flow & Import Rules


5. Feature Library Internal Architecture

Each feature library follows the same internal structure:


6. Data Flow Architecture


7. Authentication Flow


8. Routing Architecture


9. Shared Library Architecture


10. Build & Deployment Pipeline


11. Component Library Overview


12. API Architecture


13. State Management Overview


14. Security Architecture


15. Mobile Architecture (Capacitor)


Quick Reference: Key Files

┌─────────────────────────────────────────────────────────────────────┐
│ KEY FILES REFERENCE │
│ │
│ ENTRY POINTS │
│ ──────────── │
│ apps/production/src/main.jsx App entry │
│ apps/production/src/bootstrap.jsx Provider setup │
│ apps/production/src/routes/routes.js All routes │
│ apps/production/src/app/app.jsx Root component │
│ │
│ CONFIGURATION │
│ ───────────── │
│ package.json Dependencies & scripts │
│ nx.json Nx workspace config │
│ apps/production/rspack.config.js Bundler config │
│ apps/production/module-federation.config MF config │
│ firebase.json Hosting config │
│ tsconfig.base.json TypeScript paths │
│ │
│ SHARED SERVICES │
│ ─────────────── │
│ libs/shared/src/services/api/apiClient.js API client │
│ libs/shared/src/services/api/urls.js API endpoints │
│ libs/shared/src/store/AppStore.js Global state │
│ libs/shared/src/constants/authConfig.js Auth configuration │
│ libs/shared/src/constants/constants.js App constants │
│ │
│ BUILD SCRIPTS │
│ ───────────── │
│ bash-scripts/create-lib.sh Create new library │
│ bash-scripts/deploy-app.sh Deploy to Firebase │
│ bash-scripts/duplicate-production.sh Clone app │
│ bash-scripts/integrate-lib.sh Integrate library │
│ bash-scripts/run-build.sh Serve build locally │
│ │
└─────────────────────────────────────────────────────────────────────┘

Diagrams Summary

#DiagramWhat It Shows
1High-Level System ArchitectureBrowser, Backend, Azure AD, Firebase, Sentry, Analytics
2Application Bootstrap Flowmain.jsx → bootstrap.jsx → 5-level provider chain (Google → MSAL → Theme → AppStore → Router)
3Nx Monorepo StructureApps (production, demo) → 27 feature libs → UI libs → shared foundation
4Dependency Flow & Import RulesWhat can import what, forbidden imports marked with ❌
5Feature Library Internal ArchitectureFeaturePage → components, store, controller, dataSource, helper, hooks
6Data Flow ArchitectureComponent → Store → Controller → DataSource → API Client → Backend
7Authentication FlowSplash → Login → Microsoft/Google → Backend → JWT → Dashboard
8Routing ArchitectureAll 20+ routes mapped (/dashboard, /monitoring, /energy, etc.)
9Shared Library Architectureservices, constants, enums, hooks, utils, store, helpers, assets
10Build & Deployment PipelineDev → Build → Deploy → 14 Firebase hosting targets
11Component Library Overview39 component categories grouped (Navigation, Input, Layout, Data, Feedback, Media)
12API ArchitectureAxios client, request/response interceptors, 4 environments, 40+ endpoints
13State Management OverviewGlobal AppStore + Feature Stores + Local/Session Storage
14Security Architecture5 security layers (Browser → Auth → Device → API → Monitoring)
15Mobile ArchitectureCapacitor bridge → Browser/iOS/Android

Next Steps

For more details on each section:


Last Updated: February 2026