E-commerce · whywepray · 2025 · 4 months
whywepray - a custom store on Next.js 15 instead of Shopify
A store where changing a product's price doesn't rewrite the order history, and a retried Stripe webhook doesn't create a second order. These are two things that break silently in e-commerce and come out at the first complaint.
- Next.js 15
- TypeScript
- Drizzle ORM
- PostgreSQL
- Stripe
- Auth.js
- Redis
- three.js
- Docker
The challenge
The whywepray brand sells one product in several sizes, in Europe and to the US, and wanted to do it on its own store instead of Shopify. The reason wasn't aesthetic: with collection drops and a single high-margin product, a commission on turnover and template limits cost more than maintaining our own code. But a store of your own means that we are responsible for the things a platform does for you silently: rounding of amounts, retried webhooks, order history.
Our solution
We built the store on Next.js 15 in a monorepo, in which the domain logic (money, cart, order, pricing) is a separate package with no dependency on the database or HTTP, and Zod schemas are the single source of truth for the database, the API, and the forms. Payments go through the hosted Stripe Checkout with Stripe Tax, shipping is free in Europe, and there is a flat €60 shipping fee to the US.
90 ms
Time to first byte
0.45 s
First contentful paint
2.5 MB
Transfer in the first 4 s
What we built
- 01 A custom store on Next.js 15: App Router, RSC, Server Actions
- 02 A pnpm + Turborepo monorepo, with the domain logic as a separate package
- 03 Amounts as integers in grosze, never floats
- 04 A snapshot of the order line: the price and name saved at the moment of purchase
- 05 Idempotency of Stripe webhooks on Redis
- 06 Auth.js v5: customer accounts with argon2id passwords
- 07 Stripe Checkout with Stripe Tax, transactional emails through Resend
- 08 Playwright tests on the purchase path, deployed in Docker behind Caddy
- 09 A homepage driven by scrolling: frames of a reel on a canvas, a logo breaking apart in a WebGL shader
Contents +
- Starting point
- Decisions that shaped the project
- Money as integers
- A snapshot of the order instead of a reference
- Webhook idempotency
- Domain logic outside the framework
- Zod as the single source of schemas
- A hosted checkout, not our own
- The new homepage (October 2026)
- A sketch from the reel, frame by frame
- A logo that falls apart into smoke
- Collections laid out like a poster
- Motion that can be switched off
- What came out of it
- Technically
Starting point
whywepray sells the WHYTE Bootcut: white jeans with a wide leg. One product, several sizes, sold in drops, shipped to Europe and the US.
With a profile like that, Shopify is a poor deal. The commission is calculated on turnover, not on the work the platform does, and it does little, because the catalogue is a single item. The template limits, on the other hand, make themselves felt with every campaign, because the brand sells by its look. We laid this calculation out more broadly in the comparison of WooCommerce and Shopify on the Polish market (in Polish). Here it comes out the same way, only on the Next.js side instead of WordPress.
An online store of your own removes the commission and the limits, but it moves onto us the responsibility for the things a platform does invisibly. The three below are the places where a store built in a hurry breaks only at the first complaint.
Decisions that shaped the project
Money as integers
Amounts are kept in grosze as an integer, never as floating-point numbers, and pass through one Money type. The reason is arithmetic: 0.1 + 0.2 in floating-point arithmetic doesn’t give 0.3, and with a cart, a discount, tax, and shipping those remainders add up. The customer then sees a different amount from Stripe, and the difference is found when reconciling the books, a month later.
A snapshot of the order instead of a reference
An order line saves the price, name, and SKU at the moment of purchase, instead of pointing at the current product. That way raising the price in the next drop doesn’t rewrite the orders from the previous one, and withdrawing a product from the catalogue doesn’t spoil an invoice from half a year ago. Stores that keep only a reference find that out when a customer asks for a duplicate of the confirmation.
Webhook idempotency
Stripe guarantees to deliver a webhook “at least once”, so it can send the same webhook more than once. Without protection, the second call creates a second order and a second email to the customer. The idempotency keys sit in Redis, and so does the rate limiting on public endpoints.
Domain logic outside the framework
The cart, pricing, and order live in the core package with no imports from the database, HTTP, or Next.js. Tests of that layer need no server or database, and the rule “how much does shipping to the US cost” sits in one place, not smeared across components. The domain layer returns a Result, and exceptions stay at the system’s boundaries.
Zod as the single source of schemas
The database schema, the API contract, and the form validation derive from one definition. Without that, a divergence is a matter of time: a field becomes optional in the database, the form still demands it, and the error is seen only in production.
A hosted checkout, not our own
Payments go through the hosted Stripe Checkout with Stripe Tax. We deliberately don’t build our own card form: card data never touches our server, and the sales tax for two zones is calculated by Stripe, not by us. It is the only place in this project where we hand control outside, and the only one where it pays off.
The new homepage (October 2026)
In October 2026 the homepage switched to the language of the reels that the brand publishes on Instagram. Instead of tiles with collections there are five scenes that move along with scrolling: a sketch, a manifesto, two collections, and a handwritten letter. The cart, Stripe Checkout, the orders, and the API stayed untouched. The rebuild concerned only the presentation layer.
A sketch from the reel, frame by frame
The page is opened by a hand-drawn picture from the whywepray reel: 98 frames of ink at the original 12 frames per second, but it is the scrolling that decides which frame is on the screen. We keep only the ink in WebP files, and the browser paints the paper on a canvas. The frames load four at a time, in the order of the reel, so the first is on the screen before the next ones arrive. When someone stops scrolling, the line wobbles between two neighbouring frames, as in a hand-drawn animation.
A logo that falls apart into smoke
The brand’s logo breaks apart in a WebGL shader from the edge to the middle, while the next sentences of the manifesto come in beside it. Over the scene we put the filter of a phone video from the early 2000s: the picture in 240 lines, 8×8 compression blocks, and a smear from the previous frame. The three.js library is downloaded only when the section is one screen away from view, so it doesn’t slow down the first visit. A browser without WebGL gets a static logo.
Collections laid out like a poster
Prayer Desires is six frames: a T-shirt and shorts in two colours and two outfits. The white version changes into the black one by crossfading. We scale each photo to the measured outline of the garment, not to the file’s frame, so both variants land in the same place and the transition looks like a change of colour, not a swap of the picture. The WHYTE Bootcut shows the trousers from the front and the back, with a cut as in a camera, the price pulled from the store’s database, and a link to the product page.
Motion that can be switched off
Every scene checks the system’s “reduce motion” setting. When it is on, the cuts and the camera shake disappear, an ordinary crossfade remains, and the scenes draw only while scrolling. The animation loops stop when a section is off screen, and the camera movement in the collections runs on phones at 30 frames per second instead of 60 and with half the amplitude.
What came out of it
A measurement of the new homepage from 28 October 2026, Chrome with no cache, three runs: about 90 ms to first byte and 0.45 s to first contentful paint. Before the rebuild, in September, it was 103 ms and 0.40 s, so the first screen appears practically as fast.
The weight changed. In the first four seconds the page downloads 2.5 MB in 139 requests, while in September the whole page was 814 kB in 33 requests. 98 of those requests are the frames of the sketch: 19 kB on average, 1.9 MB together, which is most of the transfer. They are pulled in the background when the first frame is already on the screen, so they don’t delay the start, but the total transfer is three times larger than before the rebuild. That is the price of this form, and it has to be watched with each new drop, as we describe in the Core Web Vitals checklist (in Polish).
Technically
Next.js 15 (App Router, RSC, Server Actions), TypeScript in strict mode, PostgreSQL with Drizzle ORM, Auth.js v5 with argon2id, Stripe Checkout and Stripe Tax, Resend with React Email, Redis for idempotency and limits, and three.js and canvas on the homepage. A monorepo on pnpm and Turborepo: apps/web plus the packages core, contracts, db, ui, and observability. Tests in Vitest and Playwright, production in Docker behind Caddy.
Screenshots


The opening of the homepage: a hand-drawn sketch from the brand's reel, frame by frame to the rhythm of scrolling.
A similar problem to solve?
Tell us briefly what it is about. We will send a quote within 24 hours.
Ask for a quote →










