Paform extends the Vector Institute MVP template with a FastAPI backend and a Next.js frontend. It maintains strict decoupling between persistence, domain logic, and API boundaries.
- Framework: FastAPI
- Persistence: SQLAlchemy 2.x + Alembic
- API Schemas: Pydantic v2 (DTOs) with
ConfigDict(from_attributes=True) - Core services (pure, framework-agnostic):
- Pricing Service: quote calculation using module dimensions and material surface area costs
- CNC Service: naive panelization for MVP
- Hygraph Service: webhook signature verification and idempotency
Material: name, texture_url, cost_per_sq_ft, external_ids (JSONB), timestampsModule: name, dimensions (width, height, depth), base_price, material_id, assembly_attributes, placement_constraints, connection_points, external_ids, timestamps- Order lifecycle tables (see below) capture the conversion funnel from quote acceptance through production handoff and payment capture.
- Quote acceptance – a confirmed quote spawns an
ordersrecord that freezes commercial terms (subtotal,tax,total, currency) and the buyer contact. - Line-item normalization –
order_line_itemsstore each configured module with derived pricing metadata, decoupling repeatable catalog data from order-specific adjustments (discounts, finish overrides, shipping promises). - Status tracking – every state transition (
draft → pending_payment → design_review → production_ready → fulfilled/cancelled) is appended toorder_status_eventswith actor metadata, making the audit trail queryable without denormalizing theorderstable. - Design collaboration – orders that require custom work spawn
design_requeststied to the order (and optionally a specific line item). Each design request accumulates iterative assets indesign_versionsanddesign_assets(GLB, DXF, annotated PDFs) so the CAD pipeline can fetch the latest approved deliverable. - Payment orchestration –
paymentsrepresent the buyer’s financial obligations (deposit, balance, change order) and are linked topayment_transactionsthat mirror gateway intents/charges. Refunds and chargebacks are recorded inpayment_adjustments, preserving immutable accounting while letting finance reconcile multiple providers. - Downstream hooks – once an order is marked
production_ready, event consumers enqueue manufacturing and logistics jobs using the normalized identifiers rather than scraping payload blobs.
Note
The source diagram lives in docs/assets/order-lifecycle-er.drawio and is
exported to SVG automatically by build-docs.sh when Draw.io CLI tooling is
available.
GET /api/materials, CRUDGET /api/modules, CRUDPOST /api/quote/generatePOST /api/v1/exports/cnc– generates CNC panels and returns S3 metadata (bucket,key, presignedurl,content_type) for the cut list CSV and nesting SVG artifacts.POST /api/sync/hygraph
- Next.js (App Router), Chakra UI, Zustand state
- 3D: React Three Fiber + Drei
- API client abstracts backend calls
- Components:
Viewer3D: loads GLB with Draco and SuspenseConfiguratorPanel,MaterialSelector
- GLB files adhere to
GLB_ASSET_STANDARD.md(node naming, material slots, metadata, LOD)
- Backend: Pytest unit tests for services and route tests with TestClient
- Frontend: Add Jest/RTL (future step)
- Docker Compose for dev/prod; SQLite dev, PostgreSQL prod (optional)