# 1-ken/tkt-own architecture

> Architecture diagram of the GitHub repository 1-ken/tkt-own, 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/1-ken/tkt-own
- Repository: https://github.com/1-ken/tkt-own

## Overview

This is a Next.js ticketing and transport-operations application: staff authenticate, manage trips and vehicle assignments, book or reassign seats, record deliveries, and review operational reports. The tree also shows search, online-ticket review, dashboards, and express-booking workflows. Sampled API routes proxy requests to an external backend; the sampled routes and hooks support that boundary, but most page-to-hook wiring was not inspected, so uncertain call edges are omitted.

Main entry points: [`src/app/api/bookings/create/route.ts`](https://github.com/1-ken/tkt-own/blob/main/src/app/api/bookings/create/route.ts) (Booking endpoints), [`src/app/login/page.tsx`](https://github.com/1-ken/tkt-own/blob/main/src/app/login/page.tsx) (Login), [`src/app/api/auth/[...nextauth]/route.ts`](https://github.com/1-ken/tkt-own/blob/main/src/app/api/auth/%5B...nextauth%5D/route.ts) (Session auth), [`src/app/trips/page.tsx`](https://github.com/1-ken/tkt-own/blob/main/src/app/trips/page.tsx) (Trip operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity"]
  node_login["Login<br/>[page.tsx]"]
  node_auth["Session auth<br/>[route.ts]"]
end

subgraph group_operations["Trips &amp; Booking"]
  node_trips["Trip operations<br/>[page.tsx]"]
  node_trip_detail["Trip details<br/>[page.tsx]"]
  node_trip_api["Trip endpoints<br/>[route.ts]"]
  node_vehicle_api["Vehicle assignment<br/>[route.ts]"]
  node_regular["Regular booking<br/>[page.tsx]"]
  node_express["Express booking<br/>[page.tsx]"]
  node_booking_api["Booking endpoints<br/>[route.ts]"]
  node_booking_changes["Booking changes<br/>[route.ts]"]
  node_online["Online tickets<br/>[page.tsx]"]
  node_online_api["Online ticket endpoint<br/>[route.ts]"]
end

subgraph group_finance["Delivery"]
  node_delivery["Delivery recording<br/>[page.tsx]"]
  node_delivery_api["Delivery endpoint<br/>[route.ts]"]
end

subgraph group_insights["Insights"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_stats_api["Statistics endpoint<br/>[route.ts]"]
  node_reports["Reports<br/>[page.tsx]"]
  node_report_api["Report endpoints<br/>[route.ts]"]
  node_search["Global search<br/>[page.tsx]"]
  node_search_api["Search endpoint<br/>[route.ts]"]
end

node_staff(("Staff"))
node_backend["Operations backend"]

node_staff -->|"opens"| node_login
node_login -->|"submits credentials"| node_auth
node_auth -->|"authenticates"| node_backend
node_staff -->|"manages trips"| node_trips
node_trips -->|"requests trip actions"| node_trip_api
node_trip_detail -->|"assigns vehicle"| node_vehicle_api
node_trip_api -->|"forwards trip requests"| node_backend
node_vehicle_api -->|"forwards assignment"| node_backend
node_staff -->|"books seats"| node_regular
node_staff -->|"books express"| node_express
node_regular -->|"submits booking"| node_booking_api
node_express -->|"submits booking"| node_booking_api
node_booking_api -->|"forwards booking"| node_backend
node_staff -->|"changes booking"| node_booking_changes
node_booking_changes -->|"forwards changes"| node_backend
node_staff -->|"reviews reservations"| node_online
node_online -->|"requests tickets"| node_online_api
node_online_api -->|"fetches tickets"| node_backend
node_staff -->|"records delivery"| node_delivery
node_delivery -->|"submits delivery"| node_delivery_api
node_delivery_api -->|"forwards delivery"| node_backend
node_staff -->|"views metrics"| node_dashboard
node_dashboard -->|"requests statistics"| node_stats_api
node_stats_api -->|"fetches statistics"| node_backend
node_staff -->|"reviews reports"| node_reports
node_reports -->|"requests reports"| node_report_api
node_report_api -->|"fetches reports"| node_backend
node_staff -->|"searches records"| node_search
node_search -->|"submits query"| node_search_api
node_search_api -->|"forwards query"| node_backend

click node_login "https://github.com/1-ken/tkt-own/blob/main/src/app/login/page.tsx"
click node_auth "https://github.com/1-ken/tkt-own/blob/main/src/app/api/auth/%5B...nextauth%5D/route.ts"
click node_trips "https://github.com/1-ken/tkt-own/blob/main/src/app/trips/page.tsx"
click node_trip_detail "https://github.com/1-ken/tkt-own/blob/main/src/app/trips/%5BtripId%5D/page.tsx"
click node_trip_api "https://github.com/1-ken/tkt-own/blob/main/src/app/api/trips/create/route.ts"
click node_vehicle_api "https://github.com/1-ken/tkt-own/blob/main/src/app/api/trips/assign-vehicle/route.ts"
click node_regular "https://github.com/1-ken/tkt-own/blob/main/src/app/regular/page.tsx"
click node_express "https://github.com/1-ken/tkt-own/blob/main/src/app/express/page.tsx"
click node_booking_api "https://github.com/1-ken/tkt-own/blob/main/src/app/api/bookings/create/route.ts"
click node_booking_changes "https://github.com/1-ken/tkt-own/blob/main/src/app/api/bookings/cancel/route.ts"
click node_online "https://github.com/1-ken/tkt-own/blob/main/src/app/bookings/online-tickets/page.tsx"
click node_online_api "https://github.com/1-ken/tkt-own/blob/main/src/app/api/bookings/online-tickets/route.ts"
click node_delivery "https://github.com/1-ken/tkt-own/blob/main/src/app/delivery/create/page.tsx"
click node_delivery_api "https://github.com/1-ken/tkt-own/blob/main/src/app/api/delivery/create/route.ts"
click node_dashboard "https://github.com/1-ken/tkt-own/blob/main/src/app/dashboard/page.tsx"
click node_stats_api "https://github.com/1-ken/tkt-own/blob/main/src/app/api/dashboard/statistics/route.ts"
click node_reports "https://github.com/1-ken/tkt-own/blob/main/src/app/reports/page.tsx"
click node_report_api "https://github.com/1-ken/tkt-own/blob/main/src/app/api/reports/tickets/route.ts"
click node_search "https://github.com/1-ken/tkt-own/blob/main/src/app/search/page.tsx"
click node_search_api "https://github.com/1-ken/tkt-own/blob/main/src/app/api/search/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_login,node_auth toneBlue
class node_trips,node_trip_detail,node_trip_api,node_vehicle_api,node_regular,node_express,node_booking_api,node_booking_changes,node_online,node_online_api toneAmber
class node_delivery,node_delivery_api toneMint
class node_dashboard,node_stats_api,node_reports,node_report_api,node_search,node_search_api toneRose
class node_staff,node_backend toneIndigo
```

## Components

### Identity

- [Login](https://github.com/1-ken/tkt-own/blob/main/src/app/login/page.tsx): `src/app/login/page.tsx`
- [Session auth](https://github.com/1-ken/tkt-own/blob/main/src/app/api/auth/%5B...nextauth%5D/route.ts): `src/app/api/auth/[...nextauth]/route.ts`

### Trips & Booking

- [Trip operations](https://github.com/1-ken/tkt-own/blob/main/src/app/trips/page.tsx): `src/app/trips/page.tsx`
- [Trip details](https://github.com/1-ken/tkt-own/blob/main/src/app/trips/%5BtripId%5D/page.tsx): `src/app/trips/[tripId]/page.tsx`
- [Trip endpoints](https://github.com/1-ken/tkt-own/blob/main/src/app/api/trips/create/route.ts): `src/app/api/trips/create/route.ts`
- [Vehicle assignment](https://github.com/1-ken/tkt-own/blob/main/src/app/api/trips/assign-vehicle/route.ts): `src/app/api/trips/assign-vehicle/route.ts`
- [Regular booking](https://github.com/1-ken/tkt-own/blob/main/src/app/regular/page.tsx): `src/app/regular/page.tsx`
- [Express booking](https://github.com/1-ken/tkt-own/blob/main/src/app/express/page.tsx): `src/app/express/page.tsx`
- [Booking endpoints](https://github.com/1-ken/tkt-own/blob/main/src/app/api/bookings/create/route.ts): `src/app/api/bookings/create/route.ts`
- [Booking changes](https://github.com/1-ken/tkt-own/blob/main/src/app/api/bookings/cancel/route.ts): `src/app/api/bookings/cancel/route.ts`
- [Online tickets](https://github.com/1-ken/tkt-own/blob/main/src/app/bookings/online-tickets/page.tsx): `src/app/bookings/online-tickets/page.tsx`
- [Online ticket endpoint](https://github.com/1-ken/tkt-own/blob/main/src/app/api/bookings/online-tickets/route.ts): `src/app/api/bookings/online-tickets/route.ts`

### Delivery

- [Delivery recording](https://github.com/1-ken/tkt-own/blob/main/src/app/delivery/create/page.tsx): `src/app/delivery/create/page.tsx`
- [Delivery endpoint](https://github.com/1-ken/tkt-own/blob/main/src/app/api/delivery/create/route.ts): `src/app/api/delivery/create/route.ts`

### Insights

- [Dashboard](https://github.com/1-ken/tkt-own/blob/main/src/app/dashboard/page.tsx): `src/app/dashboard/page.tsx`
- [Statistics endpoint](https://github.com/1-ken/tkt-own/blob/main/src/app/api/dashboard/statistics/route.ts): `src/app/api/dashboard/statistics/route.ts`
- [Reports](https://github.com/1-ken/tkt-own/blob/main/src/app/reports/page.tsx): `src/app/reports/page.tsx`
- [Report endpoints](https://github.com/1-ken/tkt-own/blob/main/src/app/api/reports/tickets/route.ts): `src/app/api/reports/tickets/route.ts`
- [Global search](https://github.com/1-ken/tkt-own/blob/main/src/app/search/page.tsx): `src/app/search/page.tsx`
- [Search endpoint](https://github.com/1-ken/tkt-own/blob/main/src/app/api/search/route.ts): `src/app/api/search/route.ts`

### Other components

- **Staff**
- **Operations backend**

## Connections

- Staff → Login: opens
- Login → Session auth: submits credentials
- Session auth → Operations backend: authenticates
- Staff → Trip operations: manages trips
- Trip operations → Trip endpoints: requests trip actions
- Trip details → Vehicle assignment: assigns vehicle
- Trip endpoints → Operations backend: forwards trip requests
- Vehicle assignment → Operations backend: forwards assignment
- Staff → Regular booking: books seats
- Staff → Express booking: books express
- Regular booking → Booking endpoints: submits booking
- Express booking → Booking endpoints: submits booking
- Booking endpoints → Operations backend: forwards booking
- Staff → Booking changes: changes booking
- Booking changes → Operations backend: forwards changes
- Staff → Online tickets: reviews reservations
- Online tickets → Online ticket endpoint: requests tickets
- Online ticket endpoint → Operations backend: fetches tickets
- Staff → Delivery recording: records delivery
- Delivery recording → Delivery endpoint: submits delivery
- Delivery endpoint → Operations backend: forwards delivery
- Staff → Dashboard: views metrics
- Dashboard → Statistics endpoint: requests statistics
- Statistics endpoint → Operations backend: fetches statistics
- Staff → Reports: reviews reports
- Reports → Report endpoints: requests reports
- Report endpoints → Operations backend: fetches reports
- Staff → Global search: searches records
- Global search → Search endpoint: submits query
- Search endpoint → Operations backend: forwards query
