# codenimra/devos architecture

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

- Interactive diagram: https://gitdiagram.com/codenimra/devos
- Repository: https://github.com/codenimra/devos

## Overview

1. **Repository shape**
   - This is a **single-page React application** built with **Vite 5** and intended to run **entirely in the browser**.
   - There is **no backend service layer** in the repo; the product is designed as a local, offline-first personal OS.

2. **Runtime entry and root composition**
   - `index.html` boots the app and supports the PWA shell.
   - `src/main.jsx` is the React entry point.
   - `src/App.jsx` is the central coordinator: it owns the main application state, switches between modules, and composes the overall shell.

3. **Application shell**
   - The persistent UI frame is split into:
     - `src/layout/Sidebar.jsx` for module navigation
     - `src/layout/Topbar.jsx` for top-level controls/context
     - `src/layout/AlertsStrip.jsx` for surfaced notifications
   - These surround the active page/module and provide the main cross-cutting navigation boundary.

4. **Module architecture**
   - The app is organized into **domain pages** under `src/pages/`, one file per module.
   - `src/constants/nav.js` defines the grouped navigation structure; the README describes **5 groups / 25 modules**.
   - The page set covers:
     - **Work**: hackathons, jobs, projects, learning, skills
     - **Build**: goals, habits, exercise, books, hobbies, notes, pomodoro
     - **Connect**: people, calls, events, content calendar, socials
     - **You**: AI insights, journal, medical, weekly stats, achievements, profile
     - **Home**: dashboard and auth/onboarding

5. **Data flow and state ownership**
   - The architecture is **state-driven and client-local**: user actions in page modules feed back into `App.jsx`, which acts as the state hub.
   - Pages consume state and callbacks from the root rather than talking to external services.
   - This creates a simple flow: **form input / interaction → central app state → derived views, dashboards, alerts, and summaries**.

6. **Shared UI primitives**
   - Reusable components live in `src/components/`:
     - `Modal.jsx` for dialogs
     - `Field.jsx` for form input controls
     - `Empty.jsx` for empty-state presentation
     - `ThemeToggle.jsx` for theme switching
   - These are the app’s low-level UI building blocks used across multiple pages.

7. **Cross-cutting utilities and domain constants**
   - `src/utils/` provides shared helpers:
     - `id.js` for record identity generation
     - `dates.js` for date handling/formatting
     - `colors.js` for visual/status color logic
   - `src/constants/statuses.js` and `src/constants/platforms.js` define the app’s shared taxonomy, labels, and status mapping used across modules.
   - This keeps the pages aligned around a common vocabulary for statuses, urgency, and categories.

8. **Alerts and derived feedback**
   - `src/hooks/useAlerts.js` encapsulates alert logic, which is then rendered by `AlertsStrip.jsx`.
   - This is a lightweight feedback subsystem: events inside pages can raise user-facing alerts without coupling page code directly to presentation details.

9. **AI Insights is local, not remote**
   - `src/pages/AIInsights.jsx` implements the “AI Coach” behavior described in the README.
   - It is a **client-side analysis layer** that derives insights from the user’s own local data such as deadlines, moods, habit streaks, goals, and skills.
   - No API key, model server, or network dependency is implied; the boundary is entirely inside the browser.

10. **PWA and offline boundary**
   - `public/manifest.json` makes the app installable as a PWA.
   - `public/sw.js` provides offline caching and asset serving.
   - This means the app’s operational boundary is the browser plus service worker cache, not a traditional web backend.

11. **Styling and theming**
   - Global styling is centralized in `src/styles/globals.css`.
   - The app uses a theme system controlled via `data-theme` on `<html>`, with `ThemeToggle.jsx` switching between light/dark states.
   - The design system is CSS-variable driven rather than component-library driven.

12. **High-level architecture diagram guidance**
   - A correct diagram should show:
     - **Browser/PWA shell** at the top
     - **Service worker + manifest** as offline/installability infrastructure
     - **App.jsx** as the central orchestrator
     - **Layout shell** surrounding multiple **domain pages**
     - **Shared components/hooks/utils/constants** feeding all pages
     - **AI Insights** as a derived-analysis module over local user data
   - The key architectural idea is a **local-first, modular personal operating system** with shared state, reusable UI primitives, and offline PWA delivery.

