Sage Hardware Orders — PocketBase Backend

Receives quote requests from the sage.is/hardware configurator.

Quick Start

  1. Download PocketBase for your platform from pocketbase.io/docs
  2. Place the binary in this directory
  3. Set your Resend API key:
    export RESEND_API_KEY="re_your_key_here"
  4. Start PocketBase:
    ./pocketbase serve --http=0.0.0.0:8090
  5. Visit http://localhost:8090/_/ to create your admin account
  6. The orders collection is created automatically via migration

DNS & CORS

Resend Email Setup

  1. Sign up at resend.com
  2. Verify your domain (sage.is) in Resend dashboard
  3. Create an API key
  4. Set RESEND_API_KEY environment variable before starting PocketBase
  5. Update the from and to addresses in pb_hooks/main.pb.js if needed

Order Flow

  1. User configures hardware on sage.is/hardware
  2. Clicks "Request a Quote" → enters name, email, optional org
  3. Frontend POSTs to pb.sage.is/api/collections/orders/records
  4. PocketBase generates an order number (e.g. K-212-483-9271) and saves the order
  5. Hook sends two emails via Resend:
    • Team notification to [email protected] with full config details and admin link
    • Customer confirmation to the submitter with their reference number and config summary
  6. Frontend displays the order number to the visitor
  7. Team reviews in PocketBase admin, follows up with a PO/contract

Collection: orders

Field Type Required Notes
order_number text no Auto-generated by hook (e.g. K-212-483-9271)
email email yes Customer email
name text yes Customer name
organization text no Company, school, etc.
config json yes Full configurator state
monthly_total number yes Calculated monthly price
annual_total number yes Calculated annual price (15% off)
status select yes new, contacted, quoted, signed, cancelled
notes text no Internal team notes

Phase 2

This PocketBase setup is temporary. The plan is to migrate to Django + Django Ninja with: