Architecture
How the pieces of an app fit together — frontends and backends, APIs, databases, queues and caches — and how to choose between designs.
133 posts · page 2 of 6
tRPC vs REST: End-to-End Type Safety or a Standard API?
tRPC lets a TypeScript front end call back-end functions with full type safety and no API schema to maintain; REST is the universal, language-agnostic standard. How they differ, a tRPC example, when tRPC shines (TypeScript monorepos), when REST wins (public APIs, mobile, other languages), and where Server Actions fit.
TanStack Query vs useEffect for Data Fetching in React
Fetching in useEffect looks simple until you need loading states, errors, caching, race conditions, refetching and mutations. What TanStack Query handles for you, side-by-side code, mutations with invalidation, and when server components or plain useEffect are still the right choice.
Stripe Subscriptions Explained: Products, Prices, Webhooks and Access
How Stripe Billing models subscriptions — customers, products, prices, subscriptions and invoices — which webhooks to handle, what each subscription status means for access, trials, upgrades and proration, failed payments and dunning, and the Customer Portal.
SSR vs CSR vs SSG: How Web Pages Get Rendered, Explained
Server-side rendering, client-side rendering and static site generation are three answers to one question: where and when is the HTML made? How each works, the trade-offs for speed, SEO, cost and freshness, ISR in between, and which to use for which page.
SPA vs MPA: Single-Page vs Multi-Page Applications Explained
A single-page app loads once and swaps content with JavaScript; a multi-page app loads a new HTML page for each link. How each works, what it means for speed, SEO, hosting and complexity, and why modern frameworks like Next.js and Astro blur the line.
Resend vs SendGrid vs Postmark: Which Email API for Your App?
Three popular ways to send transactional email — sign-up confirmations, password resets, receipts — from your app. How Resend, SendGrid and Postmark compare on developer experience, deliverability, free tiers (SendGrid dropped its free plan), and when Amazon SES makes sense.
Refresh Tokens Explained: Short-Lived Access, Long-Lived Sessions
Access tokens should expire quickly; refresh tokens let users stay logged in without re-entering passwords. How the pair works, where to store each, refresh token rotation and reuse detection, revocation, handling refresh in the front end, and when plain session cookies are simpler.
React State Management: useState vs Context vs Zustand vs Redux
Most React apps need less state management than they think. Sort your state into server, URL, form, local and global, then pick the lightest tool for each: useState, the URL, React Context, Zustand, Redux Toolkit or Jotai. Trade-offs, examples and common mistakes.
React Server Components Explained: "use client", "use server", and What Runs Where
Server Components render on the server and send no JavaScript; Client Components hydrate in the browser for interactivity. How the boundary works, what 'use client' and 'use server' actually mean, passing data across, common errors, and how to keep secrets and bundles where they belong.
Query Parameters Explained: The ?key=value Part of a URL
Query parameters are the key=value pairs after the ? in a URL, used for search, filters, sorting and pagination. How they're written and encoded, reading them in JavaScript, Express and Next.js, query vs path parameters, and what never to put in them.
Postgres HOT Updates and Fillfactor: Cheaper UPDATEs
Every Postgres UPDATE writes a new row version — and normally new entries in every index. Heap-only tuple (HOT) updates skip the index work. When HOT applies, why indexed columns and full pages prevent it, tuning fillfactor, measuring the HOT ratio, and designing hot tables to stay HOT.
Change Data Capture in Postgres: Streaming Every Row Change
Change data capture streams every insert, update and delete out of Postgres as it happens. How logical decoding and replication slots work, publications and pgoutput, REPLICA IDENTITY, Debezium and lighter alternatives, the outbox pattern, and the operational traps — retained WAL, schema changes and failover.
Optimistic vs Pessimistic Locking: Preventing Lost Updates
Two users edit the same record and one silently overwrites the other. Pessimistic locking (SELECT FOR UPDATE) blocks the second writer; optimistic locking (a version column) detects the conflict. How each works, code for both, atomic updates that avoid locks entirely, and how to choose.
OpenAPI vs Swagger: What's the Difference?
OpenAPI is the specification for describing HTTP APIs; Swagger is the original name and a set of tools (Swagger UI, Editor, Codegen). What an OpenAPI document contains, code-first vs design-first, generating docs, clients and types, and why OpenAPI specs help AI tools use your API.
OAuth PKCE Explained: Why Every OAuth Flow Should Use It
PKCE (Proof Key for Code Exchange) protects the OAuth authorization code flow from code interception. How code_verifier and code_challenge work step by step, why it's required for SPAs and mobile apps and recommended for everyone, the state parameter, and the mistakes to avoid.
Node.js Event Loop Lag: Finding What Blocks Your Server
When one request's CPU work blocks the event loop, every other request waits. How to measure event loop delay and utilisation with perf_hooks, the usual culprits (big JSON, sync crypto, regex backtracking, sync fs), profiling with --cpu-prof, the libuv threadpool, and fixes from chunking to worker threads.
Next.js Server Actions: Forms and Mutations Without API Routes
Server Actions (Server Functions) let a form or button call a function that runs on the server, without writing an API route. How 'use server' works, forms with useActionState, validation with Zod, revalidating data, pending states — and why every action is a public endpoint that needs its own auth checks.
Next.js Middleware Is Now Proxy: proxy.ts Explained
In Next.js 16, middleware.ts was renamed to proxy.ts and now runs on Node.js by default. What proxy does, the matcher config, common uses (auth redirects, rewrites, headers, CORS), the codemod to migrate, and why you must still check authorization inside every Server Function and route.
Next.js App Router vs Pages Router: Differences and Whether to Migrate
Next.js has two routers: the older pages/ directory and the newer app/ directory built on React Server Components. How routing, data fetching, layouts and API routes differ, which one new projects should use, and a sensible incremental migration path.
Mutual TLS (mTLS) Explained: When the Server Checks You Too
In normal TLS only the server proves its identity. With mutual TLS the client presents a certificate too. How the mTLS handshake works, running a private CA, issuing and rotating short-lived client certificates, configuring Nginx and Node, mTLS in service meshes and webhooks, and the operational traps.
Message Queues Explained: When You Need One and Which to Use
A message queue lets one part of your system hand work to another without waiting. Queues vs pub/sub vs event streams, delivery guarantees, dead-letter queues, and an honest comparison of Postgres, Redis, RabbitMQ, SQS and Kafka for a small team.
MCP vs API: What's the Difference, and Do You Need Both?
An API is how programs talk to a service. MCP (Model Context Protocol) is a standard way for AI tools to discover and use those services. How they relate, why MCP servers usually wrap APIs, when to use each, and what MCP adds and costs.
JWKS and Signing Key Rotation for JWTs
If your JWTs are signed with one secret that never changes, a single leak lasts forever. How asymmetric signing and JWKS endpoints work, the kid header, a zero-downtime rotation schedule, caching and refetch rules for verifiers, emergency revocation, and the verification mistakes that turn JWKS into an attack vector.
HTTP/1.1 vs HTTP/2 vs HTTP/3: What Changed and Whether You Should Care
HTTP/2 multiplexed requests over one TCP connection; HTTP/3 moved to QUIC over UDP to escape TCP's head-of-line blocking and speed up handshakes. How each works, what they fix, what they break, how browsers discover HTTP/3, and what to actually configure for your app.