Per-Request Query Budget (Detect Runaway Pages)

Set a rough query budget per request in dev/test and alert when exceeded. This is a pragmatic way to keep performance regressions visible without requiring a full APM setup.

Multi-Column Full Text Search with tsvector

For Postgres search beyond trivial ILIKE, maintain a tsvector column and a GIN index. Update it via trigger or application logic. This keeps search fast and predictable even as your dataset grows.

Optimistic toggle button with Stimulus “revert on failure”

I like optimistic UI for tiny interactions (like “star” or “follow”) because it makes the interface feel instant. The tradeoff is handling failure cleanly. I implement this with Stimulus: flip CSS + text immediately, then submit a Turbo request in the

Batched writes with COPY (conceptual)

Row-by-row inserts are painfully slow for big ingests. Postgres COPY is a great bulk-ingestion tool, and in Node you can stream into COPY using libraries like pg-copy-streams. The important part is validating before you stream, because once you’re in

Safer File Attachments: Content Type + Size Validation

Active Storage makes uploads easy; production makes them dangerous. Validate content type and size at the model layer, and keep the error messages user-friendly. This prevents large or unexpected uploads from blowing up costs and processing queues.

Django test fixtures with factory_boy

Factory Boy eliminates boilerplate in tests by generating model instances with sensible defaults. I use Sequence for unique values, SubFactory for foreign keys, and post_generation for many-to-many relationships. The Faker integration provides realist

Reorder a list server-side and reflect instantly with Turbo Streams

Drag-and-drop reorder can be fancy, but the core is: user triggers a reorder action, server persists positions, and the UI updates. For simpler UIs, I skip drag-and-drop and use up/down buttons. Each click POSTs to a move_up action, updates position,

Autofocus first input when a Turbo modal opens (Stimulus)

A modal that opens without focusing an input is a tiny annoyance that adds up. In Hotwire apps, modals often swap in via Turbo Frames, which means the DOM is injected after navigation. Stimulus is ideal here: attach an autofocus controller to the moda

Rate Limiting with Redis + Increment Expiry

A simple fixed-window rate limiter is often enough for endpoints like login, password reset, webhooks, or expensive searches. Use atomic Redis INCR + EXPIRE with a stable key and return remaining quota for UX.

Django password reset flow with email

Django provides built-in password reset views. I customize templates to match site design. The flow sends a secure token via email that expires after a timeout. I configure email backend and PASSWORD_RESET_TIMEOUT in settings. For better UX, I customi

Time Zone Safe Scheduling

Scheduling bugs are often time zone bugs. Persist times in UTC, accept user input in their zone, and convert explicitly. Keep conversions close to the boundary (forms/controllers).

Turbo Stream flash messages without custom JS

Instead of sprinkling custom JS for notifications, I treat flash as UI state and render it via Turbo Streams. When a create/update succeeds, the controller responds to format.turbo_stream and the template uses turbo_stream.replace to swap the flash co