# noelorph/diy-instax-photobooth architecture

> Architecture diagram of the GitHub repository noelorph/diy-instax-photobooth, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/noelorph/diy-instax-photobooth
- Repository: https://github.com/noelorph/diy-instax-photobooth

## Overview

DIY Instax Photo Booth combines an Admin application for access, event-draft management, and profile settings with a separate iPhone printer-qualification harness. The main Admin workflow is sign-in and authorization, then creating or editing a Draft Event backed by Supabase. The qualification workflow captures and prepares a test image, communicates with an Instax Mini Link 3 over browser Bluetooth, and records trial outcomes. README describes Booth Mode and printing operations as gated; the supplied tree does not show their implementation. Edges reflect excerpts, SOURCE INDEX references, or README statements; unsampled subsystems are represented only at supported paths.

Main entry points: [`src/features/qualification/QualificationClient.tsx`](https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/qualification/QualificationClient.tsx) (Trial interface), [`src/lib/supabase/server.ts`](https://github.com/noelorph/diy-instax-photobooth/blob/main/src/lib/supabase/server.ts) (Server client), [`src/lib/events/drafts.ts`](https://github.com/noelorph/diy-instax-photobooth/blob/main/src/lib/events/drafts.ts) (Draft service), [`src/lib/auth/require-admin.ts`](https://github.com/noelorph/diy-instax-photobooth/blob/main/src/lib/auth/require-admin.ts) (Admin authorization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_admin["Admin experience"]
  node_sign_in["Sign in<br/>[page.tsx]"]
  node_auth_actions["Auth actions<br/>[actions.ts]"]
  node_recovery["Recovery flow<br/>[route.ts]"]
  node_admin_pages["Admin pages<br/>[page.tsx]"]
  node_profile["Profile<br/>[profile.tsx]"]
  node_profile_actions["Profile actions<br/>[actions.ts]"]
end

subgraph group_events["Event drafts"]
  node_event_pages["Event pages<br/>[page.tsx]"]
  node_draft_editor["Draft editor<br/>[draft-form.tsx]"]
  node_draft_actions["Draft actions<br/>[actions.ts]"]
  node_draft_service["Draft service<br/>[drafts.ts]"]
  node_draft_schema["Draft validation"]
end

subgraph group_qualification["Printer qualification"]
  node_qualification_page["Qualification page<br/>[page.tsx]"]
  node_qualification_client["Trial interface"]
  node_image_prep["Image preparation<br/>[image.ts]"]
  node_printer_session["Print session<br/>[session.ts]"]
  node_bluetooth["Bluetooth transport<br/>[bluetooth.ts]"]
  node_printer_protocol["Printer protocol<br/>[protocol.ts]"]
  node_trial_state["Trial state<br/>[trial.ts]"]
  node_trial_log["Trial log<br/>[trial-log.ts]"]
end

subgraph group_platform["Auth and persistence"]
  node_supabase_server["Server client<br/>[server.ts]"]
  node_admin_guard["Admin authorization<br/>[require-admin.ts]"]
end

node_admin_user(("Admin"))
node_supabase[("Supabase Auth and data")]
node_operator(("Trial operator"))
node_browser_camera["Device camera"]
node_instax_printer["Instax Mini Link 3"]

node_admin_user -->|"signs in"| node_sign_in
node_sign_in -->|"submits credentials"| node_auth_actions
node_auth_actions -->|"uses server client"| node_supabase_server
node_recovery -->|"exchanges recovery code"| node_supabase_server
node_supabase_server -->|"auth and data requests"| node_supabase
node_admin_pages -->|"requires Admin"| node_admin_guard
node_admin_guard -->|"creates client"| node_supabase_server
node_admin_guard -->|"checks session and Profile"| node_supabase
node_admin_user -->|"manages account"| node_profile
node_profile -->|"submits changes"| node_profile_actions
node_profile_actions -->|"uses server client"| node_supabase_server
node_admin_user -->|"manages Drafts"| node_event_pages
node_event_pages -->|"loads Drafts"| node_draft_service
node_event_pages -->|"renders editor"| node_draft_editor
node_draft_editor -->|"submits changes"| node_draft_actions
node_draft_actions -.->|"delegates Draft operations"| node_draft_service
node_draft_service -->|"requires Admin"| node_admin_guard
node_draft_service -->|"queries events"| node_supabase_server
node_draft_service -->|"validates input"| node_draft_schema
node_operator -->|"opens trial"| node_qualification_page
node_qualification_page -->|"renders harness"| node_qualification_client
node_qualification_client -->|"captures video"| node_browser_camera
node_qualification_client -->|"prepares print image"| node_image_prep
node_qualification_client -->|"runs print trial"| node_printer_session
node_qualification_client -.->|"updates trial state"| node_trial_state
node_qualification_client -.->|"records trial events"| node_trial_log
node_printer_session -->|"validates JPEG"| node_image_prep
node_printer_session -->|"exchanges printer data"| node_bluetooth
node_bluetooth -->|"uses protocol"| node_printer_protocol
node_bluetooth -.->|"communicates over Bluetooth"| node_instax_printer

click node_sign_in "https://github.com/noelorph/diy-instax-photobooth/blob/main/src/app/(auth)/sign-in/page.tsx"
click node_auth_actions "https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/admin/auth/actions.ts"
click node_recovery "https://github.com/noelorph/diy-instax-photobooth/blob/main/src/app/auth/callback/route.ts"
click node_admin_pages "https://github.com/noelorph/diy-instax-photobooth/blob/main/src/app/(admin)/dashboard/page.tsx"
click node_profile "https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/admin/profile/profile.tsx"
click node_profile_actions "https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/admin/profile/actions.ts"
click node_event_pages "https://github.com/noelorph/diy-instax-photobooth/blob/main/src/app/(admin)/events/page.tsx"
click node_draft_editor "https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/admin/events/draft-form.tsx"
click node_draft_actions "https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/admin/events/actions.ts"
click node_draft_service "https://github.com/noelorph/diy-instax-photobooth/blob/main/src/lib/events/drafts.ts"
click node_draft_schema "https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/admin/events/draft-event.schema.ts"
click node_qualification_page "https://github.com/noelorph/diy-instax-photobooth/blob/main/src/app/qualification/iphone-print/page.tsx"
click node_qualification_client "https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/qualification/QualificationClient.tsx"
click node_image_prep "https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/qualification/image.ts"
click node_printer_session "https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/qualification/instax/session.ts"
click node_bluetooth "https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/qualification/instax/bluetooth.ts"
click node_printer_protocol "https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/qualification/instax/protocol.ts"
click node_trial_state "https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/qualification/trial.ts"
click node_trial_log "https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/qualification/trial-log.ts"
click node_supabase_server "https://github.com/noelorph/diy-instax-photobooth/blob/main/src/lib/supabase/server.ts"
click node_admin_guard "https://github.com/noelorph/diy-instax-photobooth/blob/main/src/lib/auth/require-admin.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_sign_in,node_auth_actions,node_recovery,node_admin_pages,node_profile,node_profile_actions toneBlue
class node_event_pages,node_draft_editor,node_draft_actions,node_draft_service,node_draft_schema,node_supabase toneAmber
class node_qualification_page,node_qualification_client,node_image_prep,node_printer_session,node_bluetooth,node_printer_protocol,node_trial_state,node_trial_log toneMint
class node_supabase_server,node_admin_guard toneRose
class node_admin_user,node_operator,node_browser_camera,node_instax_printer toneIndigo
```

## Components

### Admin experience

- [Sign in](https://github.com/noelorph/diy-instax-photobooth/blob/main/src/app/(auth)/sign-in/page.tsx): `src/app/(auth)/sign-in/page.tsx`
- [Auth actions](https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/admin/auth/actions.ts): `src/features/admin/auth/actions.ts`
- [Recovery flow](https://github.com/noelorph/diy-instax-photobooth/blob/main/src/app/auth/callback/route.ts): `src/app/auth/callback/route.ts`
- [Admin pages](https://github.com/noelorph/diy-instax-photobooth/blob/main/src/app/(admin)/dashboard/page.tsx): `src/app/(admin)/dashboard/page.tsx`
- [Profile](https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/admin/profile/profile.tsx): `src/features/admin/profile/profile.tsx`
- [Profile actions](https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/admin/profile/actions.ts): `src/features/admin/profile/actions.ts`

### Event drafts

- [Event pages](https://github.com/noelorph/diy-instax-photobooth/blob/main/src/app/(admin)/events/page.tsx): `src/app/(admin)/events/page.tsx`
- [Draft editor](https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/admin/events/draft-form.tsx): `src/features/admin/events/draft-form.tsx`
- [Draft actions](https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/admin/events/actions.ts): `src/features/admin/events/actions.ts`
- [Draft service](https://github.com/noelorph/diy-instax-photobooth/blob/main/src/lib/events/drafts.ts): `src/lib/events/drafts.ts`
- [Draft validation](https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/admin/events/draft-event.schema.ts): `src/features/admin/events/draft-event.schema.ts`

### Printer qualification

- [Qualification page](https://github.com/noelorph/diy-instax-photobooth/blob/main/src/app/qualification/iphone-print/page.tsx): `src/app/qualification/iphone-print/page.tsx`
- [Trial interface](https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/qualification/QualificationClient.tsx): `src/features/qualification/QualificationClient.tsx`
- [Image preparation](https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/qualification/image.ts): `src/features/qualification/image.ts`
- [Print session](https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/qualification/instax/session.ts): `src/features/qualification/instax/session.ts`
- [Bluetooth transport](https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/qualification/instax/bluetooth.ts): `src/features/qualification/instax/bluetooth.ts`
- [Printer protocol](https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/qualification/instax/protocol.ts): `src/features/qualification/instax/protocol.ts`
- [Trial state](https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/qualification/trial.ts): `src/features/qualification/trial.ts`
- [Trial log](https://github.com/noelorph/diy-instax-photobooth/blob/main/src/features/qualification/trial-log.ts): `src/features/qualification/trial-log.ts`

### Auth and persistence

- [Server client](https://github.com/noelorph/diy-instax-photobooth/blob/main/src/lib/supabase/server.ts): `src/lib/supabase/server.ts`
- [Admin authorization](https://github.com/noelorph/diy-instax-photobooth/blob/main/src/lib/auth/require-admin.ts): `src/lib/auth/require-admin.ts`

### Other components

- **Admin**
- **Supabase Auth and data**
- **Trial operator**
- **Device camera**
- **Instax Mini Link 3**

## Connections

- Admin → Sign in: signs in (evidence: `README.md`)
- Sign in → Auth actions: submits credentials (evidence: `src/app/(auth)/sign-in/page.tsx`)
- Auth actions → Server client: uses server client (evidence: `README.md`)
- Recovery flow → Server client: exchanges recovery code (evidence: `src/app/auth/callback/route.ts`)
- Server client → Supabase Auth and data: auth and data requests (evidence: `src/lib/supabase/server.ts`)
- Admin pages → Admin authorization: requires Admin (evidence: `src/app/(admin)/dashboard/page.tsx`)
- Admin authorization → Server client: creates client (evidence: `src/lib/auth/require-admin.ts`)
- Admin authorization → Supabase Auth and data: checks session and Profile (evidence: `src/lib/auth/require-admin.ts`)
- Admin → Profile: manages account (evidence: `README.md`)
- Profile → Profile actions: submits changes (evidence: `src/app/(admin)/profile/page.tsx`)
- Profile actions → Server client: uses server client (evidence: `src/features/admin/profile/actions.ts`)
- Admin → Event pages: manages Drafts (evidence: `README.md`)
- Event pages → Draft service: loads Drafts (evidence: `src/app/(admin)/events/page.tsx`)
- Event pages → Draft editor: renders editor
- Draft editor → Draft actions: submits changes (evidence: `src/features/admin/events/draft-form.tsx`)
- Draft actions → Draft service: delegates Draft operations
- Draft service → Admin authorization: requires Admin (evidence: `src/lib/events/drafts.ts`)
- Draft service → Server client: queries events (evidence: `src/lib/events/drafts.ts`)
- Draft service → Draft validation: validates input (evidence: `src/lib/events/drafts.ts`)
- Trial operator → Qualification page: opens trial (evidence: `README.md`)
- Qualification page → Trial interface: renders harness (evidence: `src/app/qualification/iphone-print/page.tsx`)
- Trial interface → Device camera: captures video (evidence: `src/features/qualification/QualificationClient.tsx`)
- Trial interface → Image preparation: prepares print image (evidence: `src/features/qualification/QualificationClient.tsx`)
- Trial interface → Print session: runs print trial (evidence: `src/features/qualification/QualificationClient.tsx`)
- Trial interface → Trial state: updates trial state (evidence: `src/features/qualification/QualificationClient.tsx`)
- Trial interface → Trial log: records trial events (evidence: `src/features/qualification/QualificationClient.tsx`)
- Print session → Image preparation: validates JPEG (evidence: `src/features/qualification/instax/session.ts`)
- Print session → Bluetooth transport: exchanges printer data (evidence: `src/features/qualification/instax/session.ts`)
- Bluetooth transport → Printer protocol: uses protocol (evidence: `src/features/qualification/instax/bluetooth.ts`)
- Bluetooth transport → Instax Mini Link 3: communicates over Bluetooth
