Touchscreen kiosk that tracks the 48 compartments of a workshop toolbox (8 rows × 6 cols). A user taps a compartment, enters a 4-digit PIN, and records a take (−1) or return (+1).
Built with Next.js (App Router) + Tailwind + shadcn/ui, persisted to Supabase Postgres via Prisma (driver-adapter runtime). PINs are bcrypt-hashed.
- Next.js 16 (App Router, Turbopack)
- Tailwind v4 + shadcn/ui components
- IBM Plex Sans / Mono (via
next/font) - Prisma 7 +
@prisma/adapter-pgagainst Supabase Postgres bcryptjsfor PIN hashing, HMAC-SHA256 (PIN_LOOKUP_SECRET) for indexed lookupsonnerfor kiosk toasts
- Copy
.env.exampleto.envand fill in your Supabase connection strings.DATABASE_URL— pooled (port 6543)DIRECT_URL— direct (port 5432), used for migrationsPIN_LOOKUP_SECRET—openssl rand -hex 32
- Install deps and generate the Prisma client:
npm install npm run db:generate - Push the schema and seed the 48 default items + 2 demo users:
npm run db:push npm run db:seed - Run the app:
npm run dev
Demo PINs (from the prototype, seeded by prisma/seed.ts):
1211— Demo Utilizator (Tehnician)5356— Admin Operator (Administrator)
items— 48 rows, one per compartment (slot_index= 0..47)users— name, role, bcryptpin_hash, indexed HMACpin_lookuptransactions— every +1/−1 with item, user, type, qty, sessionsessions— kiosk auth sessions (start/end timestamps)audit_log— admin-side actionssettings— kv store for admin config
src/
app/
actions.ts server actions: getItems, verifyKioskPin, recordTransaction
page.tsx server entry — loads items, renders <KioskApp>
layout.tsx IBM Plex fonts + Sonner toaster
globals.css Tailwind + lab-aesthetic CSS vars
components/
kiosk/
kiosk-app.tsx state machine (grid → auth → tx)
grid-screen.tsx header + 8×6 compartment grid + footer clock
keypad.tsx PIN entry (touchscreen + keyboard)
transaction-screen.tsx greeting + −1/+1 buttons + session tape
compartment.tsx single tile w/ tier coloring
lib/
prisma.ts PrismaClient + pg adapter (singleton)
pin.ts bcrypt hash + HMAC lookup
i18n.ts Romanian copy + slot helpers
items-seed.ts 48 default items + 2 demo users
prisma/
schema.prisma
seed.ts
prisma.config.ts
- Admin panel (
/admin) — dashboard, transaction log, charts, user/item management, settings. The schema and the auth flow on the kiosk side already support it (admin-authview exists). - Realtime sync via Supabase Realtime channels (the kiosk polls items every 15s instead).
- Rate-limiting / lockout on repeated PIN failures.