Back 40 BBQ
Client: Back 40 BBQ
Challenge
Ryan and Holly were selling double-smoked pretzels out of a booth and a Wix site with no way to take an order online — and the "buy more, save more" pricing they sell on at vendor shows was something no off-the-shelf store could actually calculate
Solution
Built a complete ordering platform on Cloudflare Workers with a bespoke server-side bundle pricing engine, live Square catalog and card payments, and automated confirmation and notification email — then cut their domain over from Wix with a staged production runbook
Result
A live storefront at back40barbeque.com taking real card orders, with pricing calculated authoritatively on the server, discounts written back to Square's own order records, and 125 automated tests guarding the money paths
The Challenge
Ryan and Holly smoke pretzels twice — once to lock the seasoning in, once to push it all the way through — out of Holland, Michigan. They'd built a real following the hard way: vendor shows, farmers markets, church events, and word of mouth. What they didn't have was a way for any of those people to buy a bag on Monday morning.
Their existing site was a Wix page. It told the story reasonably well, but it couldn't take an order, and it couldn't be extended to. That alone would have been a straightforward build. The complication was their pricing.
Back 40 sells the way a booth sells: one 4oz bag is $8, two are $15, three are $22, four are $28 — and the same ladder exists separately for 8oz bags. Crucially, the discount is supposed to pool across flavors. A customer who buys one Garlic Parmesan 4oz and one Maple Bourbon 4oz has bought two 4oz bags and should pay $15, not $16. An order containing three 4oz bags and two 8oz bags should get both tier prices at once, in the same cart.
No hosted store platform calculates that. Off-the-shelf discount rules work per-product or per-cart-total, not per-size-across-products with independent simultaneous ladders. Getting this right meant building the pricing engine ourselves — and building it somewhere that a mistake couldn't quietly charge a customer the wrong amount.
Our Solution
Three design directions before a line of production code
We started by putting three complete, standalone homepage prototypes in front of them — a rustic direction, a modern direction with restrained rustic accents, and our own synthesis of the two — each a full multi-page site with real copy sourced from their actual brand story rather than filler. All three went up as live preview links so Ryan and Holly could click through them on their phones and react honestly.
They chose the modern direction. We then integrated their real logo and photography, fixed a set of image files that had been delivered with mismatched formats and would have rendered broken in-browser, and carried that design system through every page of the final build.
A pricing engine that runs on the server, every time
The bundle pricing engine is the heart of the project:
- Tiered pricing per bag size, with the ladders configured to the client's exact numbers rather than hardcoded into checkout logic
- Cross-flavor pooling within a size — different flavors of the same size combine into one bundle tier
- Independent, simultaneous ladders — a mixed 4oz and 8oz order gets both tier prices in one transaction
- Server-authoritative — the browser never submits a price. Totals are recomputed on the server at checkout, so a manipulated cart can't produce a discounted charge
- Written back to Square as a named, itemized discount on the real order record, so what the customer paid is visible and auditable inside Square's own reporting rather than only on our side
Every scenario the client specified is covered by unit tests, so a future pricing change can't silently break an existing tier.
Live checkout, built to fail safely
Payments run through Square's Web Payments SDK, which means card details are entered into a Square-hosted field and never touch Back 40's own infrastructure — keeping the business out of PCI card-data scope entirely. Around that, we built the things that separate a demo checkout from one that can be left alone on a Saturday night:
- Duplicate-charge protection — a double-click or a network retry cannot produce two charges for one order
- Declined-card recovery — a buyer whose card is declined can correct it and retry in place instead of losing the cart
- Sold-out enforcement — inventory status is read from Square and out-of-stock sizes are refused at checkout, not just greyed out in the UI
- Rate limiting on the two endpoints that create orders
- Server-calculated shipping based on destination and the discounted order total, with a free-shipping threshold and a nudge toward it
- Promo codes with hard redemption caps, one-per-email enforcement, and an expiry date
- Retry with backoff on Square API calls, with structured logging on every call
Everything else a real store needs
Orders land in a Cloudflare D1 database with a full pricing breakdown and an event audit trail alongside them. A webhook listener keeps local order records in sync with Square as payment status changes. Confirmation email goes to the customer in Back 40's own voice — distinct from Square's generic receipt — and a separate notification goes to the shop the moment an order comes in. Contact and wholesale inquiries are validated, stored in the database, acknowledged automatically, and forwarded to the business inbox, so no lead depends on a third-party marketing tool the client hasn't chosen yet.
Fulfillment routes through Square's existing Pirate Ship integration for label purchase — a deliberate decision not to write custom carrier code where a proven integration already solved the problem.
A cutover that didn't break their business
Going live meant moving a working domain off Wix. We ran it as a staged production cutover with a written runbook: a separate production Worker, its own database, its own live Square and Resend credentials, and a rehearsal host to prove the whole path before DNS moved. Company email was left untouched throughout, the old Wix site was archived before the plan lapsed, and every deploy is tracked on a branch that can be rolled back to a verified commit.
The Result
Back 40 BBQ has a storefront at back40barbeque.com that takes real card orders, prices their bundles the way they actually sell them, and emails both the customer and the shop without anyone touching anything.
Underneath it: 125 automated tests across the pricing engine, shipping, coupons, checkout routes, and Square integration; a clean TypeScript type-check across the whole codebase; and a load-test baseline of 300 concurrent checkout requests with zero failures. The entire site runs on Cloudflare's edge — no server to patch, no hosting bill that scales with a good weekend.
The static pages ship zero JavaScript. Only the cart and checkout load an interactive component, and only when a customer opens it.
Technologies Used
- Astro server-rendered site deployed to Cloudflare Workers
- Preact island for the cart and checkout — the only client-side JavaScript on the site
- Hono API layer running inside the same Worker
- Cloudflare D1 for orders, order events, inquiries, and coupon redemptions
- Square Catalog, Orders, Payments, and Web Payments SDK, plus webhooks for status sync
- Resend for transactional confirmation, notification, and acknowledgement email
- TypeScript end to end, with Zod schema validation on every API endpoint
- Vitest for the automated test suite
Built under our E-Commerce Development service. Explore all services →