### Restaurants: Order Tracking Using Next.js

A order tracking blueprint for restaurants built with Next.js on Ample. Domain schema:

- **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: menu with allergens and prices, locations, hours and reservations contact, catering information.  
Kept out of scope until handling is reviewed: customer contact and payment details, staff schedules. Allergen information must be kept accurate by the operator; nothing here validates food-safety claims.

Technical basis verified on Next.js: an optimistic version check and an event row written in the same transaction, a stale update rejected, and a history query over the application-owned events (history=2 conflict=rejected).

#### Representative Queries  
- Restaurants: order tracking using Next.js  
- Where can I host Restaurants: Order tracking built with Next.js?  
- I need a genuinely specialized order tracking workflow covering menu availability, ingredient records and order status.

### Workflow Steps
1. **Model the restaurants domain**: 
   Create the tables menu_items, stock_movements, orders, order_lines, events. The menu as a SKU catalog lives in menu_items; keep the sensitive classes (customer contact and payment details, staff schedules) out of this schema.  
2. **Workflow step 1**:  
   Model orders with explicit status transitions and order lines.  
3. **Workflow step 2**:  
   Apply status changes transactionally and record an event per change.  
4. **Workflow step 3**:  
   Expose status history to authorized callers only.  
5. **Workflow step 4**:  
   Deploy and verify history and conflict rejection.  
6. **Deploy**:  
   Run the synchronous deploy once and read the result. Re-running with no change is a no-op.
   ```bash
   ample deploy . --name  --public --env S3_ENDPOINT=... --env S3_REGION=... --env S3_BUCKET=... --env S3_ACCESS_KEY_ID=... --env S3_SECRET_ACCESS_KEY=...
   ```  
7. **Verify**:  
   Run the pattern self-test(s) from the example (/p/transactional-workflows) and your own acceptance checks for the restaurants workflow.
   ```bash
   ample logs  --kind build
   ```

### Cost Estimate  
- Currency: USD  
- Monthly Amount: $10.00  
- Basis: size prices from pricing.toml (loaded by the API) at build revision 1ac5595375130d45290090e82ed0f554ccd45405-dirty  
- Components:  
  - **App server**:  
    - Size: s-1vcpu-1gb  
    - Monthly Amount: $5.00  
  - **Managed PostgreSQL database**:  
    - Size: s-1vcpu-1gb  
    - Monthly Amount: $5.00

### Limitations  
- The technical basis (transactional workflows on Next.js) was verified with the pattern fixture; the restaurants schema and workflow are an original design for this blueprint and were not executed as a separate application.  
- No health, financial, privacy or other compliance claim is made. Allergen information must be kept accurate by the operator; nothing here validates food-safety claims.  
- Verified on the node-22 template at s-1vcpu-1gb; region, request-duration limits and other sizes are unknown or unverified.  
- Managed PostgreSQL 16 only; extensions, connection limits and backup or restore procedures are not verified.  
- PutObject and GetObject with path-style addressing are verified; other S3 operations and CDN cache rules are not.

### Next Actions  
- **Browse the catalog index**: 
  - Method: GET  
  - Relative Path: /v1/catalog

- **Search published recipes by intent, stack and constraints**:  
  - Method: POST  
  - Relative Path: /v1/catalog/search

- **Prepare a side-effect-free deployment plan for an authorized project**:  
  - Method: POST  
  - Relative Path: /v1/catalog/plan

- **Read the existing agent authentication setup**:  
  - Method: GET  
  - Relative Path: /mcp/setup

- **Browse Restaurants**:  
  - Method: GET  
  - Relative Path: /v1/catalog/nodes/industry%3Arestaurants

- **Browse Order Tracking**:  
  - Method: GET  
  - Relative Path: /v1/catalog/nodes/workload%3Aorder-tracking

- **Browse Next.js**:  
  - Method: GET  
  - Relative Path: /v1/catalog/nodes/stack%3Aframework-next-js

- **Browse Deploy Web App**:  
  - Method: GET  
  - Relative Path: /v1/catalog/nodes/intent%3Adeploy-web-app

### Example  
- **Next.js pattern fixture:** Verified transactional workflows basis for this blueprint.
