# suganthsugi/replyx architecture

> Architecture diagram of the GitHub repository suganthsugi/replyx, 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/suganthsugi/replyx
- Repository: https://github.com/suganthsugi/replyx

## Overview

This repository appears to implement a multi-tenant support desk: customers start conversations, staff triage and resolve tickets, and administrators manage workspace access and settings; platform operators manage tenants and support access. The API request pipeline explicitly resolves tenants, authenticates callers, and checks permissions. The source index and excerpts support several internal API dependencies, but do not establish most web-to-API wiring, so those links are omitted. The README is a generic Next.js template and does not document product capabilities.

Main entry points: [`apps/api/src/api-pipeline.module.ts`](https://github.com/suganthsugi/replyx/blob/main/apps/api/src/api-pipeline.module.ts) (HTTP request pipeline), [`apps/api/src/tickets`](https://github.com/suganthsugi/replyx/tree/main/apps/api/src/tickets) (Ticket queries and workflow), [`apps/web/src/pages`](https://github.com/suganthsugi/replyx/tree/main/apps/web/src/pages) (Customer and desk UI), [`apps/api/src/platform-kernel/db/unit-of-work.ts`](https://github.com/suganthsugi/replyx/blob/main/apps/api/src/platform-kernel/db/unit-of-work.ts) (Tenant transaction boundary)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_webapp["Customer and desk UI"]
  node_adminui["Workspace admin UI"]
  node_consoleui["Operator console UI"]
end

subgraph group_domain["Support domains"]
  node_tickets["Ticket queries and workflow"]
  node_messages["Conversation messaging"]
  node_attachments["Attachment handling"]
  node_views["Views and ticket filters"]
  node_tags["Ticket tags<br/>[tags.service.ts]"]
  node_customeradmin["Customer and group management"]
  node_notify["Notifications and audit"]
end

subgraph group_tenancy["Identity and tenancy"]
  node_identity["Authentication and sessions"]
  node_access["Permissions and roles"]
  node_tenantadmin["Tenant administration"]
end

subgraph group_kernel["API foundation"]
  node_pipeline["HTTP request pipeline"]
  node_transaction["Tenant transaction boundary<br/>[unit-of-work.ts]"]
  node_tenantcontext["Tenant request context<br/>[request-context.ts]"]
  node_database[("PostgreSQL access<br/>[database.ts]")]
  node_realtime["Realtime and presence"]
  node_jobs["Background jobs and outbox"]
end

node_customer(("Customer"))
node_staff(("Staff user"))
node_operator(("Platform operator"))

node_customer -.->|"uses"| node_webapp
node_staff -.->|"uses"| node_webapp
node_operator -.->|"uses"| node_consoleui
node_webapp -.->|"calls API"| node_pipeline
node_adminui -.->|"calls API"| node_pipeline
node_consoleui -.->|"calls API"| node_pipeline
node_pipeline -->|"registers guards"| node_identity
node_pipeline -->|"registers modules"| node_tenantadmin
node_pipeline -->|"registers guard"| node_access
node_tenantcontext -->|"creates context"| node_transaction
node_transaction -->|"opens transactions"| node_database
node_tickets -->|"runs tenant reads"| node_transaction
node_tickets -->|"checks ticket access"| node_access
node_tickets -->|"loads view filters"| node_views
node_tickets -->|"loads ticket tags"| node_tags
node_tickets -->|"queries ticket history"| node_database
node_identity -->|"enqueues sign-in mail"| node_notify

click node_webapp "https://github.com/suganthsugi/replyx/tree/main/apps/web/src/pages"
click node_adminui "https://github.com/suganthsugi/replyx/tree/main/apps/web/src/pages/admin"
click node_consoleui "https://github.com/suganthsugi/replyx/tree/main/apps/web/src/pages/console"
click node_pipeline "https://github.com/suganthsugi/replyx/blob/main/apps/api/src/api-pipeline.module.ts"
click node_identity "https://github.com/suganthsugi/replyx/tree/main/apps/api/src/identity"
click node_tickets "https://github.com/suganthsugi/replyx/tree/main/apps/api/src/tickets"
click node_messages "https://github.com/suganthsugi/replyx/tree/main/apps/api/src/messaging"
click node_attachments "https://github.com/suganthsugi/replyx/tree/main/apps/api/src/attachments"
click node_views "https://github.com/suganthsugi/replyx/tree/main/apps/api/src/views"
click node_tags "https://github.com/suganthsugi/replyx/blob/main/apps/api/src/tags/tags.service.ts"
click node_access "https://github.com/suganthsugi/replyx/tree/main/apps/api/src/authorization"
click node_tenantadmin "https://github.com/suganthsugi/replyx/tree/main/apps/api/src/tenancy"
click node_customeradmin "https://github.com/suganthsugi/replyx/tree/main/apps/api/src/customers"
click node_notify "https://github.com/suganthsugi/replyx/tree/main/apps/api/src/notifications"
click node_transaction "https://github.com/suganthsugi/replyx/blob/main/apps/api/src/platform-kernel/db/unit-of-work.ts"
click node_tenantcontext "https://github.com/suganthsugi/replyx/blob/main/apps/api/src/platform-kernel/http/request-context.ts"
click node_database "https://github.com/suganthsugi/replyx/blob/main/apps/api/src/platform-kernel/db/database.ts"
click node_realtime "https://github.com/suganthsugi/replyx/tree/main/apps/api/src/platform-kernel/realtime"
click node_jobs "https://github.com/suganthsugi/replyx/tree/main/apps/api/src/platform-kernel/jobs"

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_webapp,node_adminui,node_consoleui,node_staff toneBlue
class node_tickets,node_messages,node_attachments,node_views,node_tags,node_customeradmin,node_notify toneAmber
class node_identity,node_access,node_tenantadmin toneMint
class node_pipeline,node_transaction,node_tenantcontext,node_database,node_realtime,node_jobs toneRose
class node_customer,node_operator toneIndigo
```

## Components

### Web experience

- [Customer and desk UI](https://github.com/suganthsugi/replyx/tree/main/apps/web/src/pages): `apps/web/src/pages`
- [Workspace admin UI](https://github.com/suganthsugi/replyx/tree/main/apps/web/src/pages/admin): `apps/web/src/pages/admin`
- [Operator console UI](https://github.com/suganthsugi/replyx/tree/main/apps/web/src/pages/console): `apps/web/src/pages/console`

### Support domains

- [Ticket queries and workflow](https://github.com/suganthsugi/replyx/tree/main/apps/api/src/tickets): `apps/api/src/tickets`
- [Conversation messaging](https://github.com/suganthsugi/replyx/tree/main/apps/api/src/messaging): `apps/api/src/messaging`
- [Attachment handling](https://github.com/suganthsugi/replyx/tree/main/apps/api/src/attachments): `apps/api/src/attachments`
- [Views and ticket filters](https://github.com/suganthsugi/replyx/tree/main/apps/api/src/views): `apps/api/src/views`
- [Ticket tags](https://github.com/suganthsugi/replyx/blob/main/apps/api/src/tags/tags.service.ts): `apps/api/src/tags/tags.service.ts`
- [Customer and group management](https://github.com/suganthsugi/replyx/tree/main/apps/api/src/customers): `apps/api/src/customers`
- [Notifications and audit](https://github.com/suganthsugi/replyx/tree/main/apps/api/src/notifications): `apps/api/src/notifications`

### Identity and tenancy

- [Authentication and sessions](https://github.com/suganthsugi/replyx/tree/main/apps/api/src/identity): `apps/api/src/identity`
- [Permissions and roles](https://github.com/suganthsugi/replyx/tree/main/apps/api/src/authorization): `apps/api/src/authorization`
- [Tenant administration](https://github.com/suganthsugi/replyx/tree/main/apps/api/src/tenancy): `apps/api/src/tenancy`

### API foundation

- [HTTP request pipeline](https://github.com/suganthsugi/replyx/blob/main/apps/api/src/api-pipeline.module.ts): `apps/api/src/api-pipeline.module.ts`
- [Tenant transaction boundary](https://github.com/suganthsugi/replyx/blob/main/apps/api/src/platform-kernel/db/unit-of-work.ts): `apps/api/src/platform-kernel/db/unit-of-work.ts`
- [Tenant request context](https://github.com/suganthsugi/replyx/blob/main/apps/api/src/platform-kernel/http/request-context.ts): `apps/api/src/platform-kernel/http/request-context.ts`
- [PostgreSQL access](https://github.com/suganthsugi/replyx/blob/main/apps/api/src/platform-kernel/db/database.ts): `apps/api/src/platform-kernel/db/database.ts`
- [Realtime and presence](https://github.com/suganthsugi/replyx/tree/main/apps/api/src/platform-kernel/realtime): `apps/api/src/platform-kernel/realtime`
- [Background jobs and outbox](https://github.com/suganthsugi/replyx/tree/main/apps/api/src/platform-kernel/jobs): `apps/api/src/platform-kernel/jobs`

### Other components

- **Customer**
- **Staff user**
- **Platform operator**

## Connections

- Customer → Customer and desk UI: uses
- Staff user → Customer and desk UI: uses
- Platform operator → Operator console UI: uses
- Customer and desk UI → HTTP request pipeline: calls API
- Workspace admin UI → HTTP request pipeline: calls API
- Operator console UI → HTTP request pipeline: calls API
- HTTP request pipeline → Authentication and sessions: registers guards (evidence: `apps/api/src/api-pipeline.module.ts`)
- HTTP request pipeline → Tenant administration: registers modules (evidence: `apps/api/src/api-pipeline.module.ts`)
- HTTP request pipeline → Permissions and roles: registers guard (evidence: `apps/api/src/api-pipeline.module.ts`)
- Tenant request context → Tenant transaction boundary: creates context (evidence: `apps/api/src/platform-kernel/http/request-context.ts`)
- Tenant transaction boundary → PostgreSQL access: opens transactions (evidence: `apps/api/src/platform-kernel/db/database.ts`)
- Ticket queries and workflow → Tenant transaction boundary: runs tenant reads (evidence: `apps/api/src/tickets/ticket-query.service.ts`)
- Ticket queries and workflow → Permissions and roles: checks ticket access (evidence: `apps/api/src/tickets/ticket-query.service.ts`)
- Ticket queries and workflow → Views and ticket filters: loads view filters (evidence: `apps/api/src/tickets/ticket-query.service.ts`)
- Ticket queries and workflow → Ticket tags: loads ticket tags (evidence: `apps/api/src/tickets/ticket-query.service.ts`)
- Ticket queries and workflow → PostgreSQL access: queries ticket history (evidence: `apps/api/src/tickets/ticket-history-query.service.ts`)
- Authentication and sessions → Notifications and audit: enqueues sign-in mail (evidence: `apps/api/src/identity/customer-auth.service.ts`)
