# hrushii1305/deskhive architecture

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

## Overview

DeskHive is a multi-tenant helpdesk: users register or join an organization, then work with tickets and comments under organization and role-based access controls. Ticket creation scopes the ticket to its organization, assigns a least-loaded agent when available, records audit activity, and dispatches email tasks; agents can also claim tickets, while scheduled work escalates stale tickets. The README documents onboarding, REST and web interfaces, notifications, and WebSockets. Some capabilities are documented but their implementation was not sampled, so those links are identified as documented rather than inferred from unseen code.

Main entry points: [`tickets/views.py`](https://github.com/hrushii1305/deskhive/blob/main/tickets/views.py) (Ticket & comment API), [`templates/index.html`](https://github.com/hrushii1305/deskhive/blob/main/templates/index.html) (Web UI & API clients), [`accounts/views.py`](https://github.com/hrushii1305/deskhive/blob/main/accounts/views.py) (Registration & approvals), [`tickets/tasks.py`](https://github.com/hrushii1305/deskhive/blob/main/tickets/tasks.py) (Ticket email tasks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Organizations &amp; Access"]
  node_organization_catalog["Organization catalog<br/>[views.py]"]
  node_onboarding["Registration &amp; approvals<br/>[views.py]"]
  node_member_policy["Member roles &amp; permissions<br/>[models.py]"]
  node_access_guard["Approved-member guard<br/>[permissions.py]"]
  node_organizations[("Organizations<br/>[models.py]")]
  node_members[("Members<br/>[models.py]")]
end

subgraph group_support["Ticket Support"]
  node_ticket_api["Ticket &amp; comment API<br/>[views.py]"]
  node_ticket_serializers["Ticket serializers<br/>[serializers.py]"]
  node_assignment["Agent assignment<br/>[services.py]"]
  node_tickets[("Tickets, comments &amp; audit<br/>[models.py]")]
end

subgraph group_async["Background &amp; Realtime"]
  node_ticket_notifications["Ticket email tasks<br/>[tasks.py]"]
  node_account_notifications["Agent email tasks<br/>[tasks.py]"]
  node_task_scheduler["Celery &amp; escalation schedule<br/>[celery.py]"]
  node_websocket_routing["WebSocket routing<br/>[routing.py]"]
  node_websocket_consumer["Ticket WebSocket consumer<br/>[consumers.py]"]
end

subgraph group_interfaces["User Interfaces"]
  node_web_clients["Web UI &amp; API clients<br/>[index.html]"]
  node_api_docs["OpenAPI / Swagger<br/>[urls.py]"]
end

node_users(("Helpdesk users"))
node_smtp["SMTP email"]

node_users -->|"use"| node_web_clients
node_web_clients -.->|"list organizations"| node_organization_catalog
node_web_clients -.->|"register or request access"| node_onboarding
node_onboarding -->|"create or update"| node_members
node_onboarding -->|"dispatch email"| node_account_notifications
node_account_notifications -->|"read member"| node_members
node_account_notifications -->|"send email"| node_smtp
node_onboarding -->|"apply roles"| node_member_policy
node_ticket_api -->|"require approved member"| node_access_guard
node_ticket_api -->|"query and persist"| node_tickets
node_ticket_api -->|"serialize requests"| node_ticket_serializers
node_ticket_api -->|"select agent"| node_assignment
node_assignment -->|"count active assignments"| node_members
node_ticket_api -->|"dispatch email tasks"| node_ticket_notifications
node_ticket_notifications -->|"read ticket"| node_tickets
node_ticket_notifications -->|"send email"| node_smtp
node_task_scheduler -->|"schedule escalation"| node_ticket_notifications
node_web_clients -.->|"manage tickets"| node_ticket_api
node_websocket_routing -->|"route connections"| node_websocket_consumer
node_ticket_api -->|"broadcast comments"| node_websocket_consumer
node_users -.->|"connect for updates"| node_websocket_routing
node_web_clients -.->|"inspect API"| node_api_docs

click node_organization_catalog "https://github.com/hrushii1305/deskhive/blob/main/organizations/views.py"
click node_onboarding "https://github.com/hrushii1305/deskhive/blob/main/accounts/views.py"
click node_member_policy "https://github.com/hrushii1305/deskhive/blob/main/accounts/models.py"
click node_access_guard "https://github.com/hrushii1305/deskhive/blob/main/accounts/permissions.py"
click node_organizations "https://github.com/hrushii1305/deskhive/blob/main/organizations/models.py"
click node_members "https://github.com/hrushii1305/deskhive/blob/main/accounts/models.py"
click node_ticket_api "https://github.com/hrushii1305/deskhive/blob/main/tickets/views.py"
click node_ticket_serializers "https://github.com/hrushii1305/deskhive/blob/main/tickets/serializers.py"
click node_assignment "https://github.com/hrushii1305/deskhive/blob/main/tickets/services.py"
click node_tickets "https://github.com/hrushii1305/deskhive/blob/main/tickets/models.py"
click node_ticket_notifications "https://github.com/hrushii1305/deskhive/blob/main/tickets/tasks.py"
click node_account_notifications "https://github.com/hrushii1305/deskhive/blob/main/accounts/tasks.py"
click node_task_scheduler "https://github.com/hrushii1305/deskhive/blob/main/deskhive/celery.py"
click node_websocket_routing "https://github.com/hrushii1305/deskhive/blob/main/tickets/routing.py"
click node_websocket_consumer "https://github.com/hrushii1305/deskhive/blob/main/tickets/consumers.py"
click node_web_clients "https://github.com/hrushii1305/deskhive/blob/main/templates/index.html"
click node_api_docs "https://github.com/hrushii1305/deskhive/blob/main/deskhive/urls.py"

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_organization_catalog,node_onboarding,node_member_policy,node_access_guard,node_organizations,node_members,node_users toneBlue
class node_ticket_api,node_ticket_serializers,node_assignment,node_tickets toneAmber
class node_ticket_notifications,node_account_notifications,node_task_scheduler,node_websocket_routing,node_websocket_consumer toneMint
class node_web_clients,node_api_docs toneRose
class node_smtp toneIndigo
```

## Components

### Organizations & Access

- [Organization catalog](https://github.com/hrushii1305/deskhive/blob/main/organizations/views.py): `organizations/views.py`
- [Registration & approvals](https://github.com/hrushii1305/deskhive/blob/main/accounts/views.py): `accounts/views.py`
- [Member roles & permissions](https://github.com/hrushii1305/deskhive/blob/main/accounts/models.py): `accounts/models.py`
- [Approved-member guard](https://github.com/hrushii1305/deskhive/blob/main/accounts/permissions.py): `accounts/permissions.py`
- [Organizations](https://github.com/hrushii1305/deskhive/blob/main/organizations/models.py): `organizations/models.py`
- [Members](https://github.com/hrushii1305/deskhive/blob/main/accounts/models.py): `accounts/models.py`

### Ticket Support

- [Ticket & comment API](https://github.com/hrushii1305/deskhive/blob/main/tickets/views.py): `tickets/views.py`
- [Ticket serializers](https://github.com/hrushii1305/deskhive/blob/main/tickets/serializers.py): `tickets/serializers.py`
- [Agent assignment](https://github.com/hrushii1305/deskhive/blob/main/tickets/services.py): `tickets/services.py`
- [Tickets, comments & audit](https://github.com/hrushii1305/deskhive/blob/main/tickets/models.py): `tickets/models.py`

### Background & Realtime

- [Ticket email tasks](https://github.com/hrushii1305/deskhive/blob/main/tickets/tasks.py): `tickets/tasks.py`
- [Agent email tasks](https://github.com/hrushii1305/deskhive/blob/main/accounts/tasks.py): `accounts/tasks.py`
- [Celery & escalation schedule](https://github.com/hrushii1305/deskhive/blob/main/deskhive/celery.py): `deskhive/celery.py`
- [WebSocket routing](https://github.com/hrushii1305/deskhive/blob/main/tickets/routing.py): `tickets/routing.py`
- [Ticket WebSocket consumer](https://github.com/hrushii1305/deskhive/blob/main/tickets/consumers.py): `tickets/consumers.py`

### User Interfaces

- [Web UI & API clients](https://github.com/hrushii1305/deskhive/blob/main/templates/index.html): `templates/index.html`
- [OpenAPI / Swagger](https://github.com/hrushii1305/deskhive/blob/main/deskhive/urls.py): `deskhive/urls.py`

### Other components

- **Helpdesk users**
- **SMTP email**

## Connections

- Helpdesk users → Web UI & API clients: use (evidence: `README.md`)
- Web UI & API clients → Organization catalog: list organizations (evidence: `README.md`)
- Web UI & API clients → Registration & approvals: register or request access (evidence: `README.md`)
- Registration & approvals → Members: create or update (evidence: `accounts/views.py`)
- Registration & approvals → Agent email tasks: dispatch email (evidence: `accounts/views.py`)
- Agent email tasks → Members: read member (evidence: `accounts/tasks.py`)
- Agent email tasks → SMTP email: send email (evidence: `accounts/tasks.py`)
- Registration & approvals → Member roles & permissions: apply roles (evidence: `accounts/views.py`)
- Ticket & comment API → Approved-member guard: require approved member (evidence: `tickets/views.py`)
- Ticket & comment API → Tickets, comments & audit: query and persist (evidence: `tickets/views.py`)
- Ticket & comment API → Ticket serializers: serialize requests (evidence: `tickets/views.py`)
- Ticket & comment API → Agent assignment: select agent (evidence: `tickets/views.py`)
- Agent assignment → Members: count active assignments (evidence: `tickets/services.py`)
- Ticket & comment API → Ticket email tasks: dispatch email tasks (evidence: `tickets/views.py`)
- Ticket email tasks → Tickets, comments & audit: read ticket (evidence: `tickets/tasks.py`)
- Ticket email tasks → SMTP email: send email (evidence: `tickets/tasks.py`)
- Celery & escalation schedule → Ticket email tasks: schedule escalation (evidence: `deskhive/celery.py`)
- Web UI & API clients → Ticket & comment API: manage tickets (evidence: `README.md`)
- WebSocket routing → Ticket WebSocket consumer: route connections (evidence: `tickets/routing.py`)
- Ticket & comment API → Ticket WebSocket consumer: broadcast comments (evidence: `tickets/views.py`)
- Helpdesk users → WebSocket routing: connect for updates (evidence: `README.md`)
- Web UI & API clients → OpenAPI / Swagger: inspect API (evidence: `README.md`)
