# Independent retailers: product catalog using Django

A product catalog blueprint for independent retailers built with Django on Ample.

## Domain Schema
- **Products**: (sku, name, category, price, active) - the SKU catalog.  
- **Stock Movements**: (sku, location, delta, reason, moved_at) - receipts, sales, and adjustments.  
- **Orders**: (order_no, customer_reference, status, placed_at) - orders with status transitions.  
- **Order Lines**: (order_no, sku, qty, unit_price) - order contents.  
- **Events**: (seq, record_type, record_id, kind, at) - application-owned history written in the same transaction.

### Public Information
- Product catalog and availability  
- Store locations and hours  
- Returns policy

### Technical Basis Verified on Django
- 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
- Independent retailers: product catalog using Django  
- Where can I host Independent retailers: Product catalog built with Django?  
- I need a genuinely specialized product catalog workflow covering SKU catalog, stock movements and order statuses.

## Resource Requirements
- **Compute**: primitive:compute  
- **Postgres**: primitive:postgres  
- **S3-compatible Object Storage**: primitive:s3-compatible-object-storage

## Infrastructure Requirements
- **Compute**:  
  - Status: verified  
  - Summary: Apps run in isolated x86_64 Firecracker microVMs that auto-pause when idle and wake on request; sizes are the priced VM sizes.

- **Postgres**:  
  - Status: verified  
  - Summary: 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**:  
  - Status: verified  
  - Summary: Buckets are S3-compatible with issued credentials.

## Prerequisites
- A Django project (pip install into .ample/python from requirements.txt, then waitress serving project.wsgi from run.py reading PORT on the python-3.12 template)  
- A PostgreSQL driver reading DATABASE_URL (auto-provisioned when omitted)  
- Bucket credentials from `ample bucket create` passed as encrypted S3_* environment variables  
- Review of which independent retailers data classes may be handled at all; this blueprint models public information only.

## Workflow Steps
1. Model the independent retailers domain: Create the tables products, stock_movements, orders, order_lines, events.  
2. Model the SKU catalog with versioned updates.  
3. Record every catalog change as an event in the same transaction.  
4. Reject stale concurrent updates.  
5. Deploy and verify history and conflict handling.  
6. Run the synchronous deploy once and read the result. Re-running with no change is a no-op.

## Cost Estimate
- **Currency**: USD  
- **Monthly Amount**: 10.0  
- **Components**:  
  - App server: size s-1vcpu-1gb, quantity 1.0, monthly amount 5.0  
  - Managed PostgreSQL database: size s-1vcpu-1gb, quantity 1.0, monthly amount 5.0

## Limitations
- The independent retailers schema and workflow are an original design for this blueprint and were not executed as a separate application.  
- Public content and synthetic examples only until actual data-handling requirements have been reviewed.

## Evidence Summary
- **Summary**: Django pattern fixture deployed on Ample, the transactional workflows checks passed: an optimistic version check and an event row written in the same transaction.  
- **Observed At**: 2026-09-20T03:31:44Z  
- **Expires At**: 2027-03-19T03:31:44Z

## Formats
- **HTML**: [Independent retailers product catalog](/content/blueprints/independent-retailers/product-catalog/django/index.html)
- **Markdown**: [Independent retailers product catalog](/content/blueprints/independent-retailers/product-catalog/django.md)
- **JSON**: [Independent retailers product catalog](https://api.ample.computer/v1/catalog/recipes/page%3Ablueprints%3Aindependent-retailers%3Aproduct-catalog%3Adjango)
