# louaygharsaly2025/madari_dashboard architecture

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

- Interactive diagram: https://gitdiagram.com/louaygharsaly2025/madari_dashboard
- Repository: https://github.com/louaygharsaly2025/madari_dashboard

## Overview

1. **Repository shape**
   - This is a **Next.js App Router frontend** for the “Madari Observatory” dashboard.
   - The repo is mostly a **presentation layer and client-side app shell**; there are no obvious API route handlers, backend services, or database schemas in the tree.

2. **Top-level navigation model**
   - The app is split into a small set of top-level flows:
     - **Landing/home** at `src/app/page.tsx`
     - **Authentication** at `src/app/login` and `src/app/register`
     - **Authenticated dashboard** under `src/app/dashboard/*`
   - This implies a clear boundary between public entry points and the protected operational console.

3. **Dashboard as the main subsystem**
   - `src/app/dashboard/layout.tsx` is the structural wrapper for all dashboard pages.
   - Dashboard subpages are separated by functional domain:
     - `health`
     - `map`
     - `notifications`
     - `security`
     - `settings`
     - `users`
     - `vault`
     - plus `test-route` and the dashboard index page
   - `src/app/dashboard/not-found.tsx` shows the dashboard has its own localized/section-specific error boundary.

4. **Shared UI shell**
   - The main reusable UI pieces live in `src/components`:
     - `layout/Sidebar.tsx` for primary navigation
     - `Terminal.tsx` for an ops/console-style interaction surface
     - `CommandPalette.tsx` for fast global actions/search
     - `ui/Skeleton.tsx` for loading states
   - These suggest the dashboard is built around a **control-room metaphor** rather than a conventional CRUD admin panel.

5. **Global application boundaries**
   - `src/app/layout.tsx` is the root composition layer for the entire app.
   - `src/app/globals.css` defines global styling across the app, while Tailwind/PostCSS config files indicate the UI is styled through a utility-first pipeline.
   - This separates global app concerns from dashboard-specific layout.

6. **Cross-cutting state: theme and language**
   - `src/lib/ThemeContext.tsx` provides theme management across the app.
   - `src/lib/i18n/LanguageContext.tsx` and `src/lib/i18n/dictionaries.ts` provide language switching and translation data.
   - The README’s multi-language support matches this structure: localization is a **shared app-level concern**, not per-page logic.

7. **Firebase as the external backend boundary**
   - `src/lib/firebase.ts` is the main integration point for Firebase.
   - The README describes usage of **Auth, Firestore real-time data, and Analytics**, so the frontend is designed to depend on Firebase as the external system for:
     - authentication / approval flows
     - live operational data
     - event/usage tracking
   - In architecture terms, Firebase is the primary backend boundary visible in this repo.

8. **Operational features implied by the route map**
   - The dashboard route names map cleanly to product concerns:
     - **Security** for access/control and auth-related status
     - **Users** for user administration
     - **Notifications** and **broadcast**-style messaging
     - **Vault** for sensitive or protected data
     - **Health** and **Map** for system visibility / telemetry
     - **Settings** for preferences and configuration
   - This supports a diagram where the dashboard is the central orchestration layer over several operational domains.

9. **Visual/interaction layer**
   - The README identifies **Framer Motion** and **Recharts** as part of the stack, indicating animated interactions and chart-based analytics in the UI.
   - Combined with the “Glassmorphism” description, the front end is designed as a highly interactive dashboard rather than a static admin site.

10. **Deployment/runtime characteristics**
   - The repo is built for the **Next.js runtime** with TypeScript and modern frontend tooling.
   - There are no signs of separate server processes in-tree; any server-side behavior is likely handled by Next.js itself plus Firebase services.

11. **Supporting assets and documentation**
   - `public/` holds static assets.
   - `FEATURES*.md` and `V3_FEATURES.md` look like product/spec evolution documents, useful for understanding intended functionality but not part of the runtime architecture.

12. **What an architecture diagram should show**
   - A **browser client** hitting the Next.js app.
   - A **root app shell** with theme/language providers.
   - A **public entry/auth path** leading into a **dashboard shell**.
   - Multiple **dashboard domain pages** behind the shell.
   - Shared UI components used across pages.
   - Firebase as the external data/auth/analytics backend.
   - Optional analytics/visualization/animation libraries inside the UI layer.

