# vargas0fficial/szk-system architecture

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

## Overview

This is a multi-branch Suzuki appointment-management application, with an admin panel for managing appointments and a branch-specific display for viewing them. The main workflow is branch selection, admin sign-in, and branch-scoped appointment management; a live event stream exposes appointment updates, while staff and branch-status endpoints support the UI. The graph also preserves authentication, scheduled reset, and persistence components. Several page and route implementations were not excerpted, so relationships without source or documented evidence are omitted; the README provides no product-specific capability details.

Main entry points: [`src/db.js`](https://github.com/vargas0fficial/szk-system/blob/main/src/db.js) (Database connections), [`src/branches.js`](https://github.com/vargas0fficial/szk-system/blob/main/src/branches.js) (Branch configuration), [`src/app/api/appointments/stream/route.js`](https://github.com/vargas0fficial/szk-system/blob/main/src/app/api/appointments/stream/route.js) (Appointment API / stream), [`src/models/BranchStatus.js`](https://github.com/vargas0fficial/szk-system/blob/main/src/models/BranchStatus.js) (Branch status model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User interfaces"]
  node_branch_list["Branch list<br/>[page.js]"]
  node_branch_display["Branch display<br/>[page.js]"]
  node_admin_ui["Admin panel<br/>[page.js]"]
  node_login_ui["Login screen<br/>[page.js]"]
  node_appointment_form["Appointment form"]
  node_appointment_table["Appointment table"]
  node_access_screen["Access unavailable"]
end

subgraph group_api["Application routes"]
  node_appointment_stream["Appointment API / stream<br/>[route.js]"]
  node_login_route["Login route<br/>[route.js]"]
  node_session_route["Session route<br/>[route.js]"]
  node_logout_route["Logout route<br/>[route.js]"]
  node_password_route["Password route<br/>[route.js]"]
  node_staff_route["Staff route<br/>[route.js]"]
  node_status_route["Branch status route<br/>[route.js]"]
  node_reset_route["Scheduled reset<br/>[route.js]"]
end

subgraph group_domain["Branch and domain"]
  node_branch_config["Branch configuration<br/>[branches.js]"]
  node_appointment_schema["Appointment model<br/>[Appointment.js]"]
  node_admin_model["Admin model<br/>[Admin.js]"]
  node_staff_model["Staff model<br/>[Staff.js]"]
  node_branch_status_model["Branch status model<br/>[BranchStatus.js]"]
end

subgraph group_persistence["Persistence"]
  node_db_access["Database connections<br/>[db.js]"]
end

node_visitor(("Visitor / staff"))
node_mongodb[("MongoDB")]

node_visitor -->|"opens"| node_branch_list
node_branch_list -->|"lists branches"| node_branch_config
node_branch_display -->|"resolves branch"| node_branch_config
node_branch_display -->|"renders"| node_access_screen
node_admin_ui -->|"renders"| node_appointment_form
node_admin_ui -->|"renders"| node_appointment_table
node_admin_ui -->|"renders"| node_access_screen
node_login_route -->|"connects"| node_db_access
node_login_route -->|"looks up admin"| node_admin_model
node_login_route -->|"checks activation"| node_branch_status_model
node_session_route -->|"connects"| node_db_access
node_session_route -->|"checks activation"| node_branch_status_model
node_session_route -->|"resolves label"| node_branch_config
node_staff_route -->|"connects"| node_db_access
node_staff_route -->|"queries staff"| node_staff_model
node_appointment_table -->|"fetches staff"| node_staff_route
node_status_route -->|"connects"| node_db_access
node_status_route -->|"reads status"| node_branch_status_model
node_status_route -->|"validates branch"| node_branch_config
node_appointment_stream -->|"connects"| node_db_access
node_appointment_stream -->|"reads and mutates"| node_appointment_schema
node_appointment_stream -->|"checks activation"| node_branch_status_model
node_appointment_stream -->|"resolves branch"| node_branch_config
node_reset_route -->|"connects"| node_db_access
node_reset_route -->|"deletes appointments"| node_appointment_schema
node_reset_route -->|"iterates branches"| node_branch_config
node_db_access -->|"queries"| node_mongodb

click node_branch_list "https://github.com/vargas0fficial/szk-system/blob/main/src/app/page.js"
click node_branch_display "https://github.com/vargas0fficial/szk-system/blob/main/src/app/%5Bbranch%5D/page.js"
click node_admin_ui "https://github.com/vargas0fficial/szk-system/blob/main/src/app/admin/page.js"
click node_login_ui "https://github.com/vargas0fficial/szk-system/blob/main/src/app/login/page.js"
click node_appointment_form "https://github.com/vargas0fficial/szk-system/blob/main/src/components/AppointmentForm.jsx"
click node_appointment_table "https://github.com/vargas0fficial/szk-system/blob/main/src/components/AppointmentTable.jsx"
click node_access_screen "https://github.com/vargas0fficial/szk-system/blob/main/src/components/NotYetAccessible.js"
click node_appointment_stream "https://github.com/vargas0fficial/szk-system/blob/main/src/app/api/appointments/stream/route.js"
click node_login_route "https://github.com/vargas0fficial/szk-system/blob/main/src/app/api/auth/login/route.js"
click node_session_route "https://github.com/vargas0fficial/szk-system/blob/main/src/app/api/auth/me/route.js"
click node_logout_route "https://github.com/vargas0fficial/szk-system/blob/main/src/app/api/auth/logout/route.js"
click node_password_route "https://github.com/vargas0fficial/szk-system/blob/main/src/app/api/auth/change-password/route.js"
click node_staff_route "https://github.com/vargas0fficial/szk-system/blob/main/src/app/api/staff/route.js"
click node_status_route "https://github.com/vargas0fficial/szk-system/blob/main/src/app/api/branches/status/route.js"
click node_reset_route "https://github.com/vargas0fficial/szk-system/blob/main/src/app/api/cron/reset/route.js"
click node_branch_config "https://github.com/vargas0fficial/szk-system/blob/main/src/branches.js"
click node_appointment_schema "https://github.com/vargas0fficial/szk-system/blob/main/src/models/Appointment.js"
click node_admin_model "https://github.com/vargas0fficial/szk-system/blob/main/src/models/Admin.js"
click node_staff_model "https://github.com/vargas0fficial/szk-system/blob/main/src/models/Staff.js"
click node_branch_status_model "https://github.com/vargas0fficial/szk-system/blob/main/src/models/BranchStatus.js"
click node_db_access "https://github.com/vargas0fficial/szk-system/blob/main/src/db.js"

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_branch_list,node_branch_display,node_admin_ui,node_login_ui,node_appointment_form,node_appointment_table,node_access_screen toneBlue
class node_appointment_stream,node_login_route,node_session_route,node_logout_route,node_password_route,node_staff_route,node_status_route,node_reset_route,node_mongodb toneAmber
class node_branch_config,node_appointment_schema,node_admin_model,node_staff_model,node_branch_status_model toneMint
class node_db_access toneRose
class node_visitor toneIndigo
```

## Components

### User interfaces

- [Branch list](https://github.com/vargas0fficial/szk-system/blob/main/src/app/page.js): `src/app/page.js`
- [Branch display](https://github.com/vargas0fficial/szk-system/blob/main/src/app/%5Bbranch%5D/page.js): `src/app/[branch]/page.js`
- [Admin panel](https://github.com/vargas0fficial/szk-system/blob/main/src/app/admin/page.js): `src/app/admin/page.js`
- [Login screen](https://github.com/vargas0fficial/szk-system/blob/main/src/app/login/page.js): `src/app/login/page.js`
- [Appointment form](https://github.com/vargas0fficial/szk-system/blob/main/src/components/AppointmentForm.jsx): `src/components/AppointmentForm.jsx`
- [Appointment table](https://github.com/vargas0fficial/szk-system/blob/main/src/components/AppointmentTable.jsx): `src/components/AppointmentTable.jsx`
- [Access unavailable](https://github.com/vargas0fficial/szk-system/blob/main/src/components/NotYetAccessible.js): `src/components/NotYetAccessible.js`

### Application routes

- [Appointment API / stream](https://github.com/vargas0fficial/szk-system/blob/main/src/app/api/appointments/stream/route.js): `src/app/api/appointments/stream/route.js`
- [Login route](https://github.com/vargas0fficial/szk-system/blob/main/src/app/api/auth/login/route.js): `src/app/api/auth/login/route.js`
- [Session route](https://github.com/vargas0fficial/szk-system/blob/main/src/app/api/auth/me/route.js): `src/app/api/auth/me/route.js`
- [Logout route](https://github.com/vargas0fficial/szk-system/blob/main/src/app/api/auth/logout/route.js): `src/app/api/auth/logout/route.js`
- [Password route](https://github.com/vargas0fficial/szk-system/blob/main/src/app/api/auth/change-password/route.js): `src/app/api/auth/change-password/route.js`
- [Staff route](https://github.com/vargas0fficial/szk-system/blob/main/src/app/api/staff/route.js): `src/app/api/staff/route.js`
- [Branch status route](https://github.com/vargas0fficial/szk-system/blob/main/src/app/api/branches/status/route.js): `src/app/api/branches/status/route.js`
- [Scheduled reset](https://github.com/vargas0fficial/szk-system/blob/main/src/app/api/cron/reset/route.js): `src/app/api/cron/reset/route.js`

### Branch and domain

- [Branch configuration](https://github.com/vargas0fficial/szk-system/blob/main/src/branches.js): `src/branches.js`
- [Appointment model](https://github.com/vargas0fficial/szk-system/blob/main/src/models/Appointment.js): `src/models/Appointment.js`
- [Admin model](https://github.com/vargas0fficial/szk-system/blob/main/src/models/Admin.js): `src/models/Admin.js`
- [Staff model](https://github.com/vargas0fficial/szk-system/blob/main/src/models/Staff.js): `src/models/Staff.js`
- [Branch status model](https://github.com/vargas0fficial/szk-system/blob/main/src/models/BranchStatus.js): `src/models/BranchStatus.js`

### Persistence

- [Database connections](https://github.com/vargas0fficial/szk-system/blob/main/src/db.js): `src/db.js`

### Other components

- **Visitor / staff**
- **MongoDB**

## Connections

- Visitor / staff → Branch list: opens
- Branch list → Branch configuration: lists branches (evidence: `src/app/page.js`)
- Branch display → Branch configuration: resolves branch (evidence: `src/app/[branch]/page.js`)
- Branch display → Access unavailable: renders (evidence: `src/app/[branch]/page.js`)
- Admin panel → Appointment form: renders (evidence: `src/app/admin/page.js`)
- Admin panel → Appointment table: renders (evidence: `src/app/admin/page.js`)
- Admin panel → Access unavailable: renders (evidence: `src/app/admin/page.js`)
- Login route → Database connections: connects (evidence: `src/app/api/auth/login/route.js`)
- Login route → Admin model: looks up admin (evidence: `src/app/api/auth/login/route.js`)
- Login route → Branch status model: checks activation (evidence: `src/app/api/auth/login/route.js`)
- Session route → Database connections: connects (evidence: `src/app/api/auth/me/route.js`)
- Session route → Branch status model: checks activation (evidence: `src/app/api/auth/me/route.js`)
- Session route → Branch configuration: resolves label (evidence: `src/app/api/auth/me/route.js`)
- Staff route → Database connections: connects (evidence: `src/app/api/staff/route.js`)
- Staff route → Staff model: queries staff (evidence: `src/app/api/staff/route.js`)
- Appointment table → Staff route: fetches staff (evidence: `src/components/AppointmentTable.jsx`)
- Branch status route → Database connections: connects (evidence: `src/app/api/branches/status/route.js`)
- Branch status route → Branch status model: reads status (evidence: `src/app/api/branches/status/route.js`)
- Branch status route → Branch configuration: validates branch (evidence: `src/app/api/branches/status/route.js`)
- Appointment API / stream → Database connections: connects (evidence: `src/app/api/appointments/stream/route.js`)
- Appointment API / stream → Appointment model: reads and mutates (evidence: `src/app/api/appointments/stream/route.js`)
- Appointment API / stream → Branch status model: checks activation (evidence: `src/app/api/appointments/stream/route.js`)
- Appointment API / stream → Branch configuration: resolves branch (evidence: `src/app/api/appointments/stream/route.js`)
- Scheduled reset → Database connections: connects (evidence: `src/app/api/cron/reset/route.js`)
- Scheduled reset → Appointment model: deletes appointments (evidence: `src/app/api/cron/reset/route.js`)
- Scheduled reset → Branch configuration: iterates branches (evidence: `src/app/api/cron/reset/route.js`)
- Database connections → MongoDB: queries (evidence: `src/db.js`)
