Tutorials

Practical notes from building software.

A growing archive of step-by-step guides.

All tutorials

71 articles
Next.js vs React: You're Actually Choosing Between a Library and a Layer of StructureReact is a library, Next.js is a framework built on it. Here's the real decision framework for choosing your 2026 stack architecture.AWS Web Services: A Working Engineer's Mental ModelSenior Staff Engineer distills AWS infrastructure decisions into concise, working tutorials—architecture judgment of a principal without enterprise overhead.Postgres Vector Search: Building a Production RAG Pipeline with pgvector and FastAPIBuild semantic search into Postgres with pgvector. Store embeddings as columns, query with SQL—no separate vector DB needed.FastAPI + SQLAlchemy Async: The Session Management Patterns That Actually Survive ProductionMaster the four-piece pattern for production-safe async session management in FastAPI + SQLAlchemy 2.0. Avoid MissingGreenlet errors, connection pool exhaustion, and hanging requests.Slash Commands and Subagents in Claude Code: Building Reusable Workflows Beyond CLAUDE.mdTurn Claude Code into an orchestration layer. Define tasks once with slash commands and subagents, then invoke them repeatedly—no re-explanation needed.Multi-Tenant Architecture in a Django + FastAPI Stack: Schema, Row, and Database Isolation Trade-offsRow, schema, or database isolation: trade-offs, migration costs, and how to choose the right PostgreSQL strategy before it's too late.Vite vs Next.js: You're Probably Comparing the Wrong Two ThingsThey're not competitors—Vite is a build tool, Next.js is a framework. Learn what layer each sits on and how to actually choose between them.PostgreSQL List Databases: The `\l` Command and Every AlternativeMaster listing PostgreSQL databases with `\l`, SQL queries, and CLI flags. Covers output columns, permissions, and workarounds for restricted contexts.Git Remove Untracked Files: The Safe Way to Purge Build Artifacts and JunkMaster git clean with preview mode, selective filtering, and safety guards. Remove build artifacts without losing uncommitted work.FastAPI vs Flask: A Decision Framework, Not a Popularity ContestAPI-first service? FastAPI. Server-rendered web app? Flask. Cut through the noise with a decision framework, not feature tables.React Server Components: A Decision Framework for Server/Client Boundaries in Next.js 15Stop reflexively adding 'use client' to every component. Learn the decision framework for server/client boundaries in Next.js 15 with production examples.Next.js Middleware: What It's For, What It Isn't, and How to Ship It CorrectlyMaster what Next.js middleware is, what it isn't, and when to use it. Learn the architecture judgment that keeps middleware fast and maintainable.FastAPI Background Tasks for LLM Jobs: A Complete Polling Pattern with Next.jsMove long LLM calls out of request path with FastAPI BackgroundTasks and job polling. Return 202 with job ID, let clients poll status until done.Docker Bake: A Practical Guide to Declarative, Parallel Docker BuildsReplace scattered docker build commands with one Bake file. A practical 2026 guide to targets, args, platforms, and CI integration.Managing Cost and Token Budgets for LLM APIs in Production: Caching, Batching, and Fallback ModelsTreat LLM spend like database load. Build routing, caching, and cost controls into your request path from day one—not as an afterthought.Setting Up a CLAUDE.md File on a Real Full-Stack RepoSet up Claude Code context files that persist across sessions. Load architecture decisions, conventions, and polyglot rules once—then let AI assistants reference them automatically.Deploying FastAPI and Next.js to AWS App Runner vs. ECS Fargate: When Managed WinsSenior engineer's honest breakdown: App Runner for solopreneurs and small teams, ECS Fargate when you need control. Real tradeoffs, no hype.The N+1 Query Problem: How to Spot It and Fix It in Django and SQLAlchemyHow the N+1 query problem silently tanks production performance, why it's invisible in dev, and concrete fixes for Django and SQLAlchemy.AWS Cost Optimization for a Dockerised Stack: Right-Sizing ECS, Fargate Spot, and Egress TrapsRight-size ECS, use Fargate Spot, avoid egress traps. Production checklist from 25+ years of SaaS infrastructure decisions.WebSockets in FastAPI and Next.js: Scaling Real-Time Connections Behind a Load BalancerBuild production WebSocket architectures that survive load balancers. Protocol fundamentals, connection management, authentication, and horizontal scaling without message loss.React Router v7 as a Framework: Migrating from Remix and Choosing It Over Next.jsWhy React Router v7's three modes make it a genuine Next.js alternative. Architecture decisions from 25 years of production experience.Health Checks, Graceful Shutdown, and SIGTERM Handling for FastAPI and Next.js Containers on ECSProduction patterns for health checks, SIGTERM handling, and graceful shutdown in containerised FastAPI and Next.js services on AWS ECS—edge cases included.Streaming Structured Output from Anthropic and OpenAI APIs to a Next.js UIProduction pattern for streaming JSON schemas from LLM APIs into a Next.js UI, handling Anthropic and OpenAI differences without the blank-screen wait.Observability with OpenTelemetry: Distributed Tracing Across Next.js, FastAPI, and DjangoInstrument three-tier stacks with OpenTelemetry. Propagate trace context across service boundaries and ship spans to your own collector.Feature Flags and Progressive Rollouts in a Django + FastAPI + Next.js StackProduction-ready feature flag implementation across Django, FastAPI, and Next.js. Covers bucketing, cache invalidation, and safe rollout workflows with working code.Idempotent Webhook Processing: Deduplication and Retry Handling in FastAPI and Next.jsProduction-ready webhook handling with deduplication and retry logic in FastAPI and Next.js. Prevent duplicate charges and handle partial failures robustly.Astro for Content-Heavy Sites: Islands, Partial Hydration, and When to Choose It Over Next.jsWhy Astro's zero-JS-by-default architecture outperforms Next.js for marketing sites and docs. Islands architecture, hydration strategy, and the trade-offs explained.Idempotency and Retry Patterns for Payment Webhooks (Stripe) in Next.js and FastAPIBuild production-grade Stripe webhook handlers in Next.js and FastAPI that survive retries without double-charging customers. Idempotency keys and deduplication patterns explained.Streaming LLM Responses from FastAPI to Next.js with the OpenAI and Anthropic APIsEnd-to-end streaming setup for OpenAI and Anthropic APIs across FastAPI and Next.js. Cover backend generators, SDK differences, error handling, and production patterns.Building MCP Servers for Claude Code: A Production Pattern for Custom ToolingDeploy custom MCP servers that give Claude safe, structured access to your APIs and databases—a production-ready pattern from infrastructure first principles.Golang Compare: A Practical Guide to Equality, Ordering, and Deep InspectionMaster Go's comparison semantics: when == works, why slices and maps don't, and production-tested patterns for safe equality checks across types.`strpos` in PHP: Stop Getting Bitten by the Zero-Position BugWhy `strpos` returns false AND 0, and how to check correctly. A production-hardened guide to the classic PHP footgun.Secrets Management for a Dockerised Stack: AWS Secrets Manager, SSM, and Local .env ParityProduction-ready pattern: AWS Secrets Manager and SSM Parameter Store for deployed environments, with genuine local .env parity—not aspirational.Cloudflare in Front of an ECS App: WAF, Cache Rules, and Tunnels for the Full-Stack StackDeploy Cloudflare's WAF, cache rules, and tunnels in front of ECS workloads. Production patterns for session handling, cache invalidation, and private routing—without the enterprise overhead.Full-Text Search in PostgreSQL vs. Reaching for Elasticsearch: A Pragmatic Decision GuideLearn when PostgreSQL's native full-text search suffices and when Elasticsearch becomes necessary. A senior engineer's pragmatic guide to avoiding premature infrastructure complexity.Securing Server-to-Server Calls Between FastAPI and Django with JWTs and mTLSLayer JWTs and mutual TLS for production-grade service-to-service authentication. Identity at the application layer, trust at transport—the infrastructure judgment senior engineers use.Caching Strategies with Redis for Next.js and FastAPI: When and What to CacheDecision framework and working patterns for when and what to cache in a Redis-backed stack. Avoid costly staleness bugs and database fires with principled caching.Rate Limiting and Throttling Patterns for FastAPI APIs in ProductionPractical rate limiting and throttling strategies for FastAPI—from in-process solutions to distributed Redis setups. Production-tested patterns with working code.Database Migrations in a Django + FastAPI Shared-Schema Setup Without ConflictsRun Django and FastAPI against one PostgreSQL schema without conflicts. Clear ownership rules, conflict detection, and working code patterns for shared migrations.Structured Logging and Observability for the Django + FastAPI + Next.js StackProduction-ready observability pattern with JSON logging, request correlation IDs, and queryable logs across frontend and backend—turning 3-hour debugging sessions into 20-minute fixes.CI/CD Pipeline for a Dockerized Full-Stack App: GitHub Actions to ECSProduction-ready GitHub Actions workflow that builds Docker images, pushes to ECR, and deploys to ECS Fargate—eliminating manual deploys and 11pm hotfixes.Background Jobs and Task Queues: Celery vs. Arq vs. Postgres-Backed QueuesCompare production task queue options: Celery's battle-tested complexity, Arq's lightweight simplicity, and Postgres-backed alternatives. Choose the right fit for your scale.Connection Pooling for PostgreSQL with PgBouncer in a Dockerized StackDeploy PgBouncer to eliminate connection exhaustion in PostgreSQL. Infrastructure-level pooling that survives application scaling without code changes.Zero-Downtime Deployments and Database Migration Strategies in ECSMaster database migrations that survive rolling deployments. Learn the expand-contract pattern, deployment sequencing, and real failure modes—so old and new tasks coexist without errors.Switch Statement PHP: Patterns Worth Actually Using in ProductionMaster PHP switch statements beyond basics. Learn loose comparison gotchas, real-world patterns, and when to use them in production code with 25+ years of engineering insight.Testing Patterns Every Serious Full-Stack Engineer Should KnowMaster the testing patterns that separate maintainable systems from fragile codebases. Learn what actually works in production, not just theory.Building a Gmail to AI Assistant Pipeline with Pub/Sub and WebhooksSet up real-time Gmail notifications that route through an AI assistant to filter noise, extract insights, and only alert you when it matters.Building Type-Safe Server Actions in Next.js with ZodLearn how to implement robust, type-safe server actions in Next.js using Zod for runtime validation and TypeScript type inference.Deploying Next.js to Vercel - Complete Guide to Free OptimizationsA step-by-step guide to deploying Next.js 15 to Vercel, with essential optimizations for performance and cost using Cloudflare CDN and static generation.Implementing Webhooks in Next.js 15 App RouterDiscover practical strategies for implementing efficient Next.js webhook solutions.Streaming SSR with Suspense in Next.js 15Learn how to leverage the App Router and React Suspense to stream server-rendered content incrementally in Next.js 15.Real-Time Updates with Server-Sent Events (SSE) in Next.js 15Stream multiple named events from a Next.js 15 endpoint and consume them via the useEventSource hook from react-use-websocket.Containerizing Next.js 15 (App Router) for Local and ProductionDockerize a Next.js 15 project created with the App Router, using multi-stage builds and Docker Compose.Adding Next-Auth Authentication to Django, FastAPI, and Next.js StackWire Next-Auth to FastAPI with JWT tokens. Get login, session refresh, and type-safe auth across your full-stack app—no enterprise complexity.Automatic PostgreSQL Upgrades with Docker and pgautoupgradeAutomate major version upgrades with pgautoupgrade: detect schema changes on startup, run pg_upgrade --link, hand off to PostgreSQL. No dumps, no scripts, no data loss.How to Integrate Celery with DjangoHow to Integrate Celery with Django: A Step-by-Step Guide for Asynchronous Task ProcessingAdding Clerk Authentication to a Full Stack Application with Django, FastAPI, and Next.jsHow to add Clerk Authentication to our full stack app with Django, FastAPI and Next.js.Lazy Loading CSS in Next.js with a Custom Hook and ComponentBoost Your Next.js Lighthouse Score with Lazy CSS Loading.Creating a Full Stack Application with Django, FastAPI, and Next.jsHow to create a full stack app with Django, FastAPI and Next.js.How to Use React Testing Library: A Comprehensive Guide for BeginnersUsing React Testing Library to test React components.How to Implement Lazy Loading Images ReactHow to lazy load images in React using react-lazy-load-image-componentHow to render code snippets in React using PrismRender code snippets for any language in React using Prism.How to Check Node JS Version from CodeWe look at a simple way to determine the Node.JS version from code to ensure all your requirements are met.Hashtags in PHPHow to generate hashtags from slugs and automatically link hashtags from text.How to do the shorthand conditional ternary in PHPPHP 5.3 added support for shorthand conditional ternary operators.The most secure password hashing algorithmsImplementing the most secure password hashing algorithms.How to encrypt passwords in PHP/Node.JS/PythonSafely encrypt user passwords in three popular programming languages for database storage.How to fetch authenticated CSV’s with Google Chrome (Headless) in NodeJSHow to fetch authenticated CSV’s with Google Chrome (Headless) in NodeJS.How to debug Google Chrome (Headless) and NodeJS with Developer ToolsWhen using Google Chrome in Headless mode to scrape websites it can often be faster to prototype interaction and data extraction commands via Developer tools.How to run Google Chrome (Headless) and NodeJS in a Docker containerUsing Docker to run Google Chrome (Headless) and NodeJS in a container.How to debug Amazon ECS ContainersHow to debug Docker containers in Amazon ECS.