Main entry points: [`src/app/dashboard/layout.tsx`](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/dashboard/layout.tsx) (Dashboard Shell), [`src/app/layout.tsx`](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/layout.tsx) (Root Layout), [`src/lib/firebase.ts`](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/lib/firebase.ts) (Firebase), [`src/components/layout/Sidebar.tsx`](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/components/layout/Sidebar.tsx) (Sidebar)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_app["App Shell"]
  node_node_browser(("Browser<br/>client"))
  node_node_root_layout["Root Layout<br/>next layout<br/>[layout.tsx]"]
  node_node_home["Home<br/>public page<br/>[page.tsx]"]
  node_node_login["Login<br/>auth page<br/>[page.tsx]"]
  node_node_register["Register<br/>auth page<br/>[page.tsx]"]
end

subgraph group_group_dashboard["Dashboard"]
  node_node_dashboard_layout["Dashboard Shell<br/>next layout<br/>[layout.tsx]"]
  node_node_dashboard_home["Overview<br/>dashboard page<br/>[page.tsx]"]
  node_node_health["Health<br/>dashboard page<br/>[page.tsx]"]
  node_node_map["Map<br/>dashboard page<br/>[page.tsx]"]
  node_node_notifications["Notifications<br/>dashboard page<br/>[page.tsx]"]
  node_node_security["Security<br/>dashboard page<br/>[page.tsx]"]
  node_node_settings["Settings<br/>dashboard page<br/>[page.tsx]"]
  node_node_users["Users<br/>dashboard page<br/>[page.tsx]"]
  node_node_vault["Vault<br/>dashboard page<br/>[page.tsx]"]
  node_node_test_route["Test Route<br/>dashboard page<br/>[page.tsx]"]
  node_node_dashboard_notfound["Dashboard 404<br/>route boundary<br/>[not-found.tsx]"]
end

subgraph group_group_shared["Shared UI"]
  node_node_sidebar["Sidebar<br/>nav component<br/>[Sidebar.tsx]"]
  node_node_terminal["Terminal<br/>console ui<br/>[Terminal.tsx]"]
  node_node_palette["Command Palette<br/>action ui<br/>[CommandPalette.tsx]"]
  node_node_skeleton["Skeleton<br/>loading ui<br/>[Skeleton.tsx]"]
  node_node_theme["Theme Context<br/>state provider<br/>[ThemeContext.tsx]"]
  node_node_language["Language Context<br/>state provider"]
  node_node_dicts["Dictionaries<br/>localization data<br/>[dictionaries.ts]"]
end

subgraph group_group_external["External Systems"]
  node_node_firebase[("Firebase<br/>backend integration<br/>[firebase.ts]")]
  node_node_public_assets["Public Assets<br/>static assets"]
end

node_node_browser -->|"loads app"| node_node_root_layout
node_node_root_layout -->|"routes to"| node_node_home
node_node_root_layout -->|"routes to"| node_node_login
node_node_root_layout -->|"routes to"| node_node_register
node_node_root_layout -->|"mounts shell"| node_node_dashboard_layout
node_node_root_layout -->|"provides"| node_node_theme
node_node_root_layout -->|"provides"| node_node_language
node_node_root_layout -->|"serves"| node_node_public_assets
node_node_dashboard_layout -->|"wraps"| node_node_dashboard_home
node_node_dashboard_layout -->|"wraps"| node_node_health
node_node_dashboard_layout -->|"wraps"| node_node_map
node_node_dashboard_layout -->|"wraps"| node_node_notifications
node_node_dashboard_layout -->|"wraps"| node_node_security
node_node_dashboard_layout -->|"wraps"| node_node_settings
node_node_dashboard_layout -->|"wraps"| node_node_users
node_node_dashboard_layout -->|"wraps"| node_node_vault
node_node_dashboard_layout -->|"wraps"| node_node_test_route
node_node_dashboard_layout -->|"bounds errors"| node_node_dashboard_notfound
node_node_dashboard_layout -->|"uses"| node_node_sidebar
node_node_dashboard_layout -->|"uses"| node_node_palette
node_node_dashboard_layout -->|"uses"| node_node_terminal
node_node_dashboard_layout -->|"uses"| node_node_skeleton
node_node_sidebar -.->|"navigates"| node_node_dashboard_home
node_node_sidebar -.->|"navigates"| node_node_health
node_node_sidebar -.->|"navigates"| node_node_users
node_node_palette -.->|"accelerates"| node_node_dashboard_layout
node_node_terminal -.->|"reads data"| node_node_firebase
node_node_dashboard_home -.->|"fetches live data"| node_node_firebase
node_node_health -.->|"fetches live data"| node_node_firebase
node_node_notifications -.->|"syncs"| node_node_firebase
node_node_security -.->|"auth checks"| node_node_firebase
node_node_users -.->|"manages users"| node_node_firebase
node_node_vault -.->|"protects data"| node_node_firebase
node_node_theme -.->|"coordinates"| node_node_dicts
node_node_language -->|"uses"| node_node_dicts

