How yandihanid/yandihan-app works
Purpose and Runtime
Yandihan Kasir is a Next.js App Router cashier/POS application with public checkout links, merchant dashboard management, payments, customer/loyalty support, receipts, and reporting. It runs as a Node/Next.js web application and can be packaged for Android through Capacitor.
• app/layout.js
• app/page.js
• package.json
• capacitor.config.ts
User-Facing Entry Points
The root page, login/signup, and guide establish the public web entry flow. Authenticated merchant functionality is grouped under the dashboard layout. Tokenized cashier pages appear intended for customer- or cashier-specific transaction entry, while receipt URLs expose a printable transaction result.
• app/login/page.js
• app/signup/page.js
• app/dashboard/layout.js
• app/c/[token]/page.js
• app/r/[id]/page.js
Cashier and Transaction Flow
The tokenized cashier route contains the transaction UI, cashier actions, and a waiting-list view. Its client flow calls the cashier API, then payment APIs for payment creation and verification. Payment webhook handling forms the asynchronous external-provider boundary; downstream transaction updates can be reflected on the dashboard in real time.
• app/c/[token]/CashierForm.js
• app/c/[token]/actions.js
• app/api/cashier/route.js
• app/api/payment/route.js
• app/api/payment/verify/route.js
• app/api/payment/webhook/route.js
• app/dashboard/RealtimeTransactions.js
Merchant Operations and Reporting
The dashboard is the merchant control plane: overview, transaction reporting, product management, customer management, cashier assignment, and store/receipt settings. Server-side action modules sit alongside dashboard forms, separating interactive administration from API endpoints.
• app/dashboard/page.js
• app/dashboard/laporan/page.js
• app/dashboard/produk/page.js
• app/dashboard/produk/actions.js
• app/dashboard/pelanggan/page.js
• app/dashboard/settings/actions.js
Data and Service Boundary
Supabase is the persistence and likely authentication/backend service boundary, accessed through separate browser, server, and privileged service clients. API routes provide controlled HTTP access for customers, store state, pricing, and settings. The loyalty-customer migration indicates schema evolution is stored with the repository.
• utils/supabase/client.js
• utils/supabase/server.js
• utils/supabase/service.js
• supabase/migrations/add_loyalty_customers.sql
• app/api/pelanggan/route.js
• app/api/store/my/route.js
Payments, Pricing, and Subscription Concerns
Payment lifecycle endpoints isolate initiation, verification, and provider callbacks. Pricing is represented both as API data and shared constants/UI, while the dashboard includes an upgrade prompt. The concrete payment provider is not identifiable from the supplied tree.
• app/api/payment/route.js
• app/api/payment/verify/route.js
• app/api/payment/webhook/route.js
• app/api/pricing/route.js
• lib/pricingConstants.js
• app/dashboard/UpgradeBanner.js
Integrations and Delivery Surfaces
Telegram is an inbound webhook integration. The web app includes manifest and service-worker assets for installable/offline-oriented browser delivery. Capacitor wraps the web bundle in a native Android host whose entry activity loads the Capacitor application.
• app/api/telegram/webhook/route.js
• public/manifest.json
• public/sw.js
• android/app/src/main/java/com/yandihan/kasir/MainActivity.java
• android/app/src/main/AndroidManifest.xml
Main entry points: server.js Supabase backend · dashboard/layout.js Dashboard shell · app/layout.js App shell · route.js Payment lifecycle
Components 20
Next.js Web App
Public, cashier, and merchant App Router surfaces.
- App shell
app/layout.js - Public entry · Links users into sign-in and merchant flows.
app/page.js - Login & signup
app/login/page.js - Tokenized cashier · Transaction entry is scoped by a cashier token.
app/c/[token]/page.js - Cashier transaction UI
app/c/[token]/CashierForm.js - Printable receipt
app/r/[id]/page.js
Merchant Dashboard
Authenticated operations and reporting.
- Dashboard shell
app/dashboard/layout.js - Dashboard overview
app/dashboard/page.js - Transaction reports
app/dashboard/laporan/page.js - Product management · Uses colocated server actions for catalog changes.
app/dashboard/produk/actions.js - Customer management
app/dashboard/pelanggan/page.js - Realtime transactions · Reflects downstream transaction updates.
app/dashboard/RealtimeTransactions.js
Backend Services
HTTP boundaries and Supabase-backed state.
- Cashier API
app/api/cashier/route.js - Payment lifecycle · Creates and verifies payments; receives provider callbacks.
app/api/payment/route.js - Merchant state APIs · Controlled access to customer and store state.
app/api/pelanggan/route.js - Supabase backend · Browser, server, and privileged clients access the backend.
utils/supabase/server.js
External & Delivery
Provider callbacks and installable/native delivery.
- Payment provider · Concrete provider is not identified.
- Telegram webhook
app/api/telegram/webhook/route.js - PWA delivery · Installable browser delivery surface.
public/manifest.json - Android host · Native wrapper loads the Capacitor application.
android/app/src/main/java/com/yandihan/kasir/MainActivity.java
Connections 23
- App shell → Public entry: renders
- Public entry → Login & signup: sign-in flow
- App shell → Tokenized cashier: serves
- Tokenized cashier → Cashier transaction UI: hosts
- Cashier transaction UI → Cashier API: submits transaction
- Cashier transaction UI → Payment lifecycle: initiates payment
- Payment lifecycle → Payment provider: creates/verifies
- Payment provider → Payment lifecycle: webhook callback
- Cashier API → Supabase backend: reads/writes
- Payment lifecycle → Supabase backend: updates transaction
- Supabase backend → Realtime transactions: transaction updates
- Dashboard shell → Dashboard overview: contains
- Dashboard shell → Transaction reports: contains
- Dashboard shell → Product management: contains
- Dashboard shell → Customer management: contains
- Dashboard overview → Realtime transactions: shows
- Product management → Supabase backend: manages catalog
- Customer management → Merchant state APIs: uses
- Merchant state APIs → Supabase backend: accesses state
- Cashier API → Printable receipt: produces transaction
- Telegram webhook → Supabase backend: processes inbound events
- PWA delivery → App shell: installs web app
- Android host → App shell: wraps web bundle