# mahipal1127/solarpulse architecture

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

- Interactive diagram: https://gitdiagram.com/mahipal1127/solarpulse
- Repository: https://github.com/mahipal1127/solarpulse

## Overview

Solar Pulse OS is a multi-tenant solar-business ERP with role-specific workspaces spanning HR, finance, sales, operations, distribution, technical, DISCOM, marketing, store, tender, and executive oversight. Users sign in and enter a guarded module workspace, manage domain records and tasks, and receive results through dashboards, reports, and workflow updates. Next.js route handlers and domain services mediate application operations against Supabase; Postgres RLS is the documented data-access boundary. The README documents broad capabilities, but many module implementations were not sampled, so their internal links are omitted or marked unverified.

Main entry points: [`app/api`](https://github.com/mahipal1127/solarpulse/tree/main/app/api) (API routes), [`app`](https://github.com/mahipal1127/solarpulse/tree/main/app) (Role workspaces), [`lib/services`](https://github.com/mahipal1127/solarpulse/tree/main/lib/services) (Domain services), [`lib/services/tasks.ts`](https://github.com/mahipal1127/solarpulse/blob/main/lib/services/tasks.ts) (Task workflows)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and platform"]
  node_workspace["Role workspaces"]
  node_login["Sign-in<br/>[page.tsx]"]
  node_guards["Access guards<br/>[guards.ts]"]
  node_api["API routes"]
  node_validation["Input schemas<br/>[schemas.ts]"]
  node_services["Domain services"]
  node_supabase[("Supabase<br/>[server.ts]")]
  node_audit["Audit logging<br/>[log.ts]"]
end

subgraph group_work["Work management"]
  node_tasks["Task workflows<br/>[tasks.ts]"]
  node_taskboard["Employee task board<br/>[MyTaskBoard.tsx]"]
  node_departmentinbox["Department task inbox"]
  node_pulseai["AI assistant panel<br/>[PulseAIPanel.tsx]"]
  node_ai["AI features"]
end

subgraph group_commercial["Commercial operations"]
  node_sales["Sales pipeline"]
  node_finance["Finance operations"]
  node_distribution["Distribution and purchasing"]
  node_store["Store and inventory"]
end

subgraph group_delivery["Solar delivery"]
  node_technical["Surveys and design"]
  node_om["Installations and service"]
  node_rooftop["Rooftop projects"]
  node_discom["DISCOM and subsidy"]
  node_tender["Tender and bids"]
end

subgraph group_oversight["People and oversight"]
  node_hr["HR and workforce"]
  node_marketing["Marketing"]
  node_ceo["Executive oversight"]
  node_reports["Employee reports"]
end

node_staff(("ERP users"))

node_staff -->|"signs in"| node_login
node_staff -.->|"uses"| node_workspace
node_login -.->|"checks session"| node_guards
node_workspace -->|"guards access"| node_guards
node_workspace -.->|"submits operations"| node_api
node_api -->|"validates input"| node_validation
node_api -.->|"dispatches"| node_services
node_services -->|"reads and writes"| node_supabase
node_supabase -->|"enforces RLS"| node_staff
node_services -->|"logs mutations"| node_audit
node_workspace -.->|"uses task workflows"| node_tasks
node_taskboard -.->|"manages tasks"| node_tasks
node_departmentinbox -.->|"delegates tasks"| node_tasks
node_workspace -.->|"offers assistant"| node_pulseai
node_pulseai -->|"presents AI features"| node_ai
node_sales -.->|"manages sales records"| node_api
node_finance -.->|"manages finance records"| node_api
node_distribution -.->|"manages purchasing"| node_api
node_store -.->|"manages inventory"| node_api
node_technical -.->|"manages surveys"| node_api
node_om -.->|"manages service"| node_api
node_rooftop -.->|"manages projects"| node_api
node_discom -.->|"manages applications"| node_api
node_tender -.->|"manages bids"| node_api
node_hr -.->|"manages workforce"| node_api
node_marketing -.->|"manages campaigns"| node_api
node_ceo -.->|"oversees operations"| node_api
node_workspace -.->|"views reports"| node_reports

click node_workspace "https://github.com/mahipal1127/solarpulse/tree/main/app"
click node_login "https://github.com/mahipal1127/solarpulse/blob/main/app/login/page.tsx"
click node_guards "https://github.com/mahipal1127/solarpulse/blob/main/lib/auth/guards.ts"
click node_api "https://github.com/mahipal1127/solarpulse/tree/main/app/api"
click node_validation "https://github.com/mahipal1127/solarpulse/blob/main/lib/validation/schemas.ts"
click node_services "https://github.com/mahipal1127/solarpulse/tree/main/lib/services"
click node_supabase "https://github.com/mahipal1127/solarpulse/blob/main/lib/supabase/server.ts"
click node_audit "https://github.com/mahipal1127/solarpulse/blob/main/lib/audit/log.ts"
click node_tasks "https://github.com/mahipal1127/solarpulse/blob/main/lib/services/tasks.ts"
click node_taskboard "https://github.com/mahipal1127/solarpulse/blob/main/components/employee/MyTaskBoard.tsx"
click node_departmentinbox "https://github.com/mahipal1127/solarpulse/blob/main/components/shared/DepartmentTaskInbox.tsx"
click node_pulseai "https://github.com/mahipal1127/solarpulse/blob/main/components/shared/PulseAIPanel.tsx"
click node_ai "https://github.com/mahipal1127/solarpulse/tree/main/lib/ai"
click node_sales "https://github.com/mahipal1127/solarpulse/tree/main/app/sales"
click node_finance "https://github.com/mahipal1127/solarpulse/tree/main/app/finance"
click node_distribution "https://github.com/mahipal1127/solarpulse/tree/main/app/distribution"
click node_store "https://github.com/mahipal1127/solarpulse/tree/main/app/store"
click node_technical "https://github.com/mahipal1127/solarpulse/tree/main/app/technical"
click node_om "https://github.com/mahipal1127/solarpulse/tree/main/app/om"
click node_rooftop "https://github.com/mahipal1127/solarpulse/tree/main/app/rooftop"
click node_discom "https://github.com/mahipal1127/solarpulse/tree/main/app/discom"
click node_tender "https://github.com/mahipal1127/solarpulse/tree/main/app/(tender)"
click node_hr "https://github.com/mahipal1127/solarpulse/tree/main/app/hr"
click node_marketing "https://github.com/mahipal1127/solarpulse/tree/main/app/marketing"
click node_ceo "https://github.com/mahipal1127/solarpulse/tree/main/app/(ceo)"
click node_reports "https://github.com/mahipal1127/solarpulse/blob/main/lib/services/employee-reports.ts"

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_workspace,node_login,node_guards,node_api,node_validation,node_services,node_supabase,node_audit,node_staff toneBlue
class node_tasks,node_taskboard,node_departmentinbox,node_pulseai,node_ai toneAmber
class node_sales,node_finance,node_distribution,node_store toneMint
class node_technical,node_om,node_rooftop,node_discom,node_tender toneRose
class node_hr,node_marketing,node_ceo,node_reports toneIndigo
```

## Components

### Access and platform

- [Role workspaces](https://github.com/mahipal1127/solarpulse/tree/main/app): `app`
- [Sign-in](https://github.com/mahipal1127/solarpulse/blob/main/app/login/page.tsx): `app/login/page.tsx`
- [Access guards](https://github.com/mahipal1127/solarpulse/blob/main/lib/auth/guards.ts): `lib/auth/guards.ts`
- [API routes](https://github.com/mahipal1127/solarpulse/tree/main/app/api): `app/api`
- [Input schemas](https://github.com/mahipal1127/solarpulse/blob/main/lib/validation/schemas.ts): `lib/validation/schemas.ts`
- [Domain services](https://github.com/mahipal1127/solarpulse/tree/main/lib/services): `lib/services`
- [Supabase](https://github.com/mahipal1127/solarpulse/blob/main/lib/supabase/server.ts): `lib/supabase/server.ts`
- [Audit logging](https://github.com/mahipal1127/solarpulse/blob/main/lib/audit/log.ts): `lib/audit/log.ts`

### Work management

- [Task workflows](https://github.com/mahipal1127/solarpulse/blob/main/lib/services/tasks.ts): `lib/services/tasks.ts`
- [Employee task board](https://github.com/mahipal1127/solarpulse/blob/main/components/employee/MyTaskBoard.tsx): `components/employee/MyTaskBoard.tsx`
- [Department task inbox](https://github.com/mahipal1127/solarpulse/blob/main/components/shared/DepartmentTaskInbox.tsx): `components/shared/DepartmentTaskInbox.tsx`
- [AI assistant panel](https://github.com/mahipal1127/solarpulse/blob/main/components/shared/PulseAIPanel.tsx): `components/shared/PulseAIPanel.tsx`
- [AI features](https://github.com/mahipal1127/solarpulse/tree/main/lib/ai): `lib/ai`

### Commercial operations

- [Sales pipeline](https://github.com/mahipal1127/solarpulse/tree/main/app/sales): `app/sales`
- [Finance operations](https://github.com/mahipal1127/solarpulse/tree/main/app/finance): `app/finance`
- [Distribution and purchasing](https://github.com/mahipal1127/solarpulse/tree/main/app/distribution): `app/distribution`
- [Store and inventory](https://github.com/mahipal1127/solarpulse/tree/main/app/store): `app/store`

### Solar delivery

- [Surveys and design](https://github.com/mahipal1127/solarpulse/tree/main/app/technical): `app/technical`
- [Installations and service](https://github.com/mahipal1127/solarpulse/tree/main/app/om): `app/om`
- [Rooftop projects](https://github.com/mahipal1127/solarpulse/tree/main/app/rooftop): `app/rooftop`
- [DISCOM and subsidy](https://github.com/mahipal1127/solarpulse/tree/main/app/discom): `app/discom`
- [Tender and bids](https://github.com/mahipal1127/solarpulse/tree/main/app/(tender)): `app/(tender)`

### People and oversight

- [HR and workforce](https://github.com/mahipal1127/solarpulse/tree/main/app/hr): `app/hr`
- [Marketing](https://github.com/mahipal1127/solarpulse/tree/main/app/marketing): `app/marketing`
- [Executive oversight](https://github.com/mahipal1127/solarpulse/tree/main/app/(ceo)): `app/(ceo)`
- [Employee reports](https://github.com/mahipal1127/solarpulse/blob/main/lib/services/employee-reports.ts): `lib/services/employee-reports.ts`

### Other components

- **ERP users**

## Connections

- ERP users → Sign-in: signs in (evidence: `README.md`)
- ERP users → Role workspaces: uses
- Sign-in → Access guards: checks session
- Role workspaces → Access guards: guards access (evidence: `README.md`)
- Role workspaces → API routes: submits operations
- API routes → Input schemas: validates input (evidence: `README.md`)
- API routes → Domain services: dispatches (evidence: `app/api/discom-documents/route.ts`)
- Domain services → Supabase: reads and writes (evidence: `README.md`)
- Supabase → ERP users: enforces RLS (evidence: `README.md`)
- Domain services → Audit logging: logs mutations (evidence: `README.md`)
- Role workspaces → Task workflows: uses task workflows
- Employee task board → Task workflows: manages tasks
- Department task inbox → Task workflows: delegates tasks
- Role workspaces → AI assistant panel: offers assistant (evidence: `app/sales/dashboard/page.tsx`)
- AI assistant panel → AI features: presents AI features (evidence: `components/shared/PulseAIPanel.tsx`)
- Sales pipeline → API routes: manages sales records
- Finance operations → API routes: manages finance records
- Distribution and purchasing → API routes: manages purchasing
- Store and inventory → API routes: manages inventory
- Surveys and design → API routes: manages surveys
- Installations and service → API routes: manages service
- Rooftop projects → API routes: manages projects
- DISCOM and subsidy → API routes: manages applications
- Tender and bids → API routes: manages bids
- HR and workforce → API routes: manages workforce
- Marketing → API routes: manages campaigns
- Executive oversight → API routes: oversees operations
- Role workspaces → Employee reports: views reports (evidence: `app/(ceo)/reports/page.tsx`)
