SwiftUI PreferenceKey for child-to-parent communication

PreferenceKey enables child views to pass data up to ancestors, complementing the typical parent-to-child flow. I define a custom preference key by conforming to PreferenceKey protocol with a defaultValue and reduce method that combines multiple value

Turbo Frames: inline “details drawer” without a SPA router

A common UI is a list on the left and a details panel (drawer) on the right. With Turbo Frames, each list item link can target a details frame. Clicking an item swaps the drawer content while leaving the list intact. The server still renders HTML, so

Docker multi-stage build for Next.js

A single-stage Dockerfile tends to ship your entire build toolchain into production, which makes images bigger and slower to deploy. I prefer multi-stage builds: one stage installs deps + builds, the final stage runs only the minimal production output

Circuit breaker wrapper for flaky third-party APIs

When a dependency starts timing out, naive retries can amplify the outage by piling on more work. A circuit breaker gives the system a chance to breathe: after enough failures, it opens and returns a fast error, then it half-opens to probe recovery. I

Decorator pattern with Draper for view logic

Draper decorators encapsulate view-specific logic, keeping models clean. Decorators wrap models, adding presentation methods without polluting domain logic. I use decorators for formatting, conditional rendering, helper delegation. Decorators access h

Health checks with readiness + liveness

One /health endpoint is ambiguous: is the process alive, or is it actually ready to serve traffic? I split them. Liveness answers ‘should the orchestrator restart me?’ and is usually just ‘the event loop is alive’. Readiness answers ‘can I accept traf

Cache Key Versioning with a Single “namespace”

When cache structures change, you want to invalidate safely without flushing the world. Use a namespace version key (per feature) and incorporate it into cache keys.

LocalStorage, SessionStorage, and IndexedDB

Web storage APIs persist data in the browser. I use localStorage for permanent client-side storage across sessions. The sessionStorage API stores data for single sessions that clears when tabs close. Both provide simple key-value storage with 5-10MB l

Nginx reverse proxy and load balancing

Nginx serves as a high-performance reverse proxy and load balancer. The upstream block defines backend server pools. Load balancing methods include round-robin (default), least_conn, ip_hash, and random. The proxy_pass directive forwards requests to u

React useReducer for complex state logic

useReducer manages state with reducer patterns like Redux but locally scoped. When state updates depend on previous state or involve multiple sub-values, reducers are clearer than multiple useState calls. The reducer function takes current state and a

Django generic views for CRUD operations

Generic class-based views reduce boilerplate for standard CRUD operations. I use ListView, DetailView, CreateView, UpdateView, and DeleteView. Setting model and template_name is often sufficient. For create/update views, I specify fields or form_class

Iterator trait and combinators for zero-cost collection processing

Rust's Iterator trait provides a rich set of combinators (.map(), .filter(), .fold(), etc.) that compose without allocating intermediate collections. Iterators are lazy: they don't do work until you consume them with .collect(), .for_each(), or simila