# bigpumpum001/toothtoday architecture

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

- Interactive diagram: https://gitdiagram.com/bigpumpum001/toothtoday
- Repository: https://github.com/bigpumpum001/toothtoday

## Overview

ToothToday is a dental appointment platform: patients browse services, register or sign in, book and manage appointments, and check daily queues; clinic staff manage appointments, doctors, and services. The repository pairs a Next.js interface with a Go API, PostgreSQL persistence, scheduled appointment jobs, and LINE notifications. The README documents these capabilities, but most backend implementations were not excerpted, so internal backend links are dashed where their exact calls could not be verified.

Main entry points: [`backend/cmd/api/main.go`](https://github.com/bigpumpum001/toothtoday/blob/main/backend/cmd/api/main.go) (ToothToday API), [`backend/internal/db/postgres.go`](https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/db/postgres.go) (PostgreSQL), [`backend/internal/handlers/appointment_handler.go`](https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/handlers/appointment_handler.go) (Appointment handlers), [`backend/internal/services/appointment_job.go`](https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/services/appointment_job.go) (Appointment jobs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Patient Web"]
  node_home["Home and discovery<br/>[page.tsx]"]
  node_services["Service listings<br/>[Allservices.tsx]"]
  node_booking["Booking form<br/>[BookingForm.tsx]"]
  node_queueview["Daily queue view<br/>[DoctorSchedule.tsx]"]
  node_account["Account and profile<br/>[Profile.tsx]"]
  node_admin["Admin dashboard<br/>[page.tsx]"]
end

subgraph group_api["API Workflows"]
  node_authhandler["Authentication handlers<br/>[auth_handler.go]"]
  node_appointmenthandler["Appointment handlers"]
  node_appointmentlogic["Booking and slot logic"]
  node_accountlogic["Account services<br/>[user_service.go]"]
  node_cataloglogic["Service management<br/>[service_service.go]"]
  node_doctorlogic["Doctor management<br/>[doctor_service.go]"]
  node_api["ToothToday API<br/>[main.go]"]
end

subgraph group_data["Persistence"]
  node_database[("PostgreSQL<br/>[postgres.go]")]
  node_appointmentrepo["Appointment repository"]
  node_userrepo["User repository<br/>[user_repository.go]"]
  node_servicerepo["Service repository"]
  node_doctorrepo["Doctor repository"]
end

subgraph group_ops["Clinic Operations"]
  node_joblogic["Appointment jobs<br/>[appointment_job.go]"]
  node_scheduler["Job scheduler<br/>[scheduler.go]"]
  node_line["LINE notifications<br/>[line_service.go]"]
  node_lineclient["LINE client<br/>[line_service.go]"]
  node_storage["Image storage client<br/>[gcs_client.go]"]
end

node_patient(("Patient"))
node_staff(("Clinic staff"))

node_patient -->|"browses"| node_home
node_patient -->|"views services"| node_services
node_patient -->|"books appointment"| node_booking
node_patient -->|"checks queue"| node_queueview
node_patient -->|"manages profile"| node_account
node_staff -->|"manages clinic"| node_admin
node_home -->|"links to"| node_services
node_services -->|"requests listings"| node_api
node_booking -.->|"submits booking"| node_api
node_queueview -.->|"loads queue"| node_api
node_account -.->|"uses account endpoints"| node_api
node_admin -.->|"manages records"| node_api
node_api -.->|"routes requests"| node_authhandler
node_api -.->|"routes requests"| node_appointmenthandler
node_appointmenthandler -.->|"delegates booking"| node_appointmentlogic
node_authhandler -.->|"delegates auth"| node_accountlogic
node_appointmentlogic -.->|"persists appointments"| node_appointmentrepo
node_accountlogic -.->|"accesses users"| node_userrepo
node_cataloglogic -.->|"accesses services"| node_servicerepo
node_doctorlogic -.->|"accesses doctors"| node_doctorrepo
node_appointmentrepo -.->|"reads and writes"| node_database
node_userrepo -.->|"reads and writes"| node_database
node_servicerepo -.->|"reads and writes"| node_database
node_doctorrepo -.->|"reads and writes"| node_database
node_scheduler -.->|"runs jobs"| node_joblogic
node_joblogic -.->|"updates appointments"| node_appointmentrepo
node_joblogic -.->|"sends reminders"| node_line
node_line -.->|"uses client"| node_lineclient
node_appointmenthandler -.->|"uploads images"| node_storage

click node_home "https://github.com/bigpumpum001/toothtoday/blob/main/frontend/src/app/page.tsx"
click node_services "https://github.com/bigpumpum001/toothtoday/blob/main/frontend/src/components/features/services/Allservices.tsx"
click node_booking "https://github.com/bigpumpum001/toothtoday/blob/main/frontend/src/components/features/booking/BookingForm.tsx"
click node_queueview "https://github.com/bigpumpum001/toothtoday/blob/main/frontend/src/components/features/queue/DoctorSchedule.tsx"
click node_account "https://github.com/bigpumpum001/toothtoday/blob/main/frontend/src/components/features/profile/Profile.tsx"
click node_admin "https://github.com/bigpumpum001/toothtoday/blob/main/frontend/src/app/dashboard/page.tsx"
click node_authhandler "https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/handlers/auth_handler.go"
click node_appointmenthandler "https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/handlers/appointment_handler.go"
click node_appointmentlogic "https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/services/appointment/appointment_slot.go"
click node_accountlogic "https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/services/user_service.go"
click node_cataloglogic "https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/services/service_service.go"
click node_doctorlogic "https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/services/doctor_service.go"
click node_joblogic "https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/services/appointment_job.go"
click node_scheduler "https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/jobs/scheduler.go"
click node_line "https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/services/line_service.go"
click node_lineclient "https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/clients/line_service.go"
click node_storage "https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/clients/gcs_client.go"
click node_database "https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/db/postgres.go"
click node_appointmentrepo "https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/repository/appointment_repository.go"
click node_userrepo "https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/repository/user_repository.go"
click node_servicerepo "https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/repository/service_repository.go"
click node_doctorrepo "https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/repository/doctor_repository.go"
click node_api "https://github.com/bigpumpum001/toothtoday/blob/main/backend/cmd/api/main.go"

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_home,node_services,node_booking,node_queueview,node_account,node_admin toneBlue
class node_authhandler,node_appointmenthandler,node_appointmentlogic,node_accountlogic,node_cataloglogic,node_doctorlogic,node_api toneAmber
class node_database,node_appointmentrepo,node_userrepo,node_servicerepo,node_doctorrepo toneMint
class node_joblogic,node_scheduler,node_line,node_lineclient,node_storage toneRose
class node_patient,node_staff toneIndigo
```

## Components

### Patient Web

- [Home and discovery](https://github.com/bigpumpum001/toothtoday/blob/main/frontend/src/app/page.tsx): `frontend/src/app/page.tsx`
- [Service listings](https://github.com/bigpumpum001/toothtoday/blob/main/frontend/src/components/features/services/Allservices.tsx): `frontend/src/components/features/services/Allservices.tsx`
- [Booking form](https://github.com/bigpumpum001/toothtoday/blob/main/frontend/src/components/features/booking/BookingForm.tsx): `frontend/src/components/features/booking/BookingForm.tsx`
- [Daily queue view](https://github.com/bigpumpum001/toothtoday/blob/main/frontend/src/components/features/queue/DoctorSchedule.tsx): `frontend/src/components/features/queue/DoctorSchedule.tsx`
- [Account and profile](https://github.com/bigpumpum001/toothtoday/blob/main/frontend/src/components/features/profile/Profile.tsx): `frontend/src/components/features/profile/Profile.tsx`
- [Admin dashboard](https://github.com/bigpumpum001/toothtoday/blob/main/frontend/src/app/dashboard/page.tsx): `frontend/src/app/dashboard/page.tsx`

### API Workflows

- [Authentication handlers](https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/handlers/auth_handler.go): `backend/internal/handlers/auth_handler.go`
- [Appointment handlers](https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/handlers/appointment_handler.go): `backend/internal/handlers/appointment_handler.go`
- [Booking and slot logic](https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/services/appointment/appointment_slot.go): `backend/internal/services/appointment/appointment_slot.go`
- [Account services](https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/services/user_service.go): `backend/internal/services/user_service.go`
- [Service management](https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/services/service_service.go): `backend/internal/services/service_service.go`
- [Doctor management](https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/services/doctor_service.go): `backend/internal/services/doctor_service.go`
- [ToothToday API](https://github.com/bigpumpum001/toothtoday/blob/main/backend/cmd/api/main.go): `backend/cmd/api/main.go`

### Persistence

- [PostgreSQL](https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/db/postgres.go): `backend/internal/db/postgres.go`
- [Appointment repository](https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/repository/appointment_repository.go): `backend/internal/repository/appointment_repository.go`
- [User repository](https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/repository/user_repository.go): `backend/internal/repository/user_repository.go`
- [Service repository](https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/repository/service_repository.go): `backend/internal/repository/service_repository.go`
- [Doctor repository](https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/repository/doctor_repository.go): `backend/internal/repository/doctor_repository.go`

### Clinic Operations

- [Appointment jobs](https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/services/appointment_job.go): `backend/internal/services/appointment_job.go`
- [Job scheduler](https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/jobs/scheduler.go): `backend/internal/jobs/scheduler.go`
- [LINE notifications](https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/services/line_service.go): `backend/internal/services/line_service.go`
- [LINE client](https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/clients/line_service.go): `backend/internal/clients/line_service.go`
- [Image storage client](https://github.com/bigpumpum001/toothtoday/blob/main/backend/internal/clients/gcs_client.go): `backend/internal/clients/gcs_client.go`

### Other components

- **Patient**
- **Clinic staff**

## Connections

- Patient → Home and discovery: browses (evidence: `README.md`)
- Patient → Service listings: views services (evidence: `README.md`)
- Patient → Booking form: books appointment (evidence: `README.md`)
- Patient → Daily queue view: checks queue (evidence: `README.md`)
- Patient → Account and profile: manages profile (evidence: `README.md`)
- Clinic staff → Admin dashboard: manages clinic (evidence: `README.md`)
- Home and discovery → Service listings: links to (evidence: `frontend/src/app/page.tsx`)
- Service listings → ToothToday API: requests listings (evidence: `frontend/src/components/features/services/Allservices.tsx`)
- Booking form → ToothToday API: submits booking
- Daily queue view → ToothToday API: loads queue
- Account and profile → ToothToday API: uses account endpoints
- Admin dashboard → ToothToday API: manages records
- ToothToday API → Authentication handlers: routes requests
- ToothToday API → Appointment handlers: routes requests
- Appointment handlers → Booking and slot logic: delegates booking
- Authentication handlers → Account services: delegates auth
- Booking and slot logic → Appointment repository: persists appointments
- Account services → User repository: accesses users
- Service management → Service repository: accesses services
- Doctor management → Doctor repository: accesses doctors
- Appointment repository → PostgreSQL: reads and writes
- User repository → PostgreSQL: reads and writes
- Service repository → PostgreSQL: reads and writes
- Doctor repository → PostgreSQL: reads and writes
- Job scheduler → Appointment jobs: runs jobs
- Appointment jobs → Appointment repository: updates appointments
- Appointment jobs → LINE notifications: sends reminders
- LINE notifications → LINE client: uses client
- Appointment handlers → Image storage client: uploads images
