Dzaki Fadh

A kids' brand shop I first built in React Router 7, then rebuilt on my own time as a static Astro site with its own order and payment system.

Client
Private client
When
Sep 2025 / FreelanceRebuilt Oct 2026
Role
Fullstack, solo: storefront, backend, and admin.
Stack
Astro, React, Cloudflare Workers, D1, Xendit, PayPal
Visit the live site(opens in a new tab)

Results

  • 3.0 MB

    Home page weight

    down from 6.9 MB

  • 877 KB

    Images on the home page

    down from 4.7 MB

  • 139 KB

    Largest city list

    down from 36 MB

Home page transfer sizes from Lighthouse 13.5 (mobile) against both live sites, two runs each, Oct 2026; the rounded values matched every time. City lists measured uncompressed.

01

The brief

Youmay is an Indonesian brand of kids' t-shirts, tote bags, and wall canvases that children draw on with their parents. It sells in IDR at home and USD abroad.

The client wanted a landing page that could also take orders, and left the stack to me. Next.js was more framework than three products and a contact form needed, so I picked React Router 7, which I already knew well. Checkout emailed each order to the shop.

React Router 7 let me ship that brief fast with tools I knew. Once the site was live and the content settled, its shape was clear: mostly photos and copy, with a few interactive parts. That is the kind of site Astro is built for. Everything after this section went past the brief.

02

Why I rebuilt it

The first build did what the brief asked, and the brief stopped at an email. A buyer could fill a cart and check out, but the order then landed in the shop's inbox, and the team worked out shipping, collected payment, and sent tracking by hand. Ordering started on the site and finished somewhere else. I wanted the site to carry an order through to delivery, so I kept working on it on my own time.

FeatureFirst buildAfter the rebuild
Placing an orderCheckout emailed the order to the shopSaved once the buyer confirms their email, then emailed to the shop and the buyer
Shipping costWorked out off the siteQuoted in the admin and sent with a pay link
PaymentNo online paymentXendit for IDR, PayPal for USD, bank transfer as a fallback
Order statusNonePending, quoted, paid, shipped, with an email at each step
AdminNone; orders lived in an inboxOrder list and timeline behind Cloudflare Access
Spam protectionNoneTurnstile, an emailed code before each order, and limits per IP and per email
City pickerEvery city in the world in one 36 MB chunkOne prebuilt JSON file per state

Speed was the other half. A React Router app hydrates its whole React tree on every page, which suits an app but costs a lot on pages that are almost entirely static. It also has no build-time image pipeline, so phones downloaded the same large photos as desktops.

The rebuild kept the layout and behavior. Every public page is prerendered, images are resized and compressed at build time, and only four components on them hydrate: the navbar, product tabs, contact form, and checkout. Most of the weight saved came from the images; JavaScript only went from 253 KB to 197 KB.

Checkout had a second problem. Picking a state loaded every city in the world as one JavaScript chunk, then filtered it in the browser. Each state now has its own prebuilt JSON file.

PageSpeed Insights mobile report for the React Router 7 build: performance 69, accessibility 91, best practices 100, SEO 100; LCP 5.7 s.
PageSpeed Insights mobile report for the Astro rebuild: performance 93, accessibility 100, best practices 100, SEO 100; LCP 3.0 s.
One PageSpeed Insights mobile run per build, captured back to back on 23 Oct 2026. Drag to compare.

03

Orders the shop can quote

Shipping costs vary too much to price at checkout, so the shop quotes each order by hand. Buyers check out without an account. Once they confirm their email, the order lands in Cloudflare D1 and both sides get an email.

The team adds shipping in an admin behind Cloudflare Access and sends a quote. The buyer gets a private pay link guarded by a random token.

Every status change goes through one function. It only allows moves that make sense, like paid to shipped, and it re-checks the old status in the same database write, so two clicks at once can't overwrite each other.

Checkout emails whatever address it receives, so an open form could be used to spam strangers from the shop's domain. Now the buyer gets a short code first, two words and a number like MATCHA-KITE-42, and the order is saved only after they type it back. The code email carries nothing the visitor typed, so a fake order can't slip a link into someone else's inbox.

Each email address gets one code a minute, three codes a day, and three orders a day. A code expires after ten minutes or five wrong tries. Both forms also sit behind Cloudflare Turnstile, which stays invisible unless a visitor looks like a bot, and each IP gets five orders and three questions a minute.

The order list, filtered by status. Rows named E2E TEST are test orders. Buyer emails are redacted. Tap the image to open it full size.

04

Payments that can't double-charge

Xendit handles IDR, PayPal handles USD, and bank transfer is the fallback. Webhook bodies are never trusted: a Xendit webhook triggers a fresh read from Xendit's API, and PayPal webhooks are verified against PayPal's signature API.

An order turns paid only when the payment belongs to its current checkout and covers the current total. Anything else becomes a review event and an email to the shop.

A USD order paid through PayPal. The timeline records every status change, and the WhatsApp panel drafts the tracking message for the shop to send. Tap the image to open it full size.

05

How it's tested

Before I ship a change, I try to break the checkout on purpose. Tests run on an in-memory D1 database and send the payment code fake, replayed, and stale webhooks. None of them can mark an order as paid or refund a customer twice.

Then Playwright buys a product from start to finish, on a laptop and on a phone, and axe-core checks every page against WCAG 2.1 AA.

TermIn plain wordsWhat the test proves
WebhookThe message a payment provider sends to say an order was paid.A fake one, or one with the wrong amount, can't mark an order as paid.
Replayed / stale webhookA real message sent a second time, or one that arrives late.Each payment counts once, and a late message can't move an order backwards.
In-memory D1A throwaway copy of the database that only exists while the tests run.Real orders are never touched.
PlaywrightA tool that drives a real browser the way a buyer would.Checkout works on both a laptop and a phone screen.
axe-core, WCAG 2.1 AAAn automatic accessibility check against the common web standard.Catches missing labels, low contrast, and similar problems.

Want to try the whole flow yourself, from placing an order as a buyer to quoting and shipping it in the admin? Email me and I'll give you access.