How mellowmir94/gfo-preorder-system works
GFO Pre-Order System is a mobile-first storefront and admin tool for managing shirt preorder batches and orders. Customers check batch availability, choose sizes and delivery, submit contact details and payment receipt, then receive an order confirmation; admins manage batches and orders, verify payment, and provide official receipts. The sampled code supports the checkout, capacity checks, receipt storage, Telegram notification, admin management, and token-protected paid receipts. Some admin UI/API behavior is only described by filenames or partial excerpts, so uncertain wiring is omitted.
Main entry points: db.ts Supabase access · route.ts Order submission · admin/page.tsx Order and batch console · app/page.tsx Order storefront
Components 20
Customer storefront
- Order storefront
app/page.tsx - Batch availability
app/api/preorder/route.ts
Order processing
- Order submission
app/api/orders/route.ts - Pricing rules
lib/config.ts - Order notification
lib/telegram.ts - Paid receipt page
app/receipt/[orderNumber]/page.tsx - Receipt print control
app/receipt/[orderNumber]/PrintButton.tsx
Admin management
- Admin login
app/login/page.tsx - Order and batch console
app/admin/page.tsx - Order listing API
app/api/admin/orders/route.ts - Order update API
app/api/admin/orders/[id]/route.ts - Batch management API
app/api/admin/preorder/route.ts - Receipt access API
app/api/admin/orders/[id]/receipt/route.ts
External services
- Supabase access
lib/db.ts - Orders and batches
- Receipt bucket
- Supabase Auth
- Telegram Bot API
Other components
- Customer
- Admin
Connections 28
- Customer → Order storefront: opens
- Order storefront → Batch availability: checks availability
- Batch availability → Supabase access: queries batch capacity
- Supabase access → Orders and batches: reads
- Order storefront → Order submission: submits order
- Order submission → Supabase access: queries and writes
- Order submission → Pricing rules: calculates total
- Order submission → Receipt bucket: uploads receipt
- Order submission → Order notification: notifies
- Order notification → Telegram Bot API: sends message
- Admin → Admin login: signs in
- Admin login → Supabase Auth: authenticates
- Admin → Order and batch console: manages
- Order and batch console → Order listing API: loads orders
- Order and batch console → Order update API: updates orders
- Order and batch console → Batch management API: manages batches
- Order and batch console → Receipt access API: opens receipt
- Order listing API → Supabase access: reads orders
- Order update API → Supabase access: updates orders
- Order update API → Pricing rules: recalculates items
- Batch management API → Supabase access: manages batches
- Receipt access API → Supabase access: looks up order
- Receipt access API → Receipt bucket: creates signed link
- Supabase access → Supabase Auth: checks admin
- Customer → Paid receipt page: opens receipt
- Paid receipt page → Supabase access: loads paid order
- Paid receipt page → Receipt print control: renders print control
- Supabase access → Orders and batches: reads and writes