Full-Stack Engineering
Design application APIs, authentication, background jobs, and payment flows. These articles connect frontend behavior to the services and data behind it.
7 articles
Stripe Integration in Next.js: Payments, Subscriptions, and Webhooks
Everything I learned integrating Stripe into production Next.js apps: Checkout vs Elements, subscription billing with metered usage, webhook handling in Route Handlers, idempotency patterns, failed payment recovery, and the Customer Portal. Real patterns from FreshMart (UK grocery platform) and multiple client projects. Includes TypeScript code for every integration point, testing with Stripe CLI, and the architecture that handles thousands of transactions without losing a single one.
Database Schema Design for Production Applications
The PostgreSQL schema design patterns I use in every production application I build through Supabase. From naming conventions and data type decisions to indexing strategy, UUID vs serial IDs, soft deletes, and migration workflows. Real schemas from EuroParts Lanka (products, orders, users, parts), uvin.lk (modules, lessons, progress tracking), and FreshMart (products, orders, carts). These aren't textbook patterns — they're battle-tested designs running in production right now, serving real users across Sri Lanka, the UK, and beyond.
Error Handling in TypeScript and Next.js: Patterns That Scale
The error handling patterns I use in every TypeScript and Next.js project to keep production apps alive. From structured error types and consistent API responses to React error boundaries, Next.js error.tsx files, Result types, and proper logging. Real patterns from uvin.lk and EuroParts Lanka that handle the failures most tutorials pretend don't exist. Never swallow errors, never return string messages, never ship a catch block that does nothing.
Authentication in Next.js with Supabase: Production Patterns
Production authentication patterns I use in every Next.js project with Supabase Auth. From email/password and OAuth flows to middleware-based session management, protected routes on both server and client, role-based access control, and the auth bugs that cost me hours. Real patterns from uvin.lk and EuroParts Lanka that handle expired sessions, OAuth callback races, and edge cases most tutorials skip.
Zod Validation in Next.js: From Form Inputs to API Responses
A complete guide to using Zod v4 for runtime validation in Next.js applications. Covers form validation with Server Actions, API route validation, environment variable safety, external API response parsing, React Hook Form integration, custom error messages, and battle-tested validation patterns from production codebases.
Next.js API Route Design Patterns for Production
Battle-tested Next.js API route design patterns from real production apps. Covers Route Handlers with Zod validation, authentication middleware, structured error handling, rate limiting, cursor-based pagination, file uploads, webhook endpoints, and a complete production API checklist.
TypeScript Patterns I Use in Every Production App
The TypeScript patterns that survive production: strict mode enforcement, Zod runtime validation, discriminated unions for state machines, branded types for entity IDs, generic API clients, type-safe environment variables, and the utility types that actually matter. Real code from apps I've shipped, not textbook examples. Includes patterns I stopped using and why.