The job
ModeTech sells phone and computer accessories online in Pakistan. I built the storefront and the admin console as one TanStack Start app on Bun, and I run its servers. The first version shipped in three weeks, with more than 240 commits across about 80 pull requests.
Checkout without accounts
Checkout works without an account, so the server does all the trust work:
- The server recomputes every price and discount. It ignores the totals that the browser sends.
- Each order carries an idempotency key, so a double click or a retry cannot create two orders.
- Orders move through an explicit status machine.
- Guests can look up an order, and that lookup is rate limited so nobody can enumerate orders.
- A customer can also send the order to the shop on WhatsApp.
A guest places an order. The browser sends the cart, an idempotency key, and a total it computed itself.
Illustrative. Prices, the key, and the order number are made up.
- A guest places an order. The browser sends the cart, an idempotency key, and a total it computed itself.
- The server ignores that total. It loads current prices and discounts and recomputes every line.
- It saves the order under its idempotency key and returns it.
- The customer double-clicks. A second request arrives with the same key.
- The key already has an order, so the server returns that order. There is still only one.
The admin console
Staff manage products, categories, brands, discount codes, bulk promotions, and the homepage layout. A live dashboard and an order queue show what needs attention.
Staff accounts use Better Auth with a permission grid and presets for common roles. Admin actions go to an audit trail. On the first run, the app creates an admin account and forces a password change before anything else works.
Importing the catalogue
The store had to open with a full catalogue. I wrote an import pipeline that pulled 994 products in 37 categories from an existing WooCommerce catalogue through its Store API, and mapped them onto a new tree with 7 parent categories. The pipeline optimizes each image before it uploads it to Oracle Object Storage.
Data and safety
- I moved the data layer from MongoDB to PostgreSQL, with Drizzle ORM migrations.
- Zod validates input at every public boundary.
- A shared Redis rate limiter protects sign-in from credential stuffing.
- Transactional email goes through Resend, with SMTP as a fallback.
Deploys and observability
Staging and production run on an Oracle Cloud ARM server behind Caddy. One Bash script does a deploy: it builds locally, copies the build with rsync, runs migrations over an SSH tunnel, restarts the app with PM2, and checks health.
OpenTelemetry traces every request and every database query. An OpenTelemetry Collector on the server sends the traces, the logs, and host and PostgreSQL metrics to Grafana Cloud. When a page is slow, I can see which query caused it.


