# inkand-paper/optimizer architecture

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

- Interactive diagram: https://gitdiagram.com/inkand-paper/optimizer
- Repository: https://github.com/inkand-paper/optimizer

## Overview

NexPulse is an infrastructure intelligence platform for development teams. Users work from the dashboard to monitor sites, inspect incidents, audit code, and manage integrations; API and scheduled endpoints provide automation and public status pages. The graph preserves the README’s major capabilities, including cache revalidation, SEO/performance analysis, AI assistance, trials, digests, and webhooks. Some subsystems are represented by their exact enclosing directories because their implementation was not sampled; their internal relationships are therefore omitted where evidence is unavailable.

Main entry points: [`app/dashboard/page.tsx`](https://github.com/inkand-paper/optimizer/blob/main/app/dashboard/page.tsx) (Command dashboard), [`lib/prisma.ts`](https://github.com/inkand-paper/optimizer/blob/main/lib/prisma.ts) (Application database), [`app/api/monitors/route.ts`](https://github.com/inkand-paper/optimizer/blob/main/app/api/monitors/route.ts) (Monitor management), [`app/api/revalidate/route.ts`](https://github.com/inkand-paper/optimizer/blob/main/app/api/revalidate/route.ts) (Cache revalidation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Product experience"]
  node_dashboard["Command dashboard<br/>[page.tsx]"]
  node_status_page["Public status pages<br/>[page.tsx]"]
  node_monitor_ui["Monitoring dashboard"]
  node_audit_ui["Code audit console"]
end

subgraph group_monitoring["Monitoring and operations"]
  node_monitor_api["Monitor management<br/>[route.ts]"]
  node_monitor_engine["Health checks<br/>[monitoring.ts]"]
  node_autopilot["Incident automation<br/>[route.ts]"]
  node_finops["FinOps insights<br/>[finops-preview.tsx]"]
end

subgraph group_analysis["Auditing and AI"]
  node_audit_api["Code audit endpoint<br/>[route.ts]"]
  node_audit_engine["AI code review<br/>[code-review.ts]"]
  node_web_audit["SEO and performance audit<br/>[index.ts]"]
  node_ai_assistant["Pulse-AI assistant<br/>[route.ts]"]
end

subgraph group_automation["Automation and integrations"]
  node_pr_bot["Pull request bot<br/>[route.ts]"]
  node_cache_api["Cache revalidation<br/>[route.ts]"]
  node_webhook_manager["Webhook management"]
  node_webhook_dispatch["Webhook delivery<br/>[webhooks.ts]"]
  node_mcp["MCP tools API<br/>[route.ts]"]
end

subgraph group_platform["Accounts and platform"]
  node_account_api["Account and MFA"]
  node_trial_system["Student and gifted trials"]
  node_digest["Weekly email digest<br/>[route.ts]"]
  node_database[("Application database<br/>[prisma.ts]")]
  node_plans["Plan entitlements<br/>[plans.ts]"]
end

node_team(("Engineering team"))
node_external_services["External services"]

node_team -->|"uses"| node_dashboard
node_dashboard -->|"shows"| node_monitor_ui
node_dashboard -->|"shows"| node_audit_ui
node_dashboard -->|"shows"| node_finops
node_dashboard -->|"offers"| node_pr_bot
node_team -->|"views"| node_status_page
node_monitor_ui -.->|"manages"| node_monitor_api
node_monitor_api -->|"uses"| node_monitor_engine
node_monitor_api -->|"reads and writes"| node_database
node_team -->|"submits code"| node_audit_ui
node_audit_ui -.->|"requests audits"| node_audit_api
node_audit_api -->|"runs review"| node_audit_engine
node_audit_api -->|"stores reviews"| node_database
node_audit_engine -->|"queries AI providers"| node_external_services
node_team -->|"audits live URLs"| node_web_audit
node_team -->|"asks questions"| node_ai_assistant
node_team -->|"requests revalidation"| node_cache_api
node_cache_api -->|"looks up keys"| node_database
node_cache_api -->|"dispatches events"| node_webhook_dispatch
node_cache_api -->|"sends email alerts"| node_external_services
node_webhook_manager -.->|"registers destinations"| node_external_services
node_webhook_dispatch -->|"loads subscriptions"| node_database
node_webhook_dispatch -->|"posts alerts"| node_external_services
node_team -->|"invokes tools"| node_mcp
node_mcp -->|"reads monitor data"| node_database
node_mcp -->|"runs URL audit"| node_web_audit
node_account_api -.->|"manages accounts"| node_database
node_trial_system -.->|"manages trial access"| node_database
node_digest -->|"sends summaries"| node_external_services
node_dashboard -->|"presents plan features"| node_plans
node_monitor_api -->|"checks limits"| node_plans

click node_dashboard "https://github.com/inkand-paper/optimizer/blob/main/app/dashboard/page.tsx"
click node_status_page "https://github.com/inkand-paper/optimizer/blob/main/app/status/%5Bslug%5D/page.tsx"
click node_monitor_ui "https://github.com/inkand-paper/optimizer/blob/main/components/monitoring-dashboard.tsx"
click node_monitor_api "https://github.com/inkand-paper/optimizer/blob/main/app/api/monitors/route.ts"
click node_monitor_engine "https://github.com/inkand-paper/optimizer/blob/main/lib/monitoring.ts"
click node_autopilot "https://github.com/inkand-paper/optimizer/blob/main/app/api/autopilot/incidents/route.ts"
click node_finops "https://github.com/inkand-paper/optimizer/blob/main/components/finops-preview.tsx"
click node_audit_ui "https://github.com/inkand-paper/optimizer/blob/main/components/code-audit-console.tsx"
click node_audit_api "https://github.com/inkand-paper/optimizer/blob/main/app/api/code-review/route.ts"
click node_audit_engine "https://github.com/inkand-paper/optimizer/blob/main/core/analyzer/code-review.ts"
click node_web_audit "https://github.com/inkand-paper/optimizer/blob/main/core/analyzer/index.ts"
click node_ai_assistant "https://github.com/inkand-paper/optimizer/blob/main/app/api/ai/chat/route.ts"
click node_pr_bot "https://github.com/inkand-paper/optimizer/blob/main/app/api/pr-bot/route.ts"
click node_cache_api "https://github.com/inkand-paper/optimizer/blob/main/app/api/revalidate/route.ts"
click node_webhook_manager "https://github.com/inkand-paper/optimizer/blob/main/components/webhook-manager.tsx"
click node_webhook_dispatch "https://github.com/inkand-paper/optimizer/blob/main/lib/webhooks.ts"
click node_mcp "https://github.com/inkand-paper/optimizer/blob/main/app/api/mcp/route.ts"
click node_account_api "https://github.com/inkand-paper/optimizer/tree/main/app/api/auth"
click node_trial_system "https://github.com/inkand-paper/optimizer/tree/main/app/api/student"
click node_digest "https://github.com/inkand-paper/optimizer/blob/main/app/api/cron/weekly-digest/route.ts"
click node_database "https://github.com/inkand-paper/optimizer/blob/main/lib/prisma.ts"
click node_plans "https://github.com/inkand-paper/optimizer/blob/main/lib/plans.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_dashboard,node_status_page,node_monitor_ui,node_audit_ui toneBlue
class node_monitor_api,node_monitor_engine,node_autopilot,node_finops toneAmber
class node_audit_api,node_audit_engine,node_web_audit,node_ai_assistant toneMint
class node_pr_bot,node_cache_api,node_webhook_manager,node_webhook_dispatch,node_mcp toneRose
class node_account_api,node_trial_system,node_digest,node_database,node_plans,node_team,node_external_services toneIndigo
```

## Components

### Product experience

- [Command dashboard](https://github.com/inkand-paper/optimizer/blob/main/app/dashboard/page.tsx): `app/dashboard/page.tsx`
- [Public status pages](https://github.com/inkand-paper/optimizer/blob/main/app/status/%5Bslug%5D/page.tsx): `app/status/[slug]/page.tsx`
- [Monitoring dashboard](https://github.com/inkand-paper/optimizer/blob/main/components/monitoring-dashboard.tsx): `components/monitoring-dashboard.tsx`
- [Code audit console](https://github.com/inkand-paper/optimizer/blob/main/components/code-audit-console.tsx): `components/code-audit-console.tsx`

### Monitoring and operations

- [Monitor management](https://github.com/inkand-paper/optimizer/blob/main/app/api/monitors/route.ts): `app/api/monitors/route.ts`
- [Health checks](https://github.com/inkand-paper/optimizer/blob/main/lib/monitoring.ts): `lib/monitoring.ts`
- [Incident automation](https://github.com/inkand-paper/optimizer/blob/main/app/api/autopilot/incidents/route.ts): `app/api/autopilot/incidents/route.ts`
- [FinOps insights](https://github.com/inkand-paper/optimizer/blob/main/components/finops-preview.tsx): `components/finops-preview.tsx`

### Auditing and AI

- [Code audit endpoint](https://github.com/inkand-paper/optimizer/blob/main/app/api/code-review/route.ts): `app/api/code-review/route.ts`
- [AI code review](https://github.com/inkand-paper/optimizer/blob/main/core/analyzer/code-review.ts): `core/analyzer/code-review.ts`
- [SEO and performance audit](https://github.com/inkand-paper/optimizer/blob/main/core/analyzer/index.ts): `core/analyzer/index.ts`
- [Pulse-AI assistant](https://github.com/inkand-paper/optimizer/blob/main/app/api/ai/chat/route.ts): `app/api/ai/chat/route.ts`

### Automation and integrations

- [Pull request bot](https://github.com/inkand-paper/optimizer/blob/main/app/api/pr-bot/route.ts): `app/api/pr-bot/route.ts`
- [Cache revalidation](https://github.com/inkand-paper/optimizer/blob/main/app/api/revalidate/route.ts): `app/api/revalidate/route.ts`
- [Webhook management](https://github.com/inkand-paper/optimizer/blob/main/components/webhook-manager.tsx): `components/webhook-manager.tsx`
- [Webhook delivery](https://github.com/inkand-paper/optimizer/blob/main/lib/webhooks.ts): `lib/webhooks.ts`
- [MCP tools API](https://github.com/inkand-paper/optimizer/blob/main/app/api/mcp/route.ts): `app/api/mcp/route.ts`

### Accounts and platform

- [Account and MFA](https://github.com/inkand-paper/optimizer/tree/main/app/api/auth): `app/api/auth`
- [Student and gifted trials](https://github.com/inkand-paper/optimizer/tree/main/app/api/student): `app/api/student`
- [Weekly email digest](https://github.com/inkand-paper/optimizer/blob/main/app/api/cron/weekly-digest/route.ts): `app/api/cron/weekly-digest/route.ts`
- [Application database](https://github.com/inkand-paper/optimizer/blob/main/lib/prisma.ts): `lib/prisma.ts`
- [Plan entitlements](https://github.com/inkand-paper/optimizer/blob/main/lib/plans.ts): `lib/plans.ts`

### Other components

- **Engineering team**
- **External services**

## Connections

- Engineering team → Command dashboard: uses
- Command dashboard → Monitoring dashboard: shows (evidence: `app/dashboard/page.tsx`)
- Command dashboard → Code audit console: shows (evidence: `app/dashboard/page.tsx`)
- Command dashboard → FinOps insights: shows (evidence: `app/dashboard/page.tsx`)
- Command dashboard → Pull request bot: offers (evidence: `app/dashboard/page.tsx`)
- Engineering team → Public status pages: views
- Monitoring dashboard → Monitor management: manages
- Monitor management → Health checks: uses (evidence: `app/api/monitors/route.ts`)
- Monitor management → Application database: reads and writes (evidence: `app/api/monitors/route.ts`)
- Engineering team → Code audit console: submits code
- Code audit console → Code audit endpoint: requests audits
- Code audit endpoint → AI code review: runs review (evidence: `app/api/code-review/route.ts`)
- Code audit endpoint → Application database: stores reviews (evidence: `app/api/code-review/route.ts`)
- AI code review → External services: queries AI providers (evidence: `core/analyzer/code-review.ts`)
- Engineering team → SEO and performance audit: audits live URLs
- Engineering team → Pulse-AI assistant: asks questions
- Engineering team → Cache revalidation: requests revalidation
- Cache revalidation → Application database: looks up keys (evidence: `app/api/revalidate/route.ts`)
- Cache revalidation → Webhook delivery: dispatches events (evidence: `app/api/revalidate/route.ts`)
- Cache revalidation → External services: sends email alerts (evidence: `app/api/revalidate/route.ts`)
- Webhook management → External services: registers destinations
- Webhook delivery → Application database: loads subscriptions (evidence: `lib/webhooks.ts`)
- Webhook delivery → External services: posts alerts (evidence: `lib/webhooks.ts`)
- Engineering team → MCP tools API: invokes tools
- MCP tools API → Application database: reads monitor data (evidence: `app/api/mcp/route.ts`)
- MCP tools API → SEO and performance audit: runs URL audit (evidence: `app/api/mcp/route.ts`)
- Account and MFA → Application database: manages accounts
- Student and gifted trials → Application database: manages trial access
- Weekly email digest → External services: sends summaries
- Command dashboard → Plan entitlements: presents plan features (evidence: `app/dashboard/page.tsx`)
- Monitor management → Plan entitlements: checks limits (evidence: `app/api/monitors/route.ts`)
