How team-2-sweet-creatures/team-2-gunita-kopi works
Gunita Kopi is a coffee-shop POS and inventory system. Baristas browse the catalog, build and check out orders, and can continue offline with local order storage and later sync; owners manage products, recipe costing, stock, staff, suppliers, and reports. Both web areas use server-side session/API handlers that dispatch to the backend, where role checks, route handlers, domain services, and Supabase-backed data access enforce business operations. The README documents offline sync and reporting capabilities, though their detailed implementation paths were not sampled; links to those branches are therefore conservative.
Main entry points: routes API routes · supabase-user.ts Supabase and RLS · session-server.ts Session handling · api-client.ts Staff API client
Components 29
Web experiences
- Owner portal
src/app/(owner)/admin/(app) - Barista POS
src/app/(staff)/staff/(pos) - Owner server proxy
src/owner/lib/session-handlers.ts - Staff server proxy
src/staff/lib/session-handlers.ts - Owner API client
src/owner/lib/api-client.ts - Staff API client
src/staff/lib/api-client.ts - POS checkout
src/staff/features/pos/checkout.ts - Owner sign-in
src/app/(owner)/admin/(auth) - Staff sign-in
src/app/(staff)/staff/(auth)
Backend operations
- API dispatcher
src/server/dispatch.ts - API routes
src/server/routes - Request validation
src/server/lib/request.ts - API responses
src/server/lib/response.ts - API contracts
src/contracts
Business domains
- Orders
src/server/modules/orders/service.ts - Products and costing
src/server/modules/products/service.ts - Ingredients and stock
src/server/modules/ingredients/service.ts - Suppliers
src/server/modules/suppliers/service.ts - Reports and dashboard
src/server/modules/reports/service.ts - Users and employees
src/server/modules/users/service.ts
Offline POS
- Order sync
src/server/modules/sync/service.ts - Offline order outbox
src/staff/offline/outbox.ts - Offline sync client
src/staff/offline/sync.ts
Identity and data
- Role authorization
src/server/lib/auth.ts - Session handling
src/auth/session-server.ts - Supabase and RLS
src/server/lib/supabase-user.ts
Other components
- Shop owner
- Barista
- Supabase Auth
Connections 34
- Shop owner → Owner portal: manages
- Barista → Barista POS: takes orders
- Owner portal → Owner API client: requests data
- Barista POS → Staff API client: requests data
- Owner API client → Owner server proxy: calls server API
- Staff API client → Staff server proxy: calls server API
- Owner server proxy → API dispatcher: dispatches in process
src/owner/lib/session-handlers.ts - Staff server proxy → API dispatcher: dispatches in process
src/staff/lib/session-handlers.ts - API dispatcher → API routes: routes requests
src/server/dispatch.ts - API routes → Role authorization: checks roles
src/server/routes/orders/route.ts - API routes → Request validation: parses input
src/server/routes/orders/route.ts - API routes → API responses: wraps results
src/server/routes/orders/route.ts - API routes → Orders: calls checkout
src/server/routes/orders/route.ts - API routes → Products and costing: calls product service
src/server/routes/products/route.ts - API routes → Ingredients and stock: calls ingredient service
src/server/routes/ingredients/route.ts - API routes → Ingredients and stock: records stock
src/server/routes/stock-transactions/route.ts - API routes → API contracts: validates against
src/server/routes/orders/route.ts - API routes → Suppliers: calls supplier service
src/server/routes/suppliers/route.ts - API routes → Reports and dashboard: serves reporting
- API routes → Users and employees: serves user admin
src/server/routes/users/route.ts - API routes → Order sync: dispatches sync
src/server/routes/sync/route.ts - POS checkout → Staff API client: submits orders
- POS checkout → Offline order outbox: saves offline
- Offline sync client → Offline order outbox: reads pending orders
- Offline sync client → Staff API client: sends sync request
- Session handling → API dispatcher: uses API handler
src/owner/lib/session-handlers.ts - Session handling → Supabase Auth: authenticates users
- Role authorization → Supabase and RLS: verifies and scopes access
src/server/lib/auth.ts - Orders → Supabase and RLS: reads and writes data
- Products and costing → Supabase and RLS: reads and writes data
- Ingredients and stock → Supabase and RLS: reads and writes data
- Order sync → Supabase and RLS: applies synced orders
- Owner sign-in → Session handling: uses sign-in handlers
- Staff sign-in → Session handling: uses sign-in handlers