# thienphu-1910/unihub architecture

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

- Interactive diagram: https://gitdiagram.com/thienphu-1910/unihub
- Repository: https://github.com/thienphu-1910/unihub

## Overview

Uni-hub is a workshop-management application for organizers, students, and check-in staff. Users authenticate, browse or manage workshops, register, and attend with staff check-in; organizers also handle payments and student imports. The frontend routes role-specific pages and uses browser storage for offline check-in, while an Express backend exposes APIs and background workers. Source excerpts and the SOURCE INDEX establish many backend calls; several routes and subsystems are unsampled, so uncertain links are omitted.

Main entry points: [`frontend/src/App.jsx`](https://github.com/thienphu-1910/unihub/blob/main/frontend/src/App.jsx) (App routing), [`backend/src/services/registration.service.js`](https://github.com/thienphu-1910/unihub/blob/main/backend/src/services/registration.service.js) (Registration workflow), [`backend/src/services/payment.service.js`](https://github.com/thienphu-1910/unihub/blob/main/backend/src/services/payment.service.js) (Payment processing), [`frontend/src/services/api.js`](https://github.com/thienphu-1910/unihub/blob/main/frontend/src/services/api.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_appui["App routing<br/>[App.jsx]"]
  node_authpages["Login and register<br/>[Login.jsx]"]
  node_workshoppages["Workshop pages<br/>[WorkshopsPage.jsx]"]
  node_detailpage["Workshop detail"]
  node_checkinpage["Check-in page<br/>[CheckinPage.jsx]"]
  node_authstore["Auth state<br/>[useAuthStore.js]"]
  node_browserdb[("Offline check-in store<br/>[indexedDB.js]")]
  node_frontendapi["API client<br/>[api.js]"]
  node_authclient["Auth client"]
  node_registrationclient["Registration client"]
  node_workshopclient["Workshop client<br/>[workshopService.js]"]
  node_checkinclient["Check-in client<br/>[checkinService.js]"]
end

subgraph group_api["Backend workflows"]
  node_server["Express API<br/>[app.js]"]
  node_authroute["Auth routes<br/>[auth.route.js]"]
  node_authcontroller["Auth controller<br/>[auth.controller.js]"]
  node_authservice["Authentication<br/>[auth.service.js]"]
  node_registrationcontroller["Registration controller"]
  node_registrationservice["Registration workflow"]
  node_workshopcontroller["Workshop controller"]
  node_workshopservice["Workshop management"]
  node_paymentcontroller["Payment controller"]
  node_paymentservice["Payment processing<br/>[payment.service.js]"]
  node_syncservice["Student import"]
end

subgraph group_async["Background processing"]
  node_registrationqueue["Registration queue"]
  node_registrationworker["Registration worker"]
  node_paymentqueue["Payment queue<br/>[payment.queue.js]"]
end

subgraph group_data["Data and integrations"]
  node_registrationrepo["Registration repository"]
  node_workshoprepo["Workshop repository"]
  node_userrepo["User repository<br/>[user.repository.js]"]
  node_paymentrepo["Payment repository"]
  node_studentrepo["Student import repository"]
  node_sql[("Supabase database<br/>[db.js]")]
  node_redis[("Redis<br/>[redis.js]")]
end

node_user(("User"))

node_user -->|"uses"| node_appui
node_appui -->|"routes to"| node_authpages
node_appui -->|"routes to"| node_workshoppages
node_appui -->|"routes to"| node_detailpage
node_appui -->|"routes to"| node_checkinpage
node_appui -->|"reads"| node_authstore
node_appui -->|"reads"| node_browserdb
node_appui -->|"syncs through"| node_checkinclient
node_authclient -->|"calls"| node_frontendapi
node_authclient -->|"updates"| node_authstore
node_registrationclient -->|"calls"| node_frontendapi
node_workshopclient -->|"calls"| node_frontendapi
node_checkinclient -->|"calls"| node_frontendapi
node_server -->|"mounts"| node_authroute
node_server -.->|"routes via"| node_registrationcontroller
node_server -.->|"routes via"| node_workshopcontroller
node_authroute -->|"dispatches"| node_authcontroller
node_authcontroller -->|"authenticates with"| node_authservice
node_authcontroller -.->|"looks up via"| node_userrepo
node_registrationcontroller -->|"delegates to"| node_registrationservice
node_workshopcontroller -->|"delegates to"| node_workshopservice
node_paymentcontroller -->|"delegates to"| node_paymentservice
node_paymentcontroller -->|"uses"| node_registrationservice
node_registrationservice -->|"reads and writes"| node_registrationrepo
node_registrationservice -->|"reads"| node_workshoprepo
node_registrationservice -->|"reads"| node_userrepo
node_registrationservice -->|"checks slots"| node_redis
node_registrationservice -->|"enqueues"| node_registrationqueue
node_workshopservice -->|"manages"| node_workshoprepo
node_paymentservice -->|"persists payment"| node_paymentrepo
node_paymentservice -->|"updates registration"| node_registrationrepo
node_paymentservice -->|"queues work"| node_paymentqueue
node_studentrepo -->|"queries"| node_sql
node_workshoprepo -->|"queries"| node_sql
node_registrationworker -->|"updates"| node_registrationrepo
node_registrationworker -->|"uses"| node_redis
node_paymentqueue -.->|"processed by"| node_paymentservice
node_syncservice -->|"imports data"| node_studentrepo

click node_appui "https://github.com/thienphu-1910/unihub/blob/main/frontend/src/App.jsx"
click node_authpages "https://github.com/thienphu-1910/unihub/blob/main/frontend/src/pages/Login.jsx"
click node_workshoppages "https://github.com/thienphu-1910/unihub/blob/main/frontend/src/pages/WorkshopsPage.jsx"
click node_detailpage "https://github.com/thienphu-1910/unihub/blob/main/frontend/src/pages/WorkshopDetailPage.jsx"
click node_checkinpage "https://github.com/thienphu-1910/unihub/blob/main/frontend/src/pages/CheckinPage.jsx"
click node_authstore "https://github.com/thienphu-1910/unihub/blob/main/frontend/src/store/useAuthStore.js"
click node_browserdb "https://github.com/thienphu-1910/unihub/blob/main/frontend/src/lib/indexedDB.js"
click node_frontendapi "https://github.com/thienphu-1910/unihub/blob/main/frontend/src/services/api.js"
click node_authclient "https://github.com/thienphu-1910/unihub/blob/main/frontend/src/services/authenticationService.js"
click node_registrationclient "https://github.com/thienphu-1910/unihub/blob/main/frontend/src/services/registrationService.js"
click node_workshopclient "https://github.com/thienphu-1910/unihub/blob/main/frontend/src/services/workshopService.js"
click node_checkinclient "https://github.com/thienphu-1910/unihub/blob/main/frontend/src/services/checkinService.js"
click node_server "https://github.com/thienphu-1910/unihub/blob/main/backend/src/app.js"
click node_authroute "https://github.com/thienphu-1910/unihub/blob/main/backend/src/routes/auth.route.js"
click node_authcontroller "https://github.com/thienphu-1910/unihub/blob/main/backend/src/controllers/auth.controller.js"
click node_authservice "https://github.com/thienphu-1910/unihub/blob/main/backend/src/services/auth.service.js"
click node_registrationcontroller "https://github.com/thienphu-1910/unihub/blob/main/backend/src/controllers/registration.controller.js"
click node_registrationservice "https://github.com/thienphu-1910/unihub/blob/main/backend/src/services/registration.service.js"
click node_workshopcontroller "https://github.com/thienphu-1910/unihub/blob/main/backend/src/controllers/workshop.controller.js"
click node_workshopservice "https://github.com/thienphu-1910/unihub/blob/main/backend/src/services/workshop.service.js"
click node_paymentcontroller "https://github.com/thienphu-1910/unihub/blob/main/backend/src/controllers/payment.controller.js"
click node_paymentservice "https://github.com/thienphu-1910/unihub/blob/main/backend/src/services/payment.service.js"
click node_syncservice "https://github.com/thienphu-1910/unihub/blob/main/backend/src/services/studentSync.service.js"
click node_registrationrepo "https://github.com/thienphu-1910/unihub/blob/main/backend/src/repositories/registration.repository.js"
click node_workshoprepo "https://github.com/thienphu-1910/unihub/blob/main/backend/src/repositories/workshop.repository.js"
click node_userrepo "https://github.com/thienphu-1910/unihub/blob/main/backend/src/repositories/user.repository.js"
click node_paymentrepo "https://github.com/thienphu-1910/unihub/blob/main/backend/src/repositories/payment.repository.js"
click node_studentrepo "https://github.com/thienphu-1910/unihub/blob/main/backend/src/repositories/studentSync.repository.js"
click node_sql "https://github.com/thienphu-1910/unihub/blob/main/backend/src/config/db.js"
click node_redis "https://github.com/thienphu-1910/unihub/blob/main/backend/src/config/redis.js"
click node_registrationqueue "https://github.com/thienphu-1910/unihub/blob/main/backend/src/jobs/queues/registration.queue.js"
click node_registrationworker "https://github.com/thienphu-1910/unihub/blob/main/backend/src/jobs/workers/registration.worker.js"
click node_paymentqueue "https://github.com/thienphu-1910/unihub/blob/main/backend/src/jobs/queues/payment.queue.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_appui,node_authpages,node_workshoppages,node_detailpage,node_checkinpage,node_authstore,node_browserdb,node_frontendapi,node_authclient,node_registrationclient,node_workshopclient,node_checkinclient,node_user toneBlue
class node_server,node_authroute,node_authcontroller,node_authservice,node_registrationcontroller,node_registrationservice,node_workshopcontroller,node_workshopservice,node_paymentcontroller,node_paymentservice,node_syncservice toneAmber
class node_registrationqueue,node_registrationworker,node_paymentqueue toneMint
class node_registrationrepo,node_workshoprepo,node_userrepo,node_paymentrepo,node_studentrepo,node_sql,node_redis toneRose
```

## Components

### Web application

- [App routing](https://github.com/thienphu-1910/unihub/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Login and register](https://github.com/thienphu-1910/unihub/blob/main/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`
- [Workshop pages](https://github.com/thienphu-1910/unihub/blob/main/frontend/src/pages/WorkshopsPage.jsx): `frontend/src/pages/WorkshopsPage.jsx`
- [Workshop detail](https://github.com/thienphu-1910/unihub/blob/main/frontend/src/pages/WorkshopDetailPage.jsx): `frontend/src/pages/WorkshopDetailPage.jsx`
- [Check-in page](https://github.com/thienphu-1910/unihub/blob/main/frontend/src/pages/CheckinPage.jsx): `frontend/src/pages/CheckinPage.jsx`
- [Auth state](https://github.com/thienphu-1910/unihub/blob/main/frontend/src/store/useAuthStore.js): `frontend/src/store/useAuthStore.js`
- [Offline check-in store](https://github.com/thienphu-1910/unihub/blob/main/frontend/src/lib/indexedDB.js): `frontend/src/lib/indexedDB.js`
- [API client](https://github.com/thienphu-1910/unihub/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Auth client](https://github.com/thienphu-1910/unihub/blob/main/frontend/src/services/authenticationService.js): `frontend/src/services/authenticationService.js`
- [Registration client](https://github.com/thienphu-1910/unihub/blob/main/frontend/src/services/registrationService.js): `frontend/src/services/registrationService.js`
- [Workshop client](https://github.com/thienphu-1910/unihub/blob/main/frontend/src/services/workshopService.js): `frontend/src/services/workshopService.js`
- [Check-in client](https://github.com/thienphu-1910/unihub/blob/main/frontend/src/services/checkinService.js): `frontend/src/services/checkinService.js`

### Backend workflows

- [Express API](https://github.com/thienphu-1910/unihub/blob/main/backend/src/app.js): `backend/src/app.js`
- [Auth routes](https://github.com/thienphu-1910/unihub/blob/main/backend/src/routes/auth.route.js): `backend/src/routes/auth.route.js`
- [Auth controller](https://github.com/thienphu-1910/unihub/blob/main/backend/src/controllers/auth.controller.js): `backend/src/controllers/auth.controller.js`
- [Authentication](https://github.com/thienphu-1910/unihub/blob/main/backend/src/services/auth.service.js): `backend/src/services/auth.service.js`
- [Registration controller](https://github.com/thienphu-1910/unihub/blob/main/backend/src/controllers/registration.controller.js): `backend/src/controllers/registration.controller.js`
- [Registration workflow](https://github.com/thienphu-1910/unihub/blob/main/backend/src/services/registration.service.js): `backend/src/services/registration.service.js`
- [Workshop controller](https://github.com/thienphu-1910/unihub/blob/main/backend/src/controllers/workshop.controller.js): `backend/src/controllers/workshop.controller.js`
- [Workshop management](https://github.com/thienphu-1910/unihub/blob/main/backend/src/services/workshop.service.js): `backend/src/services/workshop.service.js`
- [Payment controller](https://github.com/thienphu-1910/unihub/blob/main/backend/src/controllers/payment.controller.js): `backend/src/controllers/payment.controller.js`
- [Payment processing](https://github.com/thienphu-1910/unihub/blob/main/backend/src/services/payment.service.js): `backend/src/services/payment.service.js`
- [Student import](https://github.com/thienphu-1910/unihub/blob/main/backend/src/services/studentSync.service.js): `backend/src/services/studentSync.service.js`

### Background processing

- [Registration queue](https://github.com/thienphu-1910/unihub/blob/main/backend/src/jobs/queues/registration.queue.js): `backend/src/jobs/queues/registration.queue.js`
- [Registration worker](https://github.com/thienphu-1910/unihub/blob/main/backend/src/jobs/workers/registration.worker.js): `backend/src/jobs/workers/registration.worker.js`
- [Payment queue](https://github.com/thienphu-1910/unihub/blob/main/backend/src/jobs/queues/payment.queue.js): `backend/src/jobs/queues/payment.queue.js`

### Data and integrations

- [Registration repository](https://github.com/thienphu-1910/unihub/blob/main/backend/src/repositories/registration.repository.js): `backend/src/repositories/registration.repository.js`
- [Workshop repository](https://github.com/thienphu-1910/unihub/blob/main/backend/src/repositories/workshop.repository.js): `backend/src/repositories/workshop.repository.js`
- [User repository](https://github.com/thienphu-1910/unihub/blob/main/backend/src/repositories/user.repository.js): `backend/src/repositories/user.repository.js`
- [Payment repository](https://github.com/thienphu-1910/unihub/blob/main/backend/src/repositories/payment.repository.js): `backend/src/repositories/payment.repository.js`
- [Student import repository](https://github.com/thienphu-1910/unihub/blob/main/backend/src/repositories/studentSync.repository.js): `backend/src/repositories/studentSync.repository.js`
- [Supabase database](https://github.com/thienphu-1910/unihub/blob/main/backend/src/config/db.js): `backend/src/config/db.js`
- [Redis](https://github.com/thienphu-1910/unihub/blob/main/backend/src/config/redis.js): `backend/src/config/redis.js`

### Other components

- **User**

## Connections

- User → App routing: uses (evidence: `frontend/src/App.jsx`)
- App routing → Login and register: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Workshop pages: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Workshop detail: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Check-in page: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Auth state: reads (evidence: `frontend/src/App.jsx`)
- App routing → Offline check-in store: reads (evidence: `frontend/src/App.jsx`)
- App routing → Check-in client: syncs through (evidence: `frontend/src/App.jsx`)
- Auth client → API client: calls (evidence: `frontend/src/services/authenticationService.js`)
- Auth client → Auth state: updates (evidence: `frontend/src/services/authenticationService.js`)
- Registration client → API client: calls (evidence: `frontend/src/services/registrationService.js`)
- Workshop client → API client: calls (evidence: `frontend/src/services/workshopService.js`)
- Check-in client → API client: calls (evidence: `frontend/src/services/checkinService.js`)
- Express API → Auth routes: mounts (evidence: `backend/src/app.js`)
- Express API → Registration controller: routes via
- Express API → Workshop controller: routes via
- Auth routes → Auth controller: dispatches (evidence: `backend/src/routes/auth.route.js`)
- Auth controller → Authentication: authenticates with (evidence: `backend/src/controllers/auth.controller.js`)
- Auth controller → User repository: looks up via
- Registration controller → Registration workflow: delegates to (evidence: `backend/src/controllers/registration.controller.js`)
- Workshop controller → Workshop management: delegates to (evidence: `backend/src/controllers/workshop.controller.js`)
- Payment controller → Payment processing: delegates to (evidence: `backend/src/controllers/payment.controller.js`)
- Payment controller → Registration workflow: uses (evidence: `backend/src/controllers/payment.controller.js`)
- Registration workflow → Registration repository: reads and writes (evidence: `backend/src/services/registration.service.js`)
- Registration workflow → Workshop repository: reads (evidence: `backend/src/services/registration.service.js`)
- Registration workflow → User repository: reads (evidence: `backend/src/services/registration.service.js`)
- Registration workflow → Redis: checks slots (evidence: `backend/src/services/registration.service.js`)
- Registration workflow → Registration queue: enqueues (evidence: `backend/src/services/registration.service.js`)
- Workshop management → Workshop repository: manages (evidence: `backend/src/services/workshop.service.js`)
- Payment processing → Payment repository: persists payment (evidence: `backend/src/services/payment.service.js`)
- Payment processing → Registration repository: updates registration (evidence: `backend/src/services/payment.service.js`)
- Payment processing → Payment queue: queues work (evidence: `backend/src/services/payment.service.js`)
- Student import repository → Supabase database: queries (evidence: `backend/src/repositories/studentSync.repository.js`)
- Workshop repository → Supabase database: queries (evidence: `backend/src/repositories/workshop.repository.js`)
- Registration worker → Registration repository: updates (evidence: `backend/src/jobs/workers/registration.worker.js`)
- Registration worker → Redis: uses (evidence: `backend/src/jobs/workers/registration.worker.js`)
- Payment queue → Payment processing: processed by (evidence: `backend/src/services/payment.service.js`)
- Student import → Student import repository: imports data (evidence: `backend/src/services/studentSync.service.js`)
