Skip to content

← Back to DWS Receipts

DWS Receipts is a Next.js 15 App Router application with Supabase backend. The app runs as a single deployment serving both employees and admins with role-based access control.

LayerTechnology
FrameworkNext.js 15 (App Router) + React 19
LanguageTypeScript (strict mode)
DatabaseSupabase Postgres
AuthSupabase SMS OTP (Twilio)
StorageSupabase Storage
OCRBAML + GPT-4.1-nano (OpenRouter)
UIshadcn/ui + Tailwind CSS 4
IconsLucide React
StateTanStack React Query
dws-app/
├── src/
│ ├── app/ # Next.js App Router
│ │ ├── api/ # API routes
│ │ │ ├── auth/ # OTP endpoints
│ │ │ ├── receipts/ # Receipt CRUD + OCR
│ │ │ ├── admin/ # Admin-only endpoints
│ │ │ └── categories/ # Category lookup
│ │ ├── login/ # Login page
│ │ ├── employee/ # Employee portal
│ │ ├── dashboard/ # Admin dashboard
│ │ ├── batch-review/ # Batch approval UI
│ │ └── users/ # User management
│ ├── components/ # React components
│ │ ├── ui/ # shadcn/ui primitives
│ │ └── providers/ # Context providers
│ ├── hooks/ # Custom React hooks
│ └── lib/ # Utilities & Supabase clients
├── baml_src/ # BAML AI definitions
└── baml_client/ # Generated BAML client
Browser → Next.js API Route → Supabase Client → Postgres
Supabase Storage (images)
BAML → OpenRouter → GPT-4.1-nano (OCR)
ClientFilePurpose
Browserlib/supabaseClient.tsClient-side operations
Serverlib/supabaseServerClient.tsAPI routes with cookies
Adminlib/supabaseAdminClient.tsBypasses RLS

See Database for details.

Receipt images use temporary storage during OCR, then move to permanent location. See Receipts.

Users have role in user_profiles table (employee or admin). See Authentication.