How nguyenkhanhhungdev/brewlite-se works
BrewLite is a cashless drink-ordering application: customers browse and configure drinks, manage a cart, authenticate, place an order, pay through ZaloPay Sandbox, then review results and order history. Admins manage recipes and ingredients, track stock movements, progress orders, and review or reconcile payments. The README describes a REST API backed by PostgreSQL and transaction-based stock reservation. Some web-to-API and integration links below rely on README documentation; unsampled module internals are not asserted.
Main entry points: orders.service.ts Order placement · payments.service.ts Payment processing · admin-orders.controller.ts Admin order routes · auth.service.ts Authentication service
Components 26
Customer storefront
- Menu and product views
apps/web/app/page.tsx - Cart and preferences
apps/web/app/cart/page.tsx - Checkout
apps/web/app/checkout/page.tsx - Payment and order views
apps/web/app/payment/result/page.tsx - Order history
apps/web/app/history/page.tsx
Identity and access
- Sign-in and profile
apps/web/components/AuthForm.tsx - Authentication service
apps/api/src/auth/auth.service.ts - Authentication routes
apps/api/src/auth/auth.controller.ts - Session and admin guards
apps/api/src/auth/jwt-auth.guard.ts
Ordering and payment
- Order placement
apps/api/src/orders/orders.service.ts - Order state and cancellation
apps/api/src/orders/order-state.service.ts - Discount rules
apps/api/src/promotions/promotions.service.ts - Payment processing
apps/api/src/payments/payments.service.ts - Loyalty points
apps/api/src/loyalty/loyalty.service.ts
Catalog and inventory
- Product menu API
apps/api/src/products/products.service.ts - Recipe management
apps/api/src/recipes/recipes.service.ts - Ingredient inventory
apps/api/src/ingredients/ingredients.service.ts
Admin operations
- Admin order console
apps/web/components/admin/orders/OrdersManager.tsx - Admin inventory console
apps/web/components/admin/ingredients/IngredientManager.tsx - Admin recipe console
apps/web/components/admin/recipes/RecipeManager.tsx - Admin payment console
apps/web/components/admin/payments/PaymentsManager.tsx - Admin order routes
apps/api/src/orders/admin-orders.controller.ts - Admin payment routes
apps/api/src/payments/payment-operations.controller.ts
Other components
- Customer
- ZaloPay Sandbox
- PostgreSQL
Connections 28
- Customer → Menu and product views: browses menu
README.md - Menu and product views → Product menu API: requests menu
README.md - Customer → Cart and preferences: configures drinks
README.md - Cart and preferences → Checkout: proceeds to checkout
README.md - Customer → Sign-in and profile: signs in
README.md - Sign-in and profile → Authentication routes: submits credentials
README.md - Authentication routes → Authentication service: delegates authentication
apps/api/src/auth/auth.controller.ts - Authentication service → PostgreSQL: reads and updates users
apps/api/src/auth/auth.service.ts - Session and admin guards → Authentication service: checks session
apps/api/src/auth/jwt-auth.guard.ts - Checkout → Order placement: creates order
README.md - Order placement → Discount rules: applies discount
apps/api/src/orders/orders.service.ts - Order placement → Ingredient inventory: reserves stock
README.md - Order placement → PostgreSQL: persists order
README.md - Order placement → Payment processing: initiates payment
- Payment processing → ZaloPay Sandbox: starts or checks payment
README.md - ZaloPay Sandbox → Payment and order views: returns payment status
README.md - Payment processing → PostgreSQL: records transactions
README.md - Payment and order views → Order history: views confirmed orders
README.md - Payment processing → Loyalty points: awards points
README.md - Admin inventory console → Ingredient inventory: manages stock
README.md - Ingredient inventory → PostgreSQL: records movements
README.md - Admin recipe console → Recipe management: manages recipes
README.md - Recipe management → PostgreSQL: stores recipes
README.md - Admin order console → Admin order routes: manages orders
README.md - Admin order routes → Order placement: lists order records
apps/api/src/orders/admin-orders.controller.ts - Admin order routes → Order state and cancellation: changes order state
apps/api/src/orders/admin-orders.controller.ts - Admin payment console → Admin payment routes: reviews transactions
README.md - Admin payment routes → Payment processing: rechecks payments
apps/api/src/payments/payment-operations.controller.ts