# nabhaan10/e-challans architecture

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

- Interactive diagram: https://gitdiagram.com/nabhaan10/e-challans
- Repository: https://github.com/nabhaan10/e-challans

## Overview

India Traffic Hub is a web application for managing the digital traffic-challan lifecycle. The documented workflow is citizen/officer access, rule-based challan issuance with evidence, citizen verification and payment, and appeal review; admin routes expose rule, user, payment, audit, and traffic-intelligence functions. The route tree and README establish these capabilities, but most feature-route implementations were not sampled, so the graph shows supported entry points and documented domains without asserting unverified service calls.

Main entry points: [`src/routes/auth.tsx`](https://github.com/nabhaan10/e-challans/blob/main/src/routes/auth.tsx) (Sign in / register), [`src/routes/index.tsx`](https://github.com/nabhaan10/e-challans/blob/main/src/routes/index.tsx) (Public landing), [`src/routes/_authenticated/route.tsx`](https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/route.tsx) (Session guard), [`src/lib/auth.ts`](https://github.com/nabhaan10/e-challans/blob/main/src/lib/auth.ts) (Role and session)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and shell"]
  node_landing["Public landing<br/>[index.tsx]"]
  node_authpage["Sign in / register<br/>[auth.tsx]"]
  node_authguard["Session guard<br/>[route.tsx]"]
  node_shell["Application shell<br/>[AppShell.tsx]"]
  node_authlogic["Role and session<br/>[auth.ts]"]
end

subgraph group_challans["Challan lifecycle"]
  node_officerissue["Issue challan<br/>[officer.issue.tsx]"]
  node_rules["Traffic rules<br/>[rules.index.tsx]"]
  node_challanslist["Challan management<br/>[challans.index.tsx]"]
  node_challandetail["Challan detail<br/>[challans.$id.tsx]"]
  node_verify["Public verification"]
  node_vehicles["Vehicle records<br/>[vehicles.index.tsx]"]
  node_appeals["Appeals<br/>[appeals.tsx]"]
  node_payments["Payment operations<br/>[admin.payments.tsx]"]
end

subgraph group_operations["Operations and insight"]
  node_adminhome["Admin overview<br/>[admin.index.tsx]"]
  node_adminusers["User administration<br/>[admin.users.tsx]"]
  node_audit["Audit history<br/>[admin.audit.tsx]"]
  node_map["Traffic map<br/>[admin.map.tsx]"]
  node_assistant["Appeal assistant"]
  node_notifications["Notifications<br/>[notifications.tsx]"]
end

subgraph group_platform["Data and identity"]
  node_supabase[("Supabase services<br/>[client.ts]")]
  node_schema["Database schema<br/>[schema.ts]"]
end

node_citizen(("Citizen"))
node_officer(("Officer"))
node_admin(("Administrator"))

node_citizen -->|"opens"| node_landing
node_officer -->|"opens"| node_landing
node_admin -->|"opens"| node_landing
node_landing -->|"links to"| node_authpage
node_landing -->|"navigates to"| node_verify
node_citizen -->|"registers / signs in"| node_authpage
node_officer -->|"signs in"| node_authpage
node_admin -->|"signs in"| node_authpage
node_authpage -->|"authenticates"| node_supabase
node_authpage -->|"loads session"| node_authlogic
node_authguard -->|"checks session"| node_authlogic
node_authguard -->|"redirects unauthenticated"| node_authpage
node_authguard -->|"renders"| node_shell
node_authlogic -->|"reads user and role"| node_supabase
node_officer -->|"issues"| node_officerissue
node_officerissue -->|"uses configured rules"| node_rules
node_citizen -->|"views"| node_challanslist
node_officer -->|"manages"| node_challanslist
node_challanslist -->|"opens"| node_challandetail
node_citizen -->|"checks challan"| node_verify
node_citizen -->|"views"| node_vehicles
node_citizen -->|"submits"| node_appeals
node_officer -->|"reviews"| node_appeals
node_citizen -.->|"pays challan"| node_payments
node_admin -->|"administers"| node_payments
node_admin -->|"views"| node_adminhome
node_admin -->|"manages"| node_adminusers
node_admin -->|"reviews"| node_audit
node_admin -->|"explores traffic"| node_map
node_admin -->|"uses"| node_assistant
node_citizen -->|"views"| node_notifications
node_supabase -.->|"persists application data"| node_schema

click node_landing "https://github.com/nabhaan10/e-challans/blob/main/src/routes/index.tsx"
click node_authpage "https://github.com/nabhaan10/e-challans/blob/main/src/routes/auth.tsx"
click node_authguard "https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/route.tsx"
click node_shell "https://github.com/nabhaan10/e-challans/blob/main/src/components/AppShell.tsx"
click node_authlogic "https://github.com/nabhaan10/e-challans/blob/main/src/lib/auth.ts"
click node_officerissue "https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/officer.issue.tsx"
click node_rules "https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/rules.index.tsx"
click node_challanslist "https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/challans.index.tsx"
click node_challandetail "https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/challans.%24id.tsx"
click node_verify "https://github.com/nabhaan10/e-challans/blob/main/src/routes/verify.%24challanNo.tsx"
click node_vehicles "https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/vehicles.index.tsx"
click node_appeals "https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/appeals.tsx"
click node_payments "https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/admin.payments.tsx"
click node_adminhome "https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/admin.index.tsx"
click node_adminusers "https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/admin.users.tsx"
click node_audit "https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/admin.audit.tsx"
click node_map "https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/admin.map.tsx"
click node_assistant "https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/admin.assistant.tsx"
click node_notifications "https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/notifications.tsx"
click node_supabase "https://github.com/nabhaan10/e-challans/blob/main/src/integrations/supabase/client.ts"
click node_schema "https://github.com/nabhaan10/e-challans/blob/main/drizzle/schema.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_landing,node_authpage,node_authguard,node_shell,node_authlogic toneBlue
class node_officerissue,node_rules,node_challanslist,node_challandetail,node_verify,node_vehicles,node_appeals,node_payments toneAmber
class node_adminhome,node_adminusers,node_audit,node_map,node_assistant,node_notifications toneMint
class node_supabase,node_schema toneRose
class node_citizen,node_officer,node_admin toneIndigo
```

## Components

### Access and shell

- [Public landing](https://github.com/nabhaan10/e-challans/blob/main/src/routes/index.tsx): `src/routes/index.tsx`
- [Sign in / register](https://github.com/nabhaan10/e-challans/blob/main/src/routes/auth.tsx): `src/routes/auth.tsx`
- [Session guard](https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/route.tsx): `src/routes/_authenticated/route.tsx`
- [Application shell](https://github.com/nabhaan10/e-challans/blob/main/src/components/AppShell.tsx): `src/components/AppShell.tsx`
- [Role and session](https://github.com/nabhaan10/e-challans/blob/main/src/lib/auth.ts): `src/lib/auth.ts`

### Challan lifecycle

- [Issue challan](https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/officer.issue.tsx): `src/routes/_authenticated/officer.issue.tsx`
- [Traffic rules](https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/rules.index.tsx): `src/routes/_authenticated/rules.index.tsx`
- [Challan management](https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/challans.index.tsx): `src/routes/_authenticated/challans.index.tsx`
- [Challan detail](https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/challans.%24id.tsx): `src/routes/_authenticated/challans.$id.tsx`
- [Public verification](https://github.com/nabhaan10/e-challans/blob/main/src/routes/verify.%24challanNo.tsx): `src/routes/verify.$challanNo.tsx`
- [Vehicle records](https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/vehicles.index.tsx): `src/routes/_authenticated/vehicles.index.tsx`
- [Appeals](https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/appeals.tsx): `src/routes/_authenticated/appeals.tsx`
- [Payment operations](https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/admin.payments.tsx): `src/routes/_authenticated/admin.payments.tsx`

### Operations and insight

- [Admin overview](https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/admin.index.tsx): `src/routes/_authenticated/admin.index.tsx`
- [User administration](https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/admin.users.tsx): `src/routes/_authenticated/admin.users.tsx`
- [Audit history](https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/admin.audit.tsx): `src/routes/_authenticated/admin.audit.tsx`
- [Traffic map](https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/admin.map.tsx): `src/routes/_authenticated/admin.map.tsx`
- [Appeal assistant](https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/admin.assistant.tsx): `src/routes/_authenticated/admin.assistant.tsx`
- [Notifications](https://github.com/nabhaan10/e-challans/blob/main/src/routes/_authenticated/notifications.tsx): `src/routes/_authenticated/notifications.tsx`

### Data and identity

- [Supabase services](https://github.com/nabhaan10/e-challans/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`
- [Database schema](https://github.com/nabhaan10/e-challans/blob/main/drizzle/schema.ts): `drizzle/schema.ts`

### Other components

- **Citizen**
- **Officer**
- **Administrator**

## Connections

- Citizen → Public landing: opens
- Officer → Public landing: opens
- Administrator → Public landing: opens
- Public landing → Sign in / register: links to
- Public landing → Public verification: navigates to
- Citizen → Sign in / register: registers / signs in
- Officer → Sign in / register: signs in
- Administrator → Sign in / register: signs in
- Sign in / register → Supabase services: authenticates
- Sign in / register → Role and session: loads session
- Session guard → Role and session: checks session
- Session guard → Sign in / register: redirects unauthenticated
- Session guard → Application shell: renders
- Role and session → Supabase services: reads user and role
- Officer → Issue challan: issues
- Issue challan → Traffic rules: uses configured rules
- Citizen → Challan management: views
- Officer → Challan management: manages
- Challan management → Challan detail: opens
- Citizen → Public verification: checks challan
- Citizen → Vehicle records: views
- Citizen → Appeals: submits
- Officer → Appeals: reviews
- Citizen → Payment operations: pays challan
- Administrator → Payment operations: administers
- Administrator → Admin overview: views
- Administrator → User administration: manages
- Administrator → Audit history: reviews
- Administrator → Traffic map: explores traffic
- Administrator → Appeal assistant: uses
- Citizen → Notifications: views
- Supabase services → Database schema: persists application data
