How andhikaliff/bengkelmakan works
Bengkel Makan is a local SQLite-backed canteen meal-quota management system. Its central workflow is employee directory management, QR scanning with daily duplicate validation, and transaction monitoring/export. Admin, data, and scanner roles govern access; audit logging and configurable scanner/dashboard settings support operations. The README documents major capabilities not fully represented in sampled source; those areas are included where paths are known, with uncertain links omitted. The graph reflects only shown calls and documented relationships.
Main entry points: sheets.ts Canteen data operations · audit.ts Audit recording · auth.ts Role and sessions · route.ts Scheduled reports
Components 33
Access & Shell
- Login screen
src/app/admin/login/page.tsx - Login API
src/app/api/login/route.ts - Role and sessions
src/lib/auth.ts - Route protection
src/middleware.ts - Edge session checks
src/lib/auth-edge.ts - Navigation shell
src/components/Navbar.tsx - Inline icons
src/components/Icons.tsx - Current role hook
src/lib/use-current-role.ts - Sidebar navigation
src/components/Sidebar.tsx
Canteen Operations
- Employee directory
src/app/admin/employees/page.tsx - Employee APIs
src/app/api/employees/route.ts - Bulk employee API
src/app/api/employees/bulk/route.ts - Employee status API
src/app/api/employees/toggle-status/route.ts - QR scanner
src/app/scanner/page.tsx - Scan validation API
src/app/api/scan/route.ts - Scanner dialog
src/components/ScannerModal.tsx
Data & Reporting
- Dashboard and transactions
src/app/admin/dashboard/page.tsx - Transaction API
src/app/api/transactions/route.ts - Quota reset API
src/app/api/reset/route.ts - Excel export API
src/app/api/export/excel/route.ts - Workbook builder
src/lib/excel.ts - Scheduled reports
src/app/api/cron/send-report/route.ts - Email delivery
src/lib/mailer.ts - Canteen data operations
src/lib/sheets.ts - SQLite database access
src/lib/db.ts - Data operation lock
src/lib/mutex.ts
Settings & Audit
- Audit log screen
src/app/admin/audit-logs/page.tsx - Audit log API
src/app/api/audit-logs/route.ts - Audit recording
src/lib/audit.ts - Settings panel
src/components/SettingsModal.tsx - User settings
src/lib/use-settings.ts
Other components
- Admin or staff
- Canteen scanner
Connections 40
- Admin or staff → Login screen: opens
- Login screen → Login API: submits credentials
- Login API → Role and sessions: verifies and creates session
src/app/api/login/route.ts - Login API → Audit recording: records login
src/app/api/login/route.ts - Route protection → Edge session checks: checks sessions
src/middleware.ts - Admin or staff → Employee directory: manages employees
- Employee directory → Employee APIs: requests directory actions
- Employee APIs → Role and sessions: requires role
src/app/api/employees/route.ts - Employee APIs → Canteen data operations: reads and changes employees
src/app/api/employees/route.ts - Employee APIs → Audit recording: records changes
src/app/api/employees/route.ts - Bulk employee API → Canteen data operations: adds employees
src/app/api/employees/bulk/route.ts - Employee status API → Canteen data operations: changes status
src/app/api/employees/toggle-status/route.ts - Canteen scanner → QR scanner: scans QR codes
- QR scanner → Scan validation API: submits scans
- Scan validation API → Canteen data operations: validates scan
src/app/api/scan/route.ts - Scan validation API → Role and sessions: checks role
src/app/api/scan/route.ts - Dashboard and transactions → Transaction API: loads transactions
- Transaction API → Role and sessions: requires role
src/app/api/transactions/route.ts - Transaction API → Canteen data operations: fetches transactions
src/app/api/transactions/route.ts - Quota reset API → Canteen data operations: resets daily quota
src/app/api/reset/route.ts - Quota reset API → Audit recording: records reset
src/app/api/reset/route.ts - Excel export API → Workbook builder: builds workbook
src/app/api/export/excel/route.ts - Scheduled reports → Canteen data operations: fetches transactions
src/app/api/cron/send-report/route.ts - Scheduled reports → Workbook builder: builds attachment
src/app/api/cron/send-report/route.ts - Scheduled reports → Email delivery: sends report
src/app/api/cron/send-report/route.ts - Scheduled reports → Audit recording: records report outcome
src/app/api/cron/send-report/route.ts - Canteen data operations → SQLite database access: queries database
src/lib/sheets.ts - Canteen data operations → Data operation lock: serializes operations
src/lib/sheets.ts - Audit recording → SQLite database access: persists audit events
src/lib/audit.ts - Audit log API → Role and sessions: requires role
src/app/api/audit-logs/route.ts - Audit log API → SQLite database access: reads audit records
src/app/api/audit-logs/route.ts - Admin or staff → Audit log screen: reviews activity
- Settings panel → User settings: reads and updates settings
src/components/SettingsModal.tsx - Navigation shell → Settings panel: opens settings
src/components/Navbar.tsx - Navigation shell → Current role hook: gets current role
src/components/Navbar.tsx - Navigation shell → Inline icons: renders icons
src/components/Navbar.tsx - QR scanner → User settings: uses scanner settings
src/app/scanner/page.tsx - QR scanner → Scanner dialog: opens scan dialog
- Sidebar navigation → Inline icons: renders icons
src/components/Sidebar.tsx - Sidebar navigation → Current role hook: gets current role
src/components/Sidebar.tsx