Django REST Framework authentication with JWT

JWT tokens provide stateless authentication for APIs. I use djangorestframework-simplejwt for token generation and validation. The TokenObtainPairView issues access and refresh tokens on login. I configure token lifetimes in settings. For protected en

OpenTelemetry tracer provider with ratio-based sampling

To get useful traces, you need propagation and a real exporter. I set a global TextMapPropagator (TraceContext + Baggage) so inbound headers connect spans across services. Then I configure an OTLP exporter and a batch span processor so tracing overhea

Spring Boot REST API with CRUD operations

Spring Boot simplifies building production-ready REST APIs with minimal configuration. I use @RestController to create RESTful endpoints and @RequestMapping to define routes. The @GetMapping, @PostMapping, @PutMapping, and @DeleteMapping annotations h

SQL migration safety: add column nullable, backfill, then constrain

The fastest way to surprise yourself in production is ADD COLUMN ... NOT NULL DEFAULT ... on a large table. My safe pattern is: add the column nullable with no default, backfill in batches, then add the NOT NULL constraint. If I need a default for new

Broadcast Receivers for system events

BroadcastReceiver responds to system-wide or app-specific events. I register receivers statically in AndroidManifest or dynamically with registerReceiver(). The onReceive() method handles broadcasts—network changes, battery status, boot completed, SMS

JUnit 5 and Mockito testing strategies

JUnit 5 provides a modern testing framework with @Test, @BeforeEach, @AfterEach lifecycle hooks. Mockito creates test doubles with @Mock and @InjectMocks annotations. I use when().thenReturn() to stub method responses and verify() to confirm interacti

Laravel database transactions for data integrity

Database transactions ensure multiple database operations succeed or fail together, maintaining data consistency. I wrap related operations in DB::transaction() which automatically commits on success and rolls back on exceptions. For manual control, I

SwiftUI animations and transitions

SwiftUI makes animations declarative and automatic. The .animation() modifier animates state changes with built-in curves like .easeInOut, .spring(), or custom timing. Explicit animations use withAnimation {} blocks to scope which changes animate. Tra

Turbo-friendly 422 responses for invalid forms

In a Turbo app, returning the right HTTP status is not optional—it controls how Turbo treats the response. For invalid form submissions, return 422 Unprocessable Entity and render the form with errors. If you mistakenly return 200, Turbo may treat it

Makefile for DevOps task automation

Makefiles provide a simple, universal task runner for DevOps workflows. Targets define named tasks with optional dependencies. The .PHONY declaration prevents conflicts with files of the same name. Variables set at the top configure reusable values. $

pgxpool initialization with max connections and statement timeout

Postgres stability depends on respecting its limits. I configure pgxpool with explicit MaxConns and MaxConnLifetime so the service doesn't accidentally open too many connections during bursts. I also set a session statement_timeout in AfterConnect, wh

Character counter for textareas with Stimulus

A character counter is small, but it removes uncertainty for users (especially when there’s a limit). I implement it with Stimulus so it stays reusable: attach to a wrapper, declare input + output targets, and compute remaining characters based on an