# drubixcage/kritya architecture

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

- Interactive diagram: https://gitdiagram.com/drubixcage/kritya
- Repository: https://github.com/drubixcage/kritya

## Overview

This is a travel-booking CRM for sales, charging, customer service, and administrators. Its central workflow is booking/lead intake, assignment and sales follow-up, transition to charging or support, and operational oversight; internal chat and user administration are parallel capabilities. The graph reflects the visible API-to-store and page-to-view relationships. Many client-to-API interactions are dynamic or absent from the available references, so those links are omitted rather than inferred.

Main entry points: [`src/lib/store.ts`](https://github.com/drubixcage/kritya/blob/main/src/lib/store.ts) (CRM state and operations), [`src/app/page.tsx`](https://github.com/drubixcage/kritya/blob/main/src/app/page.tsx) (CRM workspace), [`src/components/leads/LeadWorkspaceModal.tsx`](https://github.com/drubixcage/kritya/blob/main/src/components/leads/LeadWorkspaceModal.tsx) (Lead workspace), [`src/components/dashboard/SalesView.tsx`](https://github.com/drubixcage/kritya/blob/main/src/components/dashboard/SalesView.tsx) (Sales view)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["CRM experience"]
  node_workspace["CRM workspace<br/>[page.tsx]"]
  node_sales["Sales view<br/>[SalesView.tsx]"]
  node_charging["Charging view<br/>[ChargingView.tsx]"]
  node_customer_service["Customer service view<br/>[CSView.tsx]"]
  node_admin_view["Admin dashboard<br/>[SuperAdminView.tsx]"]
  node_chat_ui["Internal chat"]
  node_chat_api["Chat API<br/>[route.ts]"]
  node_email_editor["Email editor"]
  node_performance["Agent performance"]
  node_status_chip["Lead status display<br/>[StatusChip.tsx]"]
end

subgraph group_operations["Lead operations"]
  node_lead_workspace["Lead workspace"]
  node_lead_intake["Booking intake"]
  node_reservation_view["Reservation details"]
  node_lead_api["Lead API"]
  node_travelocase_hook["Travelocase webhook<br/>[route.ts]"]
  node_ticket_api["Ticket API<br/>[route.ts]"]
  node_charging_api["Charging API<br/>[route.ts]"]
end

subgraph group_services["CRM services"]
  node_store[("CRM state and operations<br/>[store.ts]")]
  node_permissions["Role permissions<br/>[rbac.ts]"]
  node_events["Domain event bus<br/>[event-bus.ts]"]
  node_verification["Lead verification<br/>[verification.ts]"]
  node_email_templates["Email templates<br/>[templates.ts]"]
  node_smtp["SMTP delivery<br/>[smtp.ts]"]
  node_mock_data["Seed and fallback data<br/>[mock-data.ts]"]
end

subgraph group_administration["Administration"]
  node_user_api["User API<br/>[route.ts]"]
  node_user_modal["User onboarding"]
end

node_staff(("CRM staff"))

node_staff -->|"uses"| node_workspace
node_workspace -->|"renders"| node_sales
node_workspace -->|"renders"| node_charging
node_workspace -->|"renders"| node_customer_service
node_workspace -->|"renders"| node_admin_view
node_workspace -->|"renders"| node_lead_intake
node_workspace -->|"renders"| node_lead_workspace
node_workspace -->|"renders"| node_chat_ui
node_sales -->|"renders"| node_status_chip
node_sales -->|"renders"| node_performance
node_lead_workspace -->|"renders"| node_status_chip
node_lead_workspace -->|"renders"| node_reservation_view
node_lead_workspace -->|"renders"| node_email_templates
node_lead_workspace -->|"uses"| node_email_editor
node_lead_intake -->|"checks sender"| node_verification
node_chat_ui -.->|"exchanges messages"| node_chat_api
node_lead_intake -.->|"submits booking"| node_lead_api
node_staff -.->|"requests lead actions"| node_lead_api
node_travelocase_hook -->|"updates CRM"| node_store
node_lead_api -->|"reads and writes"| node_store
node_chat_api -->|"reads and writes"| node_store
node_user_api -->|"reads and writes"| node_store
node_ticket_api -->|"reads and writes"| node_store
node_charging_api -->|"reads and writes"| node_store
node_store -->|"checks authorization"| node_permissions
node_store -->|"broadcasts events"| node_events
node_store -->|"renders email"| node_email_templates
node_store -->|"uses verification"| node_verification
node_store -->|"loads fallback data"| node_mock_data
node_user_api -.->|"serves onboarding"| node_user_modal
node_store -.->|"sends email"| node_smtp

click node_workspace "https://github.com/drubixcage/kritya/blob/main/src/app/page.tsx"
click node_sales "https://github.com/drubixcage/kritya/blob/main/src/components/dashboard/SalesView.tsx"
click node_charging "https://github.com/drubixcage/kritya/blob/main/src/components/dashboard/ChargingView.tsx"
click node_customer_service "https://github.com/drubixcage/kritya/blob/main/src/components/dashboard/CSView.tsx"
click node_admin_view "https://github.com/drubixcage/kritya/blob/main/src/components/dashboard/SuperAdminView.tsx"
click node_lead_workspace "https://github.com/drubixcage/kritya/blob/main/src/components/leads/LeadWorkspaceModal.tsx"
click node_lead_intake "https://github.com/drubixcage/kritya/blob/main/src/components/leads/LeadIngestionModal.tsx"
click node_reservation_view "https://github.com/drubixcage/kritya/blob/main/src/components/leads/SimpleReservationView.tsx"
click node_lead_api "https://github.com/drubixcage/kritya/tree/main/src/app/api/leads"
click node_travelocase_hook "https://github.com/drubixcage/kritya/blob/main/src/app/api/webhooks/travelocase/route.ts"
click node_chat_ui "https://github.com/drubixcage/kritya/blob/main/src/components/chat/InternalChatDrawer.tsx"
click node_chat_api "https://github.com/drubixcage/kritya/blob/main/src/app/api/chat/route.ts"
click node_user_api "https://github.com/drubixcage/kritya/blob/main/src/app/api/users/route.ts"
click node_user_modal "https://github.com/drubixcage/kritya/blob/main/src/components/users/CreateUserModal.tsx"
click node_store "https://github.com/drubixcage/kritya/blob/main/src/lib/store.ts"
click node_permissions "https://github.com/drubixcage/kritya/blob/main/src/lib/rbac.ts"
click node_events "https://github.com/drubixcage/kritya/blob/main/src/lib/event-bus.ts"
click node_verification "https://github.com/drubixcage/kritya/blob/main/src/lib/verification.ts"
click node_email_templates "https://github.com/drubixcage/kritya/blob/main/src/lib/templates.ts"
click node_email_editor "https://github.com/drubixcage/kritya/blob/main/src/components/common/RichTextEmailEditor.tsx"
click node_smtp "https://github.com/drubixcage/kritya/blob/main/src/lib/smtp.ts"
click node_performance "https://github.com/drubixcage/kritya/blob/main/src/components/dashboard/AgentMonthlyPerformanceCard.tsx"
click node_status_chip "https://github.com/drubixcage/kritya/blob/main/src/components/common/StatusChip.tsx"
click node_mock_data "https://github.com/drubixcage/kritya/blob/main/src/lib/mock-data.ts"
click node_ticket_api "https://github.com/drubixcage/kritya/blob/main/src/app/api/tickets/route.ts"
click node_charging_api "https://github.com/drubixcage/kritya/blob/main/src/app/api/charging/route.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_sales,node_charging,node_customer_service,node_admin_view,node_chat_ui,node_chat_api,node_email_editor,node_performance,node_status_chip toneBlue
class node_lead_workspace,node_lead_intake,node_reservation_view,node_lead_api,node_travelocase_hook,node_ticket_api,node_charging_api toneAmber
class node_store,node_permissions,node_events,node_verification,node_email_templates,node_smtp,node_mock_data toneMint
class node_user_api,node_user_modal toneRose
class node_staff toneIndigo
```

## Components

### CRM experience

- [CRM workspace](https://github.com/drubixcage/kritya/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Sales view](https://github.com/drubixcage/kritya/blob/main/src/components/dashboard/SalesView.tsx): `src/components/dashboard/SalesView.tsx`
- [Charging view](https://github.com/drubixcage/kritya/blob/main/src/components/dashboard/ChargingView.tsx): `src/components/dashboard/ChargingView.tsx`
- [Customer service view](https://github.com/drubixcage/kritya/blob/main/src/components/dashboard/CSView.tsx): `src/components/dashboard/CSView.tsx`
- [Admin dashboard](https://github.com/drubixcage/kritya/blob/main/src/components/dashboard/SuperAdminView.tsx): `src/components/dashboard/SuperAdminView.tsx`
- [Internal chat](https://github.com/drubixcage/kritya/blob/main/src/components/chat/InternalChatDrawer.tsx): `src/components/chat/InternalChatDrawer.tsx`
- [Chat API](https://github.com/drubixcage/kritya/blob/main/src/app/api/chat/route.ts): `src/app/api/chat/route.ts`
- [Email editor](https://github.com/drubixcage/kritya/blob/main/src/components/common/RichTextEmailEditor.tsx): `src/components/common/RichTextEmailEditor.tsx`
- [Agent performance](https://github.com/drubixcage/kritya/blob/main/src/components/dashboard/AgentMonthlyPerformanceCard.tsx): `src/components/dashboard/AgentMonthlyPerformanceCard.tsx`
- [Lead status display](https://github.com/drubixcage/kritya/blob/main/src/components/common/StatusChip.tsx): `src/components/common/StatusChip.tsx`

### Lead operations

- [Lead workspace](https://github.com/drubixcage/kritya/blob/main/src/components/leads/LeadWorkspaceModal.tsx): `src/components/leads/LeadWorkspaceModal.tsx`
- [Booking intake](https://github.com/drubixcage/kritya/blob/main/src/components/leads/LeadIngestionModal.tsx): `src/components/leads/LeadIngestionModal.tsx`
- [Reservation details](https://github.com/drubixcage/kritya/blob/main/src/components/leads/SimpleReservationView.tsx): `src/components/leads/SimpleReservationView.tsx`
- [Lead API](https://github.com/drubixcage/kritya/tree/main/src/app/api/leads): `src/app/api/leads`
- [Travelocase webhook](https://github.com/drubixcage/kritya/blob/main/src/app/api/webhooks/travelocase/route.ts): `src/app/api/webhooks/travelocase/route.ts`
- [Ticket API](https://github.com/drubixcage/kritya/blob/main/src/app/api/tickets/route.ts): `src/app/api/tickets/route.ts`
- [Charging API](https://github.com/drubixcage/kritya/blob/main/src/app/api/charging/route.ts): `src/app/api/charging/route.ts`

### CRM services

- [CRM state and operations](https://github.com/drubixcage/kritya/blob/main/src/lib/store.ts): `src/lib/store.ts`
- [Role permissions](https://github.com/drubixcage/kritya/blob/main/src/lib/rbac.ts): `src/lib/rbac.ts`
- [Domain event bus](https://github.com/drubixcage/kritya/blob/main/src/lib/event-bus.ts): `src/lib/event-bus.ts`
- [Lead verification](https://github.com/drubixcage/kritya/blob/main/src/lib/verification.ts): `src/lib/verification.ts`
- [Email templates](https://github.com/drubixcage/kritya/blob/main/src/lib/templates.ts): `src/lib/templates.ts`
- [SMTP delivery](https://github.com/drubixcage/kritya/blob/main/src/lib/smtp.ts): `src/lib/smtp.ts`
- [Seed and fallback data](https://github.com/drubixcage/kritya/blob/main/src/lib/mock-data.ts): `src/lib/mock-data.ts`

### Administration

- [User API](https://github.com/drubixcage/kritya/blob/main/src/app/api/users/route.ts): `src/app/api/users/route.ts`
- [User onboarding](https://github.com/drubixcage/kritya/blob/main/src/components/users/CreateUserModal.tsx): `src/components/users/CreateUserModal.tsx`

### Other components

- **CRM staff**

## Connections

- CRM staff → CRM workspace: uses
- CRM workspace → Sales view: renders (evidence: `src/app/page.tsx`)
- CRM workspace → Charging view: renders (evidence: `src/app/page.tsx`)
- CRM workspace → Customer service view: renders (evidence: `src/app/page.tsx`)
- CRM workspace → Admin dashboard: renders (evidence: `src/app/page.tsx`)
- CRM workspace → Booking intake: renders (evidence: `src/app/page.tsx`)
- CRM workspace → Lead workspace: renders (evidence: `src/app/page.tsx`)
- CRM workspace → Internal chat: renders (evidence: `src/app/page.tsx`)
- Sales view → Lead status display: renders (evidence: `src/components/dashboard/SalesView.tsx`)
- Sales view → Agent performance: renders (evidence: `src/components/dashboard/SalesView.tsx`)
- Lead workspace → Lead status display: renders (evidence: `src/components/leads/LeadWorkspaceModal.tsx`)
- Lead workspace → Reservation details: renders (evidence: `src/components/leads/LeadWorkspaceModal.tsx`)
- Lead workspace → Email templates: renders (evidence: `src/components/leads/LeadWorkspaceModal.tsx`)
- Lead workspace → Email editor: uses (evidence: `src/components/leads/LeadWorkspaceModal.tsx`)
- Booking intake → Lead verification: checks sender (evidence: `src/components/leads/LeadIngestionModal.tsx`)
- Internal chat → Chat API: exchanges messages
- Booking intake → Lead API: submits booking
- CRM staff → Lead API: requests lead actions
- Travelocase webhook → CRM state and operations: updates CRM (evidence: `src/app/api/webhooks/travelocase/route.ts`)
- Lead API → CRM state and operations: reads and writes (evidence: `src/app/api/leads/route.ts`)
- Chat API → CRM state and operations: reads and writes (evidence: `src/app/api/chat/route.ts`)
- User API → CRM state and operations: reads and writes (evidence: `src/app/api/users/route.ts`)
- Ticket API → CRM state and operations: reads and writes (evidence: `src/app/api/tickets/route.ts`)
- Charging API → CRM state and operations: reads and writes (evidence: `src/app/api/charging/route.ts`)
- CRM state and operations → Role permissions: checks authorization (evidence: `src/lib/store.ts`)
- CRM state and operations → Domain event bus: broadcasts events (evidence: `src/lib/store.ts`)
- CRM state and operations → Email templates: renders email (evidence: `src/lib/store.ts`)
- CRM state and operations → Lead verification: uses verification (evidence: `src/lib/store.ts`)
- CRM state and operations → Seed and fallback data: loads fallback data (evidence: `src/lib/store.ts`)
- User API → User onboarding: serves onboarding
- CRM state and operations → SMTP delivery: sends email
