Appearance
Architecture
System shape
text
End user / Agent browser
-> apps/web (React + Vite)
-> apps/api (Hono)
-> Supabase (Postgres, Auth, Realtime)
-> external classifier service (FastAPI)Monorepo packages
| Path | Package | Responsibility |
|---|---|---|
apps/web | @arabic-itsm/web | User portal, queue UI, stats UI, admin screens |
apps/api | @arabic-itsm/api | Auth-aware REST API and ticket orchestration |
packages/shared | @arabic-itsm/shared | Shared routing thresholds and core types |
packages/docs | @arabic-itsm/docs | VitePress technical documentation |
supabase/migrations | n/a | Database schema, policies, and seed structure |
Request lifecycle
Ticket submission
- Web sends
title_aranddescription_artoPOST /api/v1/tickets. - API validates Arabic-only content.
- API calls the classifier service.
- API computes a routing decision from the returned confidences.
- Ticket is inserted into
tickets. - Assignment and notifications are triggered.
- Web reloads queue or detail data from the API.
Routing decision model
Shared thresholds come from @arabic-itsm/shared:
AUTO = 0.85REVIEW = 0.60
The API computes the minimum confidence across l1, l2, and optional l3.
| Condition | Result |
|---|---|
all available levels >= 0.85 | routing_mode = auto, status = open |
l1 >= 0.60 but not auto | routing_mode = review, status = pending_review |
| otherwise | routing_mode = manual, status = new |
Department and assignment flow
- Department lookup is based on
departments.l1_labels. autotickets are assigned to the least-loaded agent in the matched department.reviewtickets are routed to Service Desk if available, otherwise to the matched department without direct assignment.manualtickets skip assignment and notify admins for triage.
Auth model
- API auth middleware reads a Supabase bearer token.
- It resolves the user with the Supabase admin client.
- Role and
department_idare pulled fromapp_metadata. - If auth data is missing, the request proceeds as anonymous context.
Realtime model
The platform uses Supabase Realtime rather than custom websocket infrastructure.
- notification UI subscribes to user-specific notification changes
- queue views subscribe to ticket changes relevant to the current department
This keeps the API stateless while still giving agents live updates.
Failure handling
If the classifier is unavailable or returns an upstream error:
- ticket creation still succeeds
classificationis stored asnull- routing falls back to
manual - admins are notified for manual triage
That fallback is central to keeping the helpdesk usable when the ML service is down.