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

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.

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

Django settings organization with environment-based configs

I organize settings into base, development, and production modules. The base contains common settings, while dev and prod override specific values. I use environment variables for secrets via os.environ.get() or python-decouple. The django-environ pac

Django REST Framework filtering with django-filter

django-filter provides declarative filtering for DRF viewsets. I define a FilterSet class with fields to filter on. The DjangoFilterBackend integrates seamlessly with DRF. I use CharFilter, NumberFilter, DateFilter etc. for different field types. Look

Django middleware for API versioning

API versioning via middleware provides clean URL routing. I extract version from Accept header or URL prefix and set it on the request object. Views can check request.api_version to return appropriate responses. For breaking changes, I maintain separa

Stimulus: bulk selection + Turbo batch action

For batch operations, Stimulus can manage the UI state (select all, indeterminate checkbox) while Turbo submits a regular form. This keeps the server in charge of authorization and the UI simple.

Django model validation with clean method

The clean() method validates model instances before saving. I raise ValidationError for invalid data. This runs on form submission and can be called explicitly with full_clean(). I validate cross-field constraints that can't be expressed as field vali

Django JSON field for flexible schema data

JSONField stores structured data without creating separate tables. I use it for settings, metadata, or varying attributes. Django provides database-level JSON operations via lookups like __contains, __has_key. For PostgreSQL, I get native JSON operato