page:blueprints:restaurants:inventory manager:next js
Restaurants: Inventory Manager Using Next.js
Summary
A inventory manager blueprint for restaurants built with Next.js on Ample. Domain schema includes:
- menu_items (sku, name, section, price, allergens, active): the menu as a SKU catalog;
- stock_movements (sku, delta, reason, moved_at): ingredient and prepared-item stock;
- orders (order_no, service_type, status, placed_at): dine-in, pickup, and delivery orders;
- order_lines (order_no, sku, qty, modifiers): order contents;
- events (seq, record_type, record_id, kind, at): application-owned history written in the same transaction.
Public information includes menu with allergens and prices, locations, hours and reservations contact, catering information. Customer contact and payment details, as well as staff schedules, are kept out of scope until handling is reviewed. Allergen information must be kept accurate by the operator; nothing here validates food-safety claims.
Technical Basis
Verified on Next.js with features like optimistic version check, event row written in the same transaction, stale update rejection, and history query over the application-owned events (history=2 conflict=rejected).
Infrastructure Requirements
- Compute: Applications run in isolated x86_64 Firecracker microVMs.
- Postgres: Managed PostgreSQL 16 runs in its microVM and auto-provisioned when an app needs a database.
- S3-compatible object storage: Buckets are S3-compatible with issued credentials.
Workflow Steps
- Model the restaurants domain by creating the tables for menu_items, stock_movements, orders, order_lines, and events. Keep sensitive classes out of this schema.
- Apply movements transactionally with an optimistic version check on the SKU.
- Record an event per movement for history.
- Deploy and verify history and rejected stale updates.
- Run the synchronous deploy once and read the result.
- Verify the pattern self-test(s) and your own acceptance checks for the restaurants workflow.
Limitations
- The restaurant schema and workflow are original designs and were not executed as separate applications.
- No claims made regarding health, financial, or privacy compliance. Public content until actual data-handling requirements have been reviewed.
Cost Estimate
- Monthly Amount: $10.00
- App server: $5.00
- Managed PostgreSQL database: $5.00
- Note: Always-on monthly price; apps and databases auto-pause when idle.
Success Checks
- App Response: App responds on its public URL.
- Transactional Workflows Self-Test: Verified by running specified endpoints.
Next Actions
- Browse the catalog index.
- Search published recipes.
- Prepare a deployment plan for the authorized project.