MonkeyTips

Bite-sized, battle-tested engineering tips — with runnable code, diagrams and challenges.
Most tip content, techniques, and guidance steps are developed with AI assistance.
shape
shape
shape
shape
shape
shape
shape
shape
Clear filters

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 · 21 Read tip
Database Hard

Database Deadlocks: Detection, Diagnosis, and Prevention

How relational databases detect deadlocks with wait-for graphs, why they happen, and concrete techniques to prevent them in high-concurrency systems.

Postgresql 13+
Diagram
5 min read · 102 Read tip
Database Hard

Distributed Locking with Redis: Understanding the Redlock Algorithm

A deep dive into the Redlock algorithm for safe distributed locking across multiple Redis nodes, including failure modes, clock drift, and the fencing token fix.

Redis 7.x
Diagram
6 min read · 237 Read tip
DevOps Medium

Git Interactive Rebase: Clean Up Your Commit History Before a PR

Learn how to use git rebase -i to squash, reorder, and edit commits so your pull requests tell a clean, reviewable story.

Git 2.40+
Diagram
4 min read · 264 Read tip
Database Medium

Redis Caching Strategies: Cache-Aside vs Write-Through

Compare cache-aside and write-through caching with Redis, including consistency trade-offs, TTL strategy, and when to use each pattern.

Redis 7.x
Diagram
4 min read · 218 Read tip
JavaScript Medium

TypeScript Utility Types: Pick, Omit, and Partial Explained

Stop duplicating interfaces for every slightly-different shape. Pick, Omit, and Partial let you derive new types from one source of truth — here's when to reach for each.

TypeScript 5.x
Diagram
3 min read · 231 Read tip
Security Medium

Rate Limiting APIs: Token Bucket vs Sliding Window

Fixed windows let clients burst 2x at the boundary. See how token bucket and sliding window rate limiting actually work, with Redis-backed implementations and the pitfalls that break them in production.

Redis 6.x+ Node 18.x+
Diagram
2 min read · 232 Read tip
Next.js Medium

Next.js App Router: Server Components vs Client Components

Server Components run only on the server; Client Components hydrate in the browser. See how Next.js App Router renders both, and when to actually reach for 'use client'.

Next 14.x - 15.x React 18.x - 19.x
Diagram
3 min read · 1,093 Read tip
JavaScript Medium

Debounce vs Throttle in JavaScript: Control How Often Code Runs

Scroll, resize, and keystroke events fire dozens of times a second. Learn how debounce and throttle rate-limit them — and which one to reach for.

JavaScript ES6+
Diagram
2 min read · 1,030 Read tip
Database Medium

Database Indexes: Turn a Full Scan Into an Instant Lookup

See why a query without an index scans every row, how an index turns it into a fast lookup, and how to read EXPLAIN to tell the difference.

SQL ANSI / MySQL 8+
Diagram Try the challenge
2 min read · 1,815 Read tip
PHP Easy

Preventing SQL Injection in PHP

Learn essential techniques to protect your PHP applications from SQL injection attacks.

PHP 8.0+
Diagram Try the challenge
2 min read · 986 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 Try the challenge
2 min read · 2,169 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
Try the challenge
1 min read · 1,351 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 Try the challenge
2 min read · 1,637 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 Try the challenge
1 min read · 2,136 Read tip