← Dashboard
Section 02 of 14

The Database

What This Does

The database has 6 tables (called 'models' in Prisma). Session stores Shopify login info. Shop stores each merchant's settings and credentials. ProcessedOrder tracks every order we touch. ProcessedLineItem stores per-item customs values. AuditLog records everything that happens for compliance. BetaSignup is just a waitlist.

Why It Matters

Every important piece of data lives here. Understanding the database schema is understanding the entire data model of the app. If you know what fields exist on a ProcessedOrder, you understand what the pipeline actually does.

How It Works

  1. 1.When a merchant installs the app, a Session record is created (Shopify handles this) and a Shop record is created with default settings.
  2. 2.When an international order with an order-level discount comes in, a ProcessedOrder record is created with status PENDING.
  3. 3.As the pipeline processes the order, the ProcessedOrder is updated through statuses: PENDING → CALCULATING → PUSHING → VERIFYING → COMPLETED.
  4. 4.Each customs item correction is saved as a ProcessedLineItem with before/after values.
  5. 5.Every significant action creates an AuditLog entry — this is our compliance paper trail.
  6. 6.ShipStation API credentials are stored ENCRYPTED (never in plain text) in the Shop record.

The Code

Key Decisions

What Could Go Wrong