Prisma: avoid N+1 with include/select

Prisma makes it easy to write readable queries, but you can still create N+1 patterns by fetching parents and then fetching children in a loop. I prefer using include or select to get related data in one query when the cardinality is reasonable. I als

Criterion for benchmarking with statistical analysis

Criterion is the standard benchmarking library for Rust. It runs benchmarks multiple times, detects outliers, and reports statistical confidence intervals. The API is simple: wrap your code in a closure, and criterion measures execution time. It gener

Trait bounds for generic functions with behavior constraints

Traits define shared behavior, and trait bounds let you write generic functions that work with any type implementing a trait. The syntax T: Display means "T must implement Display." This is similar to interfaces in other languages but more powerful: y

Background jobs with Sidekiq and ActiveJob

Sidekiq processes background jobs asynchronously using Redis and multi-threading. ActiveJob provides framework-agnostic interface—I use it for portability between job processors. Jobs handle emails, data processing, API calls, report generation. perfo

Broadcasts refreshes for complex pages (less target wiring)

When a page has many small targets, wiring dozens of Turbo Stream operations can get noisy. Rails’ broadcasts_refreshes (Rails 7.1+) lets you take a pragmatic approach: broadcast a refresh, and Turbo morphs the page. It’s not always the right choice (

Django REST Framework pagination with custom classes

I use PageNumberPagination for simple, bookmark-friendly pagination and CursorPagination when data changes frequently (prevents duplicate/missing items between pages). Creating a custom pagination class lets me control page_size, page_size_query_param

Webhook signature verification

When receiving webhooks from external services, signature verification ensures the payload comes from the claimed sender and hasn't been tampered with. Services like Stripe and GitHub include an HMAC signature in headers computed from the request body

Read Replica Routing for GET-Heavy Endpoints

For apps with replicas, route read-only code paths to reading role and enforce prevent_writes. This is a strong reliability move: accidental writes on replicas become exceptions instead of silent data loss.

Array methods: map, filter, reduce, and functional programming

Array methods enable functional programming patterns in JavaScript. The .map() method transforms each element and returns new array. I use .filter() to create arrays with elements meeting criteria. The .reduce() method accumulates values into single r

Advanced SQL joins and query optimization

SQL joins combine data from multiple tables. INNER JOIN returns matching rows only. LEFT/RIGHT JOIN includes all rows from one table, nulls for non-matches. FULL OUTER JOIN combines both. I use CROSS JOIN for Cartesian products sparingly—performance k

reqwest for async HTTP client with connection pooling

Reqwest is the most popular async HTTP client for Rust. It's built on tokio and hyper, with a high-level API for making requests. Connection pooling, redirects, timeouts, and TLS are handled automatically. I use the builder pattern to configure client

Django session management and custom session backends

Sessions store user state across requests. Django supports database, cache, file, and cookie-based sessions. I use cacheddb for read performance with database persistence. For APIs, I avoid sessions in favor of token auth. The request.session dict-lik