Main entry points: [`src/App.jsx`](https://github.com/codenimra/devos/blob/main/src/App.jsx) (App), [`index.html`](https://github.com/codenimra/devos/blob/main/index.html) (index.html), [`src/pages`](https://github.com/codenimra/devos/tree/main/src/pages) (You), [`src/hooks/useAlerts.js`](https://github.com/codenimra/devos/blob/main/src/hooks/useAlerts.js) (useAlerts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime & PWA"]
  node_index_html["index.html<br/>html boot shell<br/>[index.html]"]
  node_manifest["Manifest<br/>[manifest.json]"]
  node_service_worker["Service Worker<br/>offline cache<br/>[sw.js]"]
end

subgraph group_shell["App Shell"]
  node_main["Main<br/>react entry<br/>[main.jsx]"]
  node_app["App<br/>state orchestrator<br/>[App.jsx]"]
  node_sidebar["Sidebar<br/>nav shell<br/>[Sidebar.jsx]"]
  node_topbar["Topbar<br/>context shell<br/>[Topbar.jsx]"]
  node_alerts_strip["Alerts<br/>feedback surface<br/>[AlertsStrip.jsx]"]
end

subgraph group_shared["Shared Foundation"]
  node_use_alerts["useAlerts<br/>alerts hook<br/>[useAlerts.js]"]
  node_ui_components["UI Kit<br/>shared components"]
  node_utils["Utils<br/>helpers"]
  node_taxonomies["Taxonomy<br/>constants"]
end

subgraph group_modules["Domain Modules"]
  node_home{{"Home<br/>module group"}}
  node_work{{"Work<br/>module group"}}
  node_build{{"Build<br/>module group"}}
  node_connect{{"Connect<br/>module group"}}
  node_you{{"You<br/>module group"}}
  node_ai_insights(("AI Insights<br/>local analysis<br/>[AIInsights.jsx]"))
end

node_index_html -->|"boots"| node_main
node_index_html -->|"installs"| node_manifest
node_index_html -->|"cached by"| node_service_worker
node_main -->|"mounts"| node_app
node_app -->|"composes"| node_sidebar
node_app -->|"composes"| node_topbar
node_app -->|"composes"| node_alerts_strip
node_app -->|"drives"| node_use_alerts
node_alerts_strip -->|"renders"| node_use_alerts
node_app -->|"uses"| node_ui_components
node_app -->|"uses"| node_utils
node_app -->|"uses"| node_taxonomies
node_sidebar -->|"reads"| node_taxonomies
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_work
node_app -->|"routes to"| node_build
node_app -->|"routes to"| node_connect
node_app -->|"routes to"| node_you
node_you -->|"derives"| node_ai_insights
node_work -->|"shares"| node_ui_components
node_build -->|"shares"| node_utils
node_connect -->|"shares"| node_taxonomies
node_you -->|"emits"| node_use_alerts

click node_index_html "https://github.com/codenimra/devos/blob/main/index.html"
click node_manifest "https://github.com/codenimra/devos/blob/main/public/manifest.json"
click node_service_worker "https://github.com/codenimra/devos/blob/main/public/sw.js"
click node_main "https://github.com/codenimra/devos/blob/main/src/main.jsx"
click node_app "https://github.com/codenimra/devos/blob/main/src/App.jsx"
click node_sidebar "https://github.com/codenimra/devos/blob/main/src/layout/Sidebar.jsx"
click node_topbar "https://github.com/codenimra/devos/blob/main/src/layout/Topbar.jsx"
click node_alerts_strip "https://github.com/codenimra/devos/blob/main/src/layout/AlertsStrip.jsx"
click node_use_alerts "https://github.com/codenimra/devos/blob/main/src/hooks/useAlerts.js"
click node_ui_components "https://github.com/codenimra/devos/tree/main/src/components"
click node_utils "https://github.com/codenimra/devos/tree/main/src/utils"
click node_taxonomies "https://github.com/codenimra/devos/tree/main/src/constants"
click node_home "https://github.com/codenimra/devos/tree/main/src/pages"
click node_work "https://github.com/codenimra/devos/tree/main/src/pages"
click node_build "https://github.com/codenimra/devos/tree/main/src/pages"
click node_connect "https://github.com/codenimra/devos/tree/main/src/pages"
click node_you "https://github.com/codenimra/devos/tree/main/src/pages"
click node_ai_insights "https://github.com/codenimra/devos/blob/main/src/pages/AIInsights.jsx"

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_index_html,node_manifest,node_service_worker toneBlue
class node_main,node_app,node_sidebar,node_topbar,node_alerts_strip toneAmber
class node_use_alerts,node_ui_components,node_utils,node_taxonomies toneMint
class node_home,node_work,node_build,node_connect,node_you,node_ai_insights toneRose
```

## Components

### Runtime & PWA

Browser entry and offline installability layer.

- [index.html](https://github.com/codenimra/devos/blob/main/index.html): html boot shell · Bootstraps the single-page app and PWA shell. · `index.html`
- [Manifest](https://github.com/codenimra/devos/blob/main/public/manifest.json): pwa manifest · Installability metadata for the browser shell. · `public/manifest.json`
- [Service Worker](https://github.com/codenimra/devos/blob/main/public/sw.js): offline cache · Caches and serves assets for offline operation. · `public/sw.js`

### App Shell

Root orchestration and persistent UI frame.

- [Main](https://github.com/codenimra/devos/blob/main/src/main.jsx): react entry · React entry point that mounts the application. · `src/main.jsx`
- [App](https://github.com/codenimra/devos/blob/main/src/App.jsx): state orchestrator · Central state hub and module coordinator. · `src/App.jsx`
- [Sidebar](https://github.com/codenimra/devos/blob/main/src/layout/Sidebar.jsx): nav shell · Module navigation boundary. · `src/layout/Sidebar.jsx`
- [Topbar](https://github.com/codenimra/devos/blob/main/src/layout/Topbar.jsx): context shell · Top-level controls and context display. · `src/layout/Topbar.jsx`
- [Alerts](https://github.com/codenimra/devos/blob/main/src/layout/AlertsStrip.jsx): feedback surface · Renders surfaced notifications and lightweight alerts. · `src/layout/AlertsStrip.jsx`

### Shared Foundation

Reusable UI, hooks, utilities, and shared vocab.

- [useAlerts](https://github.com/codenimra/devos/blob/main/src/hooks/useAlerts.js): alerts hook · Encapsulates alert generation and state. · `src/hooks/useAlerts.js`
- [UI Kit](https://github.com/codenimra/devos/tree/main/src/components): shared components · Reusable dialogs, fields, empty states, and theme toggle. · `src/components`
- [Utils](https://github.com/codenimra/devos/tree/main/src/utils): helpers · Shared date, id, and color helpers. · `src/utils`
- [Taxonomy](https://github.com/codenimra/devos/tree/main/src/constants): constants · Shared statuses, platforms, and navigation structure. · `src/constants`

### Domain Modules

Grouped local-first application pages.

- [Home](https://github.com/codenimra/devos/tree/main/src/pages): module group · Dashboard and onboarding entry area. · `src/pages`
- [Work](https://github.com/codenimra/devos/tree/main/src/pages): module group · Projects, learning, jobs, and career tracking. · `src/pages`
- [Build](https://github.com/codenimra/devos/tree/main/src/pages): module group · Habits, goals, routines, and personal output. · `src/pages`
- [Connect](https://github.com/codenimra/devos/tree/main/src/pages): module group · People, events, calls, and social coordination. · `src/pages`
- [You](https://github.com/codenimra/devos/tree/main/src/pages): module group · Self-tracking, stats, journal, and personal profile. · `src/pages`
- [AI Insights](https://github.com/codenimra/devos/blob/main/src/pages/AIInsights.jsx): local analysis · Client-side coaching and derived insights from local data. · `src/pages/AIInsights.jsx`

## Connections

- index.html → Main: boots · Browser loads the React app.
- index.html → Manifest: installs · Provides PWA install metadata.
- index.html → Service Worker: cached by · Offline asset handling is attached to the shell.
- Main → App: mounts · React entry renders the root coordinator.
- App → Sidebar: composes · Root shell includes module navigation.
- App → Topbar: composes · Root shell includes persistent controls.
- App → Alerts: composes · Root shell includes alert presentation.
- App → useAlerts: drives · App state feeds alert generation.
- Alerts → useAlerts: renders · Alert state is surfaced through the strip.
- App → UI Kit: uses · Root and pages share low-level UI primitives.
- App → Utils: uses · Root-level data and formatting helpers support app state.
- App → Taxonomy: uses · Shared vocabulary and navigation structure inform orchestration.
- Sidebar → Taxonomy: reads · Navigation is driven by grouped constants.
- App → Home: routes to · Dashboard and auth/onboarding are top-level modules.
- App → Work: routes to · Work modules are selected from the root state.
- App → Build: routes to · Build modules are selected from the root state.
- App → Connect: routes to · Connect modules are selected from the root state.
- App → You: routes to · Self-tracking modules are selected from the root state.
- You → AI Insights: derives · AI Insights analyzes local user data within the browser.
- Work → UI Kit: shares · Pages reuse common dialogs and form controls.
- Build → Utils: shares · Modules rely on common ids, dates, and colors.
- Connect → Taxonomy: shares · Modules align to shared labels and statuses.
- You → useAlerts: emits · Self-tracking actions can raise alerts.
