Learning Resources

Tutorials

Step-by-step guides and in-depth articles to level up your skills.

Page 8 of 9

How to Implement CQRS

Separate the write and read models: write to a normalized model, project to a read model, keep them eventually consistent, and query the read side.

Data Integrity

How to Implement Distributed Tracing

Trace a request across services: create spans, propagate the trace context, record useful attributes, and read the trace to find the slow hop.

Resilience

How to Implement Efficient Bulk Deletes

Delete large volumes of rows efficiently: batch the deletes, control vacuum and bloat, prefer partition or table drops, and avoid long locks.

Data Integrity

How to Implement Event Sourcing Tables

Model event sourcing in SQL: append immutable events, derive current state by replay, version aggregates, and snapshot to bound replay cost.

Data Integrity

How to Implement Golden File Tests

Use golden files to test large output: compare against a stored artifact, review the diff on a change, and update the golden deliberately.

Resilience

How to Implement HTTP Long Polling

Hold requests open until data arrives or a timeout fires, loop with AbortController and backoff, and respect connection budgets under HTTP/1.1.

Data Fetching

How to Implement Idempotent Data Loads

Make data loads safe to retry: upsert on a natural key, deduplicate within a batch, track load checkpoints, and test that a re-run changes nothing.

Data Integrity

How to Implement Memoization Safely

Memoize without breaking correctness: key by all inputs, bound the cache, invalidate when data changes, and avoid caching errors or mutable values.

Resilience

How to Implement Password Hashing with Argon2

Hash passwords with Argon2: pick memory and time parameters, store the full encoded hash, verify and upgrade hashes over time, and test the work factor.

Security Boundaries

How to Implement Prefetching Strategies

Prefetch before the user asks: predict the next request, warm the cache and connections, and avoid wasted work for predictions that miss.

Data Fetching

How to Implement Property-Based Testing

Test with properties: state an invariant, generate many inputs, shrink a failure to a minimal case, and keep the run reproducible with a seed.

Resilience

How to Implement Read-Write Locks

Use a read-write lock: let many readers in at once, exclude writers from readers, and avoid writer starvation with a fair policy.

Resilience

How to Implement Server-Timing Headers

Record and expose Server-Timing metrics, break down where request time goes, and use the header to debug latency without a denylisting conversation.

Resilience

How to Implement Service Discovery

Let services find each other: use DNS or a registry, resolve at call time, cache with a TTL, and handle the instance that has gone away.

Resilience

How to Implement Snapshot Testing Safely

Use snapshots without rubber-stamping: snapshot stable output, review every change, keep snapshots small, and add assertions the snapshot cannot make.

Resilience

How to Implement Static Asset Caching

Cache static assets effectively: fingerprint URLs, set immutable long max-age, differentiate HTML from assets, and test the caching policy.

Data Fetching

How to Implement Structured Concurrency

Use structured concurrency: tie child tasks to their scope, propagate cancellation and errors, and never leave a task running past its parent.

Resilience

How to Implement Structured Logging

Log structured events: emit JSON with stable fields, bind context, choose levels deliberately, and query logs as data rather than text.

Resilience

How to Implement the Outbox Pattern

Publish events reliably with the outbox: write the event and the change in one transaction, relay the outbox, and dedupe on the consumer.

Data Integrity

How to Implement the Saga Pattern

Coordinate a distributed transaction with a saga: run local steps, compensate on failure, and make each step and compensation idempotent.

Resilience

How to Inject Secrets at Runtime

Deliver secrets to an app at runtime instead of baking them in: load from a secret store, keep them out of images and env files, and rotate without rebuilds.

Security Boundaries

How to Negotiate Content with Accept Headers

Implement proactive content negotiation: parse Accept headers, honor quality values, choose a representation, and answer 406 only when truly nothing matches.

Data Fetching

How to Negotiate WebSocket Subprotocols

Use the Sec-WebSocket-Protocol header to select a versioned subprotocol, reject unsupported clients, and evolve the message format safely.

Resilience

How to Optimize Images for Delivery

Serve images fast: pick modern formats with fallbacks, size and density per client, lazy-load below the fold, and cache fingerprinted variants.

Data Fetching

How to Optimize JSON Serialization

Speed up JSON work: stream instead of buffering, avoid redundant stringify and parse, and pick a serializer that fits the payload.

Resilience

How to Optimize JSONB Aggregation Queries

Aggregate over JSONB efficiently: extract and cast in the right place, build expression indexes, and avoid per-row expansion that kills plans.

Data Integrity

How to Optimize JSONB Query Performance

Prefer containment operators, add expression and GIN indexes for hot paths, promote frequent fields to columns, and verify with EXPLAIN ANALYZE.

Data Integrity

How to Preserve Message Ordering

Preserve the order where it matters: partition by key so one entity stays ordered, and accept the cross-key parallelism as the design.

Resilience

How to Prevent Account Enumeration

Stop attackers from learning which accounts exist: uniform responses, constant-time paths, and identical timing for login, signup, and reset.

Security Boundaries

How to Prevent Path Traversal Attacks

Stop path traversal: reject .. and absolute paths, resolve against a fixed base, verify the result stays inside it, and test with encoded payloads.

Security Boundaries

How to Prevent Session Fixation Attacks

Stop session fixation by rotating the session identifier on login and privilege change, binding it to the browser, and invalidating the old one.

Security Boundaries

How to Prevent SSRF in Server-Side Requests

Validate schemes, resolve DNS and check the IP against private ranges, control redirects hop by hop, and pin the connection to the validated address.

Security Boundaries

How to Reduce Time to First Byte

Cut time to first byte: remove origin work before the first byte, stream the response, and use caching and connection reuse in front of the server.

Resilience

How to Refactor to Parameterized Queries

Replace string concatenation with driver placeholders, whitelist the identifiers placeholders cannot carry, and find legacy code by scanning.

Security Boundaries

How to Rotate Secrets Without Downtime

Give keys identifiers, verify with any active key while signing with the newest, overlap windows generously, and drain old usage to zero before removal.

Security Boundaries

How to Run Failure Injection Drills

Write hypotheses first, inject faults with bounded blast radius, auto-stop on guardrail breach, and convert findings into tracked fixes.

Resilience

How to Sanitize User-Generated HTML

Render user-generated content safely: prefer escaping over sanitizing, allowlist tags and attributes when HTML is required, and stop XSS at the sink.

Security Boundaries

How to Secure File Uploads in a Web API

Harden a multipart upload endpoint with size limits, magic-byte type checks, path containment, safe storage names, and malware scanning before serving.

Security Boundaries

How to Serve Stale-While-Revalidate

Serve stale content while refreshing in the background: set stale-while-revalidate, refresh on a hit, and keep the served value correct during the window.

Data Fetching

How to Stream CLI Output with Progress

Report long-running CLI progress: stream the output, update the progress in place, and disable it when the output is not a terminal.

Cli Tooling

How to Test Concurrent Code Reliably

Test concurrent code without flakes: control the schedule, use barriers and latches, assert invariants under contention, and run the race detector.

Resilience