click node_node_root_layout "https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/layout.tsx"
click node_node_home "https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/page.tsx"
click node_node_login "https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/login/page.tsx"
click node_node_register "https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/register/page.tsx"
click node_node_dashboard_layout "https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/dashboard/layout.tsx"
click node_node_dashboard_home "https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/dashboard/page.tsx"
click node_node_health "https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/dashboard/health/page.tsx"
click node_node_map "https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/dashboard/map/page.tsx"
click node_node_notifications "https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/dashboard/notifications/page.tsx"
click node_node_security "https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/dashboard/security/page.tsx"
click node_node_settings "https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/dashboard/settings/page.tsx"
click node_node_users "https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/dashboard/users/page.tsx"
click node_node_vault "https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/dashboard/vault/page.tsx"
click node_node_test_route "https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/dashboard/test-route/page.tsx"
click node_node_dashboard_notfound "https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/dashboard/not-found.tsx"
click node_node_sidebar "https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/components/layout/Sidebar.tsx"
click node_node_terminal "https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/components/Terminal.tsx"
click node_node_palette "https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/components/CommandPalette.tsx"
click node_node_skeleton "https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/components/ui/Skeleton.tsx"
click node_node_theme "https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/lib/ThemeContext.tsx"
click node_node_language "https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/lib/i18n/LanguageContext.tsx"
click node_node_dicts "https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/lib/i18n/dictionaries.ts"
click node_node_firebase "https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/lib/firebase.ts"
click node_node_public_assets "https://github.com/louaygharsaly2025/madari_dashboard/tree/main/public"

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_node_browser,node_node_root_layout,node_node_home,node_node_login,node_node_register toneBlue
class node_node_dashboard_layout,node_node_dashboard_home,node_node_health,node_node_map,node_node_notifications,node_node_security,node_node_settings,node_node_users,node_node_vault,node_node_test_route,node_node_dashboard_notfound toneAmber
class node_node_sidebar,node_node_terminal,node_node_palette,node_node_skeleton,node_node_theme,node_node_language,node_node_dicts toneMint
class node_node_firebase,node_node_public_assets toneRose
```

## Components

### App Shell

Root composition and public entry paths

- **Browser**: client · User-facing runtime consuming the Next.js app
- [Root Layout](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/layout.tsx): next layout · Global app composition for the entire site · `src/app/layout.tsx`
- [Home](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/page.tsx): public page · Landing entry point · `src/app/page.tsx`
- [Login](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/login/page.tsx): auth page · Public authentication entry · `src/app/login/page.tsx`
- [Register](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/register/page.tsx): auth page · Public account creation entry · `src/app/register/page.tsx`

### Dashboard

Protected operational console and domain pages

- [Dashboard Shell](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/dashboard/layout.tsx): next layout · Shared wrapper for all dashboard routes · `src/app/dashboard/layout.tsx`
- [Overview](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/dashboard/page.tsx): dashboard page · Dashboard index landing page · `src/app/dashboard/page.tsx`
- [Health](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/dashboard/health/page.tsx): dashboard page · Operational health view · `src/app/dashboard/health/page.tsx`
- [Map](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/dashboard/map/page.tsx): dashboard page · Geographic or situational view · `src/app/dashboard/map/page.tsx`
- [Notifications](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/dashboard/notifications/page.tsx): dashboard page · Alerting and broadcast view · `src/app/dashboard/notifications/page.tsx`
- [Security](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/dashboard/security/page.tsx): dashboard page · Access and protection controls · `src/app/dashboard/security/page.tsx`
- [Settings](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/dashboard/settings/page.tsx): dashboard page · Application and preference configuration · `src/app/dashboard/settings/page.tsx`
- [Users](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/dashboard/users/page.tsx): dashboard page · User administration surface · `src/app/dashboard/users/page.tsx`
- [Vault](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/dashboard/vault/page.tsx): dashboard page · Sensitive protected data area · `src/app/dashboard/vault/page.tsx`
- [Test Route](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/dashboard/test-route/page.tsx): dashboard page · Auxiliary route for validation or experimentation · `src/app/dashboard/test-route/page.tsx`
- [Dashboard 404](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/app/dashboard/not-found.tsx): route boundary · Section-scoped not found boundary for dashboard routes · `src/app/dashboard/not-found.tsx`

### Shared UI

Reusable components and cross-cutting app state

- [Sidebar](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/components/layout/Sidebar.tsx): nav component · Primary dashboard navigation shell · `src/components/layout/Sidebar.tsx`
- [Terminal](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/components/Terminal.tsx): console ui · Ops-style interaction surface · `src/components/Terminal.tsx`
- [Command Palette](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/components/CommandPalette.tsx): action ui · Global quick action and search surface · `src/components/CommandPalette.tsx`
- [Skeleton](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/components/ui/Skeleton.tsx): loading ui · Shared loading placeholder component · `src/components/ui/Skeleton.tsx`
- [Theme Context](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/lib/ThemeContext.tsx): state provider · Shared theme management across the app · `src/lib/ThemeContext.tsx`
- [Language Context](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/lib/i18n/LanguageContext.tsx): state provider · Shared localization and language switching · `src/lib/i18n/LanguageContext.tsx`
- [Dictionaries](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/lib/i18n/dictionaries.ts): localization data · Translation content used by the language system · `src/lib/i18n/dictionaries.ts`

### External Systems

Backend and delivery boundaries

- [Firebase](https://github.com/louaygharsaly2025/madari_dashboard/blob/main/src/lib/firebase.ts): backend integration · External auth, realtime data, and analytics boundary · `src/lib/firebase.ts`
- [Public Assets](https://github.com/louaygharsaly2025/madari_dashboard/tree/main/public): static assets · Static files served directly by the app · `public`

## Connections

- Browser → Root Layout: loads app · Browser enters the Next.js application shell
- Root Layout → Home: routes to · Public landing page is one top-level entry
- Root Layout → Login: routes to · Public authentication path
- Root Layout → Register: routes to · Public authentication path
- Root Layout → Dashboard Shell: mounts shell · Dashboard is composed under the global app shell
- Root Layout → Theme Context: provides · Theme context is global
- Root Layout → Language Context: provides · Language context is global
- Root Layout → Public Assets: serves · Static assets are available to the app
- Dashboard Shell → Overview: wraps · Dashboard shell frames the main overview page
- Dashboard Shell → Health: wraps · Dashboard shell frames domain pages
- Dashboard Shell → Map: wraps · Dashboard shell frames domain pages
- Dashboard Shell → Notifications: wraps · Dashboard shell frames domain pages
- Dashboard Shell → Security: wraps · Dashboard shell frames domain pages
- Dashboard Shell → Settings: wraps · Dashboard shell frames domain pages
- Dashboard Shell → Users: wraps · Dashboard shell frames domain pages
- Dashboard Shell → Vault: wraps · Dashboard shell frames domain pages
- Dashboard Shell → Test Route: wraps · Auxiliary dashboard route
- Dashboard Shell → Dashboard 404: bounds errors · Section-local not found handling
- Dashboard Shell → Sidebar: uses · Primary navigation component
- Dashboard Shell → Command Palette: uses · Fast actions and search
- Dashboard Shell → Terminal: uses · Console-style interaction surface
- Dashboard Shell → Skeleton: uses · Loading states within dashboard routes
- Sidebar → Overview: navigates · Sidebar links into dashboard overview
- Sidebar → Health: navigates · Sidebar links into operational domains
- Sidebar → Users: navigates · Sidebar links into operational domains
- Command Palette → Dashboard Shell: accelerates · Global command surface for dashboard actions
- Terminal → Firebase: reads data · Console experiences likely surface backend state
- Overview → Firebase: fetches live data · Overview likely depends on realtime backend data
- Health → Firebase: fetches live data · Health view likely depends on backend data
- Notifications → Firebase: syncs · Notifications are backed by external services
- Security → Firebase: auth checks · Security view depends on auth and access state
- Users → Firebase: manages users · User administration depends on backend identity data
- Vault → Firebase: protects data · Sensitive data boundary relies on backend storage/auth
- Theme Context → Dictionaries: coordinates · Theme and language are app-wide shared concerns
- Language Context → Dictionaries: uses · Language context consumes translation dictionaries
