# swamphacks/nfc-checkin architecture

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

- Interactive diagram: https://gitdiagram.com/swamphacks/nfc-checkin
- Repository: https://github.com/swamphacks/nfc-checkin

## Overview

This repository pairs an Expo mobile app for event staff with an Express API that records NFC-tag check-ins, workshop/social registrations, and redeemable claims. The main workflow is to scan a tag, choose a user or event context, submit the registration, and receive status feedback. The app also exposes separate meal, T-shirt, workshop, and social screens. Backend controllers query PostgreSQL. Source excerpts confirm the tag-linking screen and selected API handlers; other app-to-endpoint wiring is not fully sampled, so uncertain links are omitted.

Main entry points: [`shxii-nfc-checkin/src/app/(tabs)/index.tsx`](https://github.com/swamphacks/nfc-checkin/blob/main/shxii-nfc-checkin/src/app/(tabs)/index.tsx) (Link tag screen), [`shxii-nfc-checkin/src/components/SelectPage.tsx`](https://github.com/swamphacks/nfc-checkin/blob/main/shxii-nfc-checkin/src/components/SelectPage.tsx) (Event registration), [`nfc-backend/index.js`](https://github.com/swamphacks/nfc-checkin/blob/main/nfc-backend/index.js) (Express API), [`nfc-backend/db.js`](https://github.com/swamphacks/nfc-checkin/blob/main/nfc-backend/db.js) (PostgreSQL pool)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Staff mobile app"]
  node_linkscreen["Link tag screen<br/>[index.tsx]"]
  node_selectpage["Event registration<br/>[SelectPage.tsx]"]
  node_mealsscreen["Meals screen<br/>[Meals.tsx]"]
  node_tshirtsscreen["T-shirts screen<br/>[TShirts.tsx]"]
  node_workshopsscreen["Workshops screen<br/>[Workshops.tsx]"]
  node_socialsscreen["Socials screen<br/>[Socials.tsx]"]
  node_nfcscan["NFC scan hook<br/>[UseNfcScan.ts]"]
  node_qrscan["QR scan hook<br/>[useQrScanner.ts]"]
  node_register["Registration hook<br/>[UseRegisterUser.ts]"]
  node_feedback["Scan feedback<br/>[GlowFeedback.tsx]"]
  node_apiurl["API URL hook<br/>[useApi.ts]"]
end

subgraph group_api["Backend API"]
  node_backend["Express API<br/>[index.js]"]
  node_checkinroutes["Check-in routes<br/>[CheckinRoutes.js]"]
  node_workshoproutes["Workshop routes<br/>[WorkshopRoutes.js]"]
  node_redeemableroutes["Redeemable routes"]
  node_checkincontroller["Check-in logic"]
  node_workshopcontroller["Workshop logic"]
  node_redeemablecontroller["Redeemable logic"]
end

subgraph group_data["Persistence"]
  node_db[("PostgreSQL pool<br/>[db.js]")]
end

node_staff(("Event staff"))
node_nfcdevice(("NFC tag"))
node_camera(("Camera QR"))
node_postgres[("PostgreSQL")]

node_staff -->|"uses"| node_linkscreen
node_staff -->|"uses"| node_selectpage
node_linkscreen -->|"scans tag"| node_nfcscan
node_linkscreen -->|"scans user QR"| node_qrscan
node_linkscreen -->|"submits link"| node_register
node_linkscreen -->|"gets API URL"| node_apiurl
node_linkscreen -->|"shows result"| node_feedback
node_selectpage -->|"scans tag"| node_nfcscan
node_selectpage -->|"submits registration"| node_register
node_selectpage -->|"gets API URL"| node_apiurl
node_selectpage -->|"shows result"| node_feedback
node_nfcdevice -->|"provides tag ID"| node_nfcscan
node_camera -->|"provides QR data"| node_qrscan
node_register -->|"sends request"| node_backend
node_backend -->|"mounts /api/checkin"| node_checkinroutes
node_backend -->|"mounts /api/workshops"| node_workshoproutes
node_backend -->|"mounts /api/redeemables"| node_redeemableroutes
node_checkinroutes -->|"dispatches"| node_checkincontroller
node_workshoproutes -->|"dispatches"| node_workshopcontroller
node_redeemableroutes -->|"dispatches"| node_redeemablecontroller
node_checkincontroller -->|"queries"| node_db
node_workshopcontroller -->|"queries"| node_db
node_redeemablecontroller -->|"queries"| node_db
node_db -->|"reads/writes"| node_postgres

click node_linkscreen "https://github.com/swamphacks/nfc-checkin/blob/main/shxii-nfc-checkin/src/app/(tabs)/index.tsx"
click node_selectpage "https://github.com/swamphacks/nfc-checkin/blob/main/shxii-nfc-checkin/src/components/SelectPage.tsx"
click node_mealsscreen "https://github.com/swamphacks/nfc-checkin/blob/main/shxii-nfc-checkin/src/app/(tabs)/Meals.tsx"
click node_tshirtsscreen "https://github.com/swamphacks/nfc-checkin/blob/main/shxii-nfc-checkin/src/app/(tabs)/TShirts.tsx"
click node_workshopsscreen "https://github.com/swamphacks/nfc-checkin/blob/main/shxii-nfc-checkin/src/app/(tabs)/Workshops.tsx"
click node_socialsscreen "https://github.com/swamphacks/nfc-checkin/blob/main/shxii-nfc-checkin/src/app/(tabs)/Socials.tsx"
click node_nfcscan "https://github.com/swamphacks/nfc-checkin/blob/main/shxii-nfc-checkin/src/hooks/UseNfcScan.ts"
click node_qrscan "https://github.com/swamphacks/nfc-checkin/blob/main/shxii-nfc-checkin/src/hooks/useQrScanner.ts"
click node_register "https://github.com/swamphacks/nfc-checkin/blob/main/shxii-nfc-checkin/src/hooks/UseRegisterUser.ts"
click node_feedback "https://github.com/swamphacks/nfc-checkin/blob/main/shxii-nfc-checkin/src/utils/GlowFeedback.tsx"
click node_apiurl "https://github.com/swamphacks/nfc-checkin/blob/main/shxii-nfc-checkin/src/hooks/useApi.ts"
click node_backend "https://github.com/swamphacks/nfc-checkin/blob/main/nfc-backend/index.js"
click node_checkinroutes "https://github.com/swamphacks/nfc-checkin/blob/main/nfc-backend/Routes/CheckinRoutes.js"
click node_workshoproutes "https://github.com/swamphacks/nfc-checkin/blob/main/nfc-backend/Routes/WorkshopRoutes.js"
click node_redeemableroutes "https://github.com/swamphacks/nfc-checkin/blob/main/nfc-backend/Routes/RedeemableRoutes.js"
click node_checkincontroller "https://github.com/swamphacks/nfc-checkin/blob/main/nfc-backend/Controllers/CheckinController.js"
click node_workshopcontroller "https://github.com/swamphacks/nfc-checkin/blob/main/nfc-backend/Controllers/WorkshopController.js"
click node_redeemablecontroller "https://github.com/swamphacks/nfc-checkin/blob/main/nfc-backend/Controllers/RedeemableController.js"
click node_db "https://github.com/swamphacks/nfc-checkin/blob/main/nfc-backend/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_linkscreen,node_selectpage,node_mealsscreen,node_tshirtsscreen,node_workshopsscreen,node_socialsscreen,node_nfcscan,node_qrscan,node_register,node_feedback,node_apiurl toneBlue
class node_backend,node_checkinroutes,node_workshoproutes,node_redeemableroutes,node_checkincontroller,node_workshopcontroller,node_redeemablecontroller,node_postgres toneAmber
class node_db toneMint
class node_staff,node_nfcdevice,node_camera toneIndigo
```

## Components

### Staff mobile app

- [Link tag screen](https://github.com/swamphacks/nfc-checkin/blob/main/shxii-nfc-checkin/src/app/(tabs)/index.tsx): `shxii-nfc-checkin/src/app/(tabs)/index.tsx`
- [Event registration](https://github.com/swamphacks/nfc-checkin/blob/main/shxii-nfc-checkin/src/components/SelectPage.tsx): `shxii-nfc-checkin/src/components/SelectPage.tsx`
- [Meals screen](https://github.com/swamphacks/nfc-checkin/blob/main/shxii-nfc-checkin/src/app/(tabs)/Meals.tsx): `shxii-nfc-checkin/src/app/(tabs)/Meals.tsx`
- [T-shirts screen](https://github.com/swamphacks/nfc-checkin/blob/main/shxii-nfc-checkin/src/app/(tabs)/TShirts.tsx): `shxii-nfc-checkin/src/app/(tabs)/TShirts.tsx`
- [Workshops screen](https://github.com/swamphacks/nfc-checkin/blob/main/shxii-nfc-checkin/src/app/(tabs)/Workshops.tsx): `shxii-nfc-checkin/src/app/(tabs)/Workshops.tsx`
- [Socials screen](https://github.com/swamphacks/nfc-checkin/blob/main/shxii-nfc-checkin/src/app/(tabs)/Socials.tsx): `shxii-nfc-checkin/src/app/(tabs)/Socials.tsx`
- [NFC scan hook](https://github.com/swamphacks/nfc-checkin/blob/main/shxii-nfc-checkin/src/hooks/UseNfcScan.ts): `shxii-nfc-checkin/src/hooks/UseNfcScan.ts`
- [QR scan hook](https://github.com/swamphacks/nfc-checkin/blob/main/shxii-nfc-checkin/src/hooks/useQrScanner.ts): `shxii-nfc-checkin/src/hooks/useQrScanner.ts`
- [Registration hook](https://github.com/swamphacks/nfc-checkin/blob/main/shxii-nfc-checkin/src/hooks/UseRegisterUser.ts): `shxii-nfc-checkin/src/hooks/UseRegisterUser.ts`
- [Scan feedback](https://github.com/swamphacks/nfc-checkin/blob/main/shxii-nfc-checkin/src/utils/GlowFeedback.tsx): `shxii-nfc-checkin/src/utils/GlowFeedback.tsx`
- [API URL hook](https://github.com/swamphacks/nfc-checkin/blob/main/shxii-nfc-checkin/src/hooks/useApi.ts): `shxii-nfc-checkin/src/hooks/useApi.ts`

### Backend API

- [Express API](https://github.com/swamphacks/nfc-checkin/blob/main/nfc-backend/index.js): `nfc-backend/index.js`
- [Check-in routes](https://github.com/swamphacks/nfc-checkin/blob/main/nfc-backend/Routes/CheckinRoutes.js): `nfc-backend/Routes/CheckinRoutes.js`
- [Workshop routes](https://github.com/swamphacks/nfc-checkin/blob/main/nfc-backend/Routes/WorkshopRoutes.js): `nfc-backend/Routes/WorkshopRoutes.js`
- [Redeemable routes](https://github.com/swamphacks/nfc-checkin/blob/main/nfc-backend/Routes/RedeemableRoutes.js): `nfc-backend/Routes/RedeemableRoutes.js`
- [Check-in logic](https://github.com/swamphacks/nfc-checkin/blob/main/nfc-backend/Controllers/CheckinController.js): `nfc-backend/Controllers/CheckinController.js`
- [Workshop logic](https://github.com/swamphacks/nfc-checkin/blob/main/nfc-backend/Controllers/WorkshopController.js): `nfc-backend/Controllers/WorkshopController.js`
- [Redeemable logic](https://github.com/swamphacks/nfc-checkin/blob/main/nfc-backend/Controllers/RedeemableController.js): `nfc-backend/Controllers/RedeemableController.js`

### Persistence

- [PostgreSQL pool](https://github.com/swamphacks/nfc-checkin/blob/main/nfc-backend/db.js): `nfc-backend/db.js`

### Other components

- **Event staff**
- **NFC tag**
- **Camera QR**
- **PostgreSQL**

## Connections

- Event staff → Link tag screen: uses
- Event staff → Event registration: uses
- Link tag screen → NFC scan hook: scans tag
- Link tag screen → QR scan hook: scans user QR
- Link tag screen → Registration hook: submits link
- Link tag screen → API URL hook: gets API URL
- Link tag screen → Scan feedback: shows result
- Event registration → NFC scan hook: scans tag
- Event registration → Registration hook: submits registration
- Event registration → API URL hook: gets API URL
- Event registration → Scan feedback: shows result
- NFC tag → NFC scan hook: provides tag ID
- Camera QR → QR scan hook: provides QR data
- Registration hook → Express API: sends request
- Express API → Check-in routes: mounts /api/checkin
- Express API → Workshop routes: mounts /api/workshops
- Express API → Redeemable routes: mounts /api/redeemables
- Check-in routes → Check-in logic: dispatches
- Workshop routes → Workshop logic: dispatches
- Redeemable routes → Redeemable logic: dispatches
- Check-in logic → PostgreSQL pool: queries
- Workshop logic → PostgreSQL pool: queries
- Redeemable logic → PostgreSQL pool: queries
- PostgreSQL pool → PostgreSQL: reads/writes
