Intermediate guides.
For people who already ship. Claude Code workflows, deploys without downtime, Postgres in production, and the operational details that start to matter.
186 posts · page 3 of 8
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.
React Hook Form: Fast, Validated Forms With Less Code
React Hook Form manages form state with uncontrolled inputs, so big forms stay fast and the code stays short. register, handleSubmit, errors, Zod validation with zodResolver, Controller for UI libraries, field arrays, server errors, and using it with Next.js Server Actions.
React Error Boundaries: Stop One Broken Component Crashing the Page
Without an error boundary, one component throwing during render blanks your entire React app. How error boundaries work, using react-error-boundary with fallbacks and reset, Next.js error.tsx and global-error.tsx, what boundaries don't catch, and reporting errors to monitoring.
React Custom Hooks: How to Write and Share Your Own
A custom hook is a function starting with 'use' that packages stateful logic for reuse across components. The rules, worked examples (useLocalStorage, useDebounce, useMediaQuery, useOnlineStatus), returning values vs tuples, testing them, and when a hook is the wrong abstraction.
React Context: When to Use It (and When Not To)
React Context passes values through the component tree without prop drilling. How createContext, providers and useContext work, a typed auth context example, why every consumer re-renders when the value changes, splitting contexts, and when to use Zustand or TanStack Query instead.
Chunking for RAG: How to Split Documents So Retrieval Works
How you split documents into chunks decides what a RAG system can retrieve. Fixed-size, recursive, structure-aware and semantic chunking, choosing chunk size and overlap, adding context to chunks, parent-child retrieval, chunking code and tables, and how to evaluate it.
Prompt Caching Explained: Cut LLM Costs and Latency on Repeated Prompts
If every request repeats the same long system prompt, documents or tool definitions, prompt caching lets the provider reuse that work for a fraction of the price and time. How it works, structuring prompts for cache hits, Claude's cache_control, OpenAI's automatic caching, and verifying it works.
Prisma Migrations in Production: migrate dev vs migrate deploy
How to run Prisma migrations safely: migrate dev locally, migrate deploy in production, why db push and migrate reset don't belong near real data, where to run migrations in CI/CD, handling failed migrations with migrate resolve, baselining an existing database, and avoiding destructive changes.
Postgres Window Functions: Running Totals, Rankings and Top-N per Group
Window functions compute values across related rows without collapsing them like GROUP BY. OVER, PARTITION BY and ORDER BY explained, with practical queries: ranking, top-N per group, running totals, moving averages, comparing with the previous row (LAG), and frames.
Postgres Upsert: INSERT ... ON CONFLICT (and MERGE) Explained
Insert a row, or update it if it already exists, atomically. ON CONFLICT DO NOTHING and DO UPDATE with EXCLUDED, conflict targets and partial indexes, conditional updates, bulk upserts, RETURNING, MERGE, the race conditions a select-then-insert has, and upserts in Prisma and Drizzle.
Postgres Triggers: Automatic Actions on Insert, Update and Delete
A trigger runs a function automatically when rows change. How to write trigger functions in PL/pgSQL, BEFORE vs AFTER and row vs statement triggers, practical examples — updated_at, audit logs, denormalised counters, validation — and the pitfalls that make triggers hard to debug.
Postgres Roles and Permissions: CREATE USER, GRANT, and Least Privilege
Most apps connect to Postgres as a superuser, so one SQL injection or rogue AI command can drop everything. How Postgres roles, privileges, schemas and default privileges work, and a practical setup with separate owner, app and read-only roles.
Postgres Materialized Views: Fast Reports Without Slowing Your App
A view is a saved query; a materialized view also saves the result. When materialized views make dashboards and reports fast, REFRESH vs REFRESH CONCURRENTLY, indexing them, scheduling refreshes with pg_cron or your job runner, staleness, and alternatives like summary tables.
Postgres CTEs (WITH Queries): Readable SQL, Recursion and Data-Modifying CTEs
Common table expressions let you name subqueries and build complex SQL step by step. Basic WITH queries, recursive CTEs for trees and hierarchies, data-modifying CTEs that insert or delete and return rows, MATERIALIZED vs NOT MATERIALIZED, and when a CTE affects performance.
Playwright Tutorial: End-to-End Tests That Aren't Flaky
Playwright drives real browsers to test your app the way users use it. Install it, write your first test, use role-based locators and auto-waiting assertions, log in once and reuse the session, run against a dev server, debug with UI mode and traces, and run it in CI.
pg_stat_statements: Find the Queries Slowing Down Your Postgres
pg_stat_statements records statistics for every distinct query your database runs — calls, total and mean time, rows, cache hits. How to enable it, the queries to find what costs the most, interpreting the results, resetting, and turning findings into indexes and fixes.
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.
"No Space Left on Device": Finding and Freeing Disk Space on a Server
When a server's disk fills up, databases stop writing, deploys fail and apps crash with ENOSPC. How to find what's using space with df and du, the usual culprits (logs, Docker, journald, old releases, deleted-but-open files), inode exhaustion, and how to stop it happening again.
Nginx Reverse Proxy Configuration: A Production-Ready Example
A complete Nginx reverse proxy config for a Node.js or Python app, explained line by line: proxy_pass, forwarding headers, WebSockets, timeouts, upload limits, HTTPS redirect, gzip, static files, multiple apps by domain, and how to test and reload safely.
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.