Tips tagged with "Best practices"

Browse all tips tagged with Best practices.
shape
shape
shape
shape
shape
shape
shape
shape

Next.js Medium

Secure Next.js Server Actions: zod Validation, useActionState, Error Handling and Auth Checks

A Server Action is a public POST endpoint, not a private function. Authenticate, validate with zod, authorize per resource and return safe errors to useActionState.

Next.js 16 React 19 Zod 4
Diagram Try the challenge
10 min Read tip
DevOps Hard

Rolling vs Blue-Green vs Canary: Deploying Without Breaking the Database

Every deploy runs two versions at once against one database. Compare rolling, blue-green and canary, and learn expand/contract, feature flags and real rollbacks.

Kubernetes 1.33 Laravel 13 PHP 8.4
Diagram Try the challenge
9 min Read tip
JavaScript Medium

Cancelling Work with AbortController: fetch, AbortSignal.timeout, AbortSignal.any and Search

Stale search results and abandoned server work share one fix. Learn AbortController, AbortSignal.timeout and AbortSignal.any, plus cleanup that does not leak.

Node.js 22 TypeScript 5.9 React 19
Diagram Try the challenge
9 min Read tip
DevOps Medium

Health Checks Done Right: Liveness vs Readiness vs Startup Probes

A database query in a liveness probe can turn a 40-second failover into a full outage. Learn what each probe should check, with Kubernetes, Docker and Laravel /up.

Kubernetes 1.33 Laravel 13 PHP 8.4
Diagram Try the challenge
9 min Read tip
JavaScript Medium

Promise.all vs allSettled vs race vs any: Semantics, Error Handling, Timeouts and Concurrency Limits

One flaky service took down a whole dashboard through Promise.all. Learn what each combinator really does, how to add timeouts, and how to cap concurrency.

Node.js 22 TypeScript 5.9
Diagram Try the challenge
10 min Read tip
Laravel Medium

Laravel Pipelines: Turn a 340-Line Checkout Controller into Small, Testable Steps

Use the Laravel Pipeline facade to split checkout flows and query filters into pipe classes you can reorder, reuse and unit test, with the pitfalls to avoid.

Laravel 13 PHP 8.4
Diagram Try the challenge
9 min Read tip
Security Medium

Verifying Webhook Signatures with HMAC: Raw Body, Timing-Safe Compare and Replay Protection

A webhook URL is a public endpoint that changes your data. Verify HMAC signatures on the raw body, compare in constant time and block replays with timestamps.

Laravel 13 PHP 8.4 Node.js 22
Diagram Try the challenge
10 min Read tip
PHP Medium

PHP Enums Beyond the Basics: Backed Enums, Methods, tryFrom and Eloquent Casts

One 'canceled' vs 'cancelled' typo can strand orders for days. Use backed enums with methods, interfaces, tryFrom and Eloquent casts to kill magic strings.

PHP 8.4 Laravel 13 Python 3.12
Diagram Try the challenge
11 min Read tip
DevOps Hard

Zero-Downtime Database Migrations with Expand/Contract: Rename Columns Without Breaking Deploys

Renaming a column mid-deploy breaks old servers and queue workers. Use expand/contract, batched backfills and the right deploy order to change schemas safely.

Laravel 13 PHP 8.4 Mysql 8.4
Diagram Try the challenge
12 min Read tip
Security Medium

Password Hashing Done Right: bcrypt vs Argon2id, Cost Tuning and Rehash on Login

MD5 and SHA-256 crack in hours once a dump leaks. Pick bcrypt or Argon2id, tune the cost on real hardware and upgrade old hashes on login in PHP and Laravel.

PHP 8.4 Laravel 13 Python 3.13
Diagram Try the challenge
11 min Read tip
JavaScript Medium

JavaScript Event Loop: Microtasks vs Macrotasks, Predicting Output Order, and Starving the Loop

Sync code, then all microtasks, then one macrotask. Use that rule to predict Promise vs setTimeout order and to stop async loops from freezing Node.

Node.js 22 Ecmascript 2024
Diagram Try the challenge
11 min Read tip
Laravel Medium

Laravel Job Batching vs Chains: Progress, Failures, allowFailures and then/catch/finally

Bus::chain runs jobs in order and stops at the first failure; Bus::batch runs them in parallel with progress and callbacks. Learn exactly when then, catch and finally fire.

Laravel 13 PHP 8.4
Diagram Try the challenge
10 min Read tip
DevOps Medium

Circuit Breaker Pattern: Stop Hammering a Service That Is Already Down

Retries alone can bury a struggling dependency. Learn how a circuit breaker fails fast, lets the service recover and probes it safely, with PHP, Python and Laravel code.

PHP 8.4 Python 3.12
Diagram Try the challenge
6 min Read tip
DevOps Medium

Exponential Backoff with Jitter: Retrying Failed Requests the Right Way

Why naive exponential backoff causes retry storms, and how adding random jitter smooths out the load, with a full-jitter retry implementation in PHP and Python.

PHP 8.4 Python 3.12
Diagram Try the challenge
4 min Read tip
Laravel Medium

Idempotency Keys: Preventing Duplicate Payments in Distributed Systems

Why idempotency keys matter in payment APIs, how to implement them safely with a database-backed store, and common pitfalls like race conditions and key collisions.

PHP 8.4
Diagram
4 min Read tip
DevOps Medium

Docker Multi-Stage Builds for Smaller Images

Reduce your Docker image size dramatically using multi-stage builds.

Docker 20.10+
Diagram
2 min Read tip
PHP Medium

PHP 8.4 Property Hooks Explained

Discover the new property hooks feature in PHP 8.4 that provides a cleaner way to add logic to property access.

PHP 8.4
1 min Read tip
Laravel Medium

Laravel Query Optimization with Eager Loading

Learn how to optimize database queries in Laravel by using eager loading to prevent N+1 query problems.

Laravel 11.x PHP 8.2+
Diagram
2 min Read tip
JavaScript Easy

JavaScript Async/Await Best Practices

Master async/await in JavaScript with these best practices and common pitfalls to avoid.

JavaScript ES2017+
Diagram
1 min Read tip