# Wholesale distributors: Order Tracking Using Django

## Summary
A order tracking blueprint for wholesale distributors built with Django on Ample.

### Domain Schema:
- **products** (sku, name, category, case_size, list_price, active): SKU catalog with case sizes
- **stock_movements** (sku, warehouse, delta, reason, moved_at): receipts, picks and adjustments
- **orders** (order_no, account_reference, status, placed_at): trade orders with status transitions
- **order_lines** (order_no, sku, cases, unit_price): order contents
- **events** (seq, record_type, record_id, kind, at): application-owned history written in the same transaction.

### Public Information:
- Catalog with case sizes, minimum order and delivery terms, trade account application.

### Kept Out of Scope:
- Account pricing tiers, credit terms, delivery addresses. Account-specific pricing and credit terms are confidential; the catalog shown publicly carries list prices only.

### Technical Basis:
- Verified on Django
  - An optimistic version check
  - An event row written in the same transaction
  - A stale update rejected
  - A history query over the application-owned events (history=2 conflict=rejected).

## Representative Queries
- Wholesale distributors: order tracking using Django
- Where can I host Wholesale distributors: Order tracking built with Django?
- I need a genuinely specialized order tracking workflow covering case-pack units, B2B catalog visibility and volume order imports.

## Resource Requirements
- **Compute**
- **Postgres**
- **S3-compatible object storage**

## Infrastructure Requirements
- ### Compute
  Apps run in isolated x86_64 Firecracker microVMs that auto-pause when idle and wake on request; sizes are the priced VM sizes.
- ### Postgres
  Managed PostgreSQL 16 runs in its own microVM and is auto-provisioned when an app needs a database and no DATABASE_URL is supplied.
- ### S3-compatible Object Storage
  Buckets are S3-compatible with issued credentials; PutObject and GetObject are verified by canary. Other S3 operations are not verified.

## Workflow Steps
1. Model the wholesale distributors domain
   - Create the tables products, stock_movements, orders, order_lines, events.
   - SKU catalog with case sizes lives in products; keep the sensitive classes (account pricing tiers, credit terms, delivery addresses) out of this schema.
2. Model orders with explicit status transitions and order lines
3. Apply status changes transactionally and record an event per change
4. Expose status history to authorized callers only
5. Deploy and verify history and conflict rejection
6. Run the synchronous deploy once and read the result. Re-running with no change is a no-op.
7. Run the pattern self-test(s) and your own acceptance checks for the wholesale distributors workflow.

## Examples
### Django Pattern Fixture
- Verified transactional workflows basis for this blueprint.

## Success Checks
- App responds on its public URL
- Transactional-workflows self-test from the example

## Limitations
- The technical basis (transactional workflows on Django) was verified with the pattern fixture; the wholesale distributors 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. Account-specific pricing and credit terms are confidential; the catalog shown publicly carries list prices only.
- Public content and synthetic examples only until actual data-handling requirements have been reviewed.

## Cost Estimate
- **Currency**: USD
- **Monthly Amount**: 10.0
- **Basis**: size prices from pricing.toml
- **Components**:
  - App server (s-1vcpu-1gb): $5.0
  - Managed PostgreSQL database (s-1vcpu-1gb): $5.0
- **Note**: Always-on monthly price of the tested sizes; apps and databases auto-pause when idle.

## Evidence Summary
- Detailed canary run summary including pattern transactional workflows verified. Last verified on 2026-09-20.

## Next Actions
- Browse the catalog index
- Search published recipes by intent, stack, and constraints
- Prepare a side-effect-free deployment plan for an authorized project
- Read the existing agent authentication setup
- Browse Wholesale distributors
- Browse Order tracking
- Browse Django
- Browse Deploy web app

---
