I built a production order management system for a multi-brand product company — custom catalog, payment processing, CRM sync, and 322 automated tests.
Building an AI-Powered Order System from Scratch
The Problem
A multi-brand product company needed an order system. They were managing orders across spreadsheets, emails, and a patchwork of tools that didn't talk to each other. Sales reps at trade shows were writing orders on paper. Pricing was inconsistent. Nothing synced to their CRM automatically.
They didn't need a generic e-commerce platform. They needed something purpose-built for how they actually sell — wholesale accounts, tiered pricing, in-person kiosk ordering at trade shows, and a sales team that needed to move fast.
I'd been operating in this space long enough to know that off-the-shelf tools would get them 70% of the way there and then slowly drown them in workarounds for the last 30%. So I built it from scratch.
What I Built
Custom Product Catalog
The catalog system follows a hierarchy: collections, product lines, and product variants. This mirrors how the business actually thinks about their products — not how a database would organize them. A daily sync job automatically upserts catalog data so the product information stays current without manual intervention.
Multi-Tier Pricing
Three pricing tiers: wholesale, sub-distributor, and distributor. Not every product has every tier. The system knows which products support which pricing levels and applies the right price automatically based on the customer's account type. This alone eliminated a category of order errors that was costing the company real money.
Payment Processing
Integrated directly with a merchant payment gateway — not Stripe, not a plug-and-play checkout widget. A real gateway integration with tokenized payments, vault storage for returning customers, and capture-on-fulfillment workflows.
CRM Sync
Every order automatically creates or updates a Salesforce opportunity. Drafts start as "Quoted." Captured orders move to "Closed Won." The sales team never has to double-enter data.
Kiosk Mode
At trade shows, the sales team pulls up the system on a tablet. A streamlined flow: welcome screen, customer lookup or creation, product selection, review, payment, done. No training needed. No paper forms. Orders hit the CRM before the rep walks to the next booth.
The Stack
- Next.js + TypeScript — Full-stack framework with API routes
- Neon Postgres — Serverless database with connection pooling
- Custom Payment Gateway — Direct API integration with tokenization
- Salesforce API — Bi-directional sync for opportunities and accounts
- Vercel — Deployment with edge functions and cron jobs
322 Tests and Why That Matters
The system has 322 automated tests across 20 test files. Analytics, authentication, background jobs, logging, permissions, rate limiting, Salesforce integration, email notifications, payment capture, bulk operations, inventory management, cancellation flows, cart logic, order items, and catalog snapshots.
Every one of those tests exists because I've seen what happens when order systems break in production. A payment captures twice. A price calculates wrong. A CRM sync silently fails and the sales team loses a week of data.
Testing isn't about code coverage percentages. It's about knowing where the bodies are buried and making sure they stay buried.
The Result
The system went live and processed its first order successfully. It's running in production today — not as a prototype, not as an MVP, but as the actual system the team uses to run their business.
