Recipes

Step-by-step solutions for real development tasks.

699 published

Page 8 of 20

Version Terraform Modules Properly

Tag module releases, pin module sources to exact versions, keep inputs documented, and use a lock file so plans are reproducible.

~35 min
terraform · iac · reliability

Share Turborepo Cache Across CI and Developers

Configure remote caching, declare task inputs and outputs precisely, and use the cache so a task already run anywhere is not repeated locally or in CI.

~35 min
turborepo · ci · performance

Issue Dynamic Database Credentials with Vault

Configure a database secrets engine so each application instance gets a short-lived credential it does not have to store, and revoke on lease expiry.

~50 min
security · secrets · databases

Right-Size Pods with the Vertical Pod Autoscaler

Run VPA in recommendation mode first, review suggested requests and limits, then enable it in a controlled mode so pods get resources matching real usage.

~40 min
kubernetes · autoscaling · performance

Provision WireGuard Peers Automatically

Generate peer keys, assign addresses and allowed IPs, and reload the interface so new peers join the mesh without hand-editing config or restarting tunnels.

~40 min
networking · vpn · automation

Add Schema Validation to a Form

Define one schema, validate on the client for instant feedback, and reject invalid payloads on the server so no rules live only in the browser.

~30 min
validation · forms · typescript

Build an Accessible Tabs Component

Create a tabs widget with correct ARIA roles, roving tabindex, and arrow-key navigation so keyboard and screen-reader users can switch panels reliably.

~45 min
accessibility · frontend · aria

Issue a Wildcard Certificate with DNS-01

Use the ACME DNS-01 challenge with a provider API token to obtain wildcard certificates, and automate renewal before expiry.

~40 min
tls · acme · automation

Implement a Consistent API Response Envelope

Wrap every JSON response in a uniform success/error envelope so clients parse results, errors, and pagination without special-casing each endpoint.

~30 min
api-design · rest · consistency

Encrypt Sensitive Fields at the Application Layer

Encrypt sensitive columns before writing and decrypt after reading, key by tenant where needed, and keep indexes on deterministic derived values instead of plaintext.

~50 min
security · encryption · databases

Version Packages with Changesets

Have contributors add a changeset describing the change, let CI open a version PR that bumps packages and updates the changelog, then publish on merge.

~40 min
monorepo · release · ci

Deduplicate Concurrent Client Requests

Share one in-flight promise among callers of the same resource so a burst of identical requests hits the network once.

~30 min
frontend · performance · http

Gate Compose Services on Health

Add healthchecks and depends_on conditions so services that need a database wait for it to be healthy, not merely started.

~20 min
docker · compose · reliability

Store and Honor Consent Records

Record what each user consented to, when, and under which policy version, then gate optional processing on the current consent so you can prove and honor it.

~45 min
privacy · compliance · security

Tune Consumer Prefetch for Fair Throughput

Set prefetch limits per consumer, use manual acknowledgements, and size the value from processing time so one slow message does not starve the worker pool.

~35 min
messaging · performance · reliability

Set Concurrency Policy on CronJobs

Choose Forbid, Replace, or Allow intentionally, set deadlines and history limits, and make the job idempotent so an overlap cannot double-process data.

~30 min
kubernetes · jobs · scheduling

Implement a Debounced Autocomplete

Debounce keystrokes, cancel stale requests, and render suggestions in order so the list always reflects the latest query without flooding the API.

~35 min
frontend · performance · api-design

Speed Up Docker Builds with BuildKit Cache

Order layers from least to most volatile, mount caches for dependencies, and use a registry or GitHub Actions cache so CI rebuilds reuse work.

~35 min
docker · buildkit · ci

Refresh a Double-Submit CSRF Token Safely

Issue a random CSRF token in a readable cookie and require it in a header, refreshing it on login and comparing with a constant-time check.

~35 min
security · csrf · web

Bind Tokens to the Client with DPoP

Use a proof-of-possession key so a stolen bearer token cannot be replayed from another machine, and validate the proof and its replay id at the resource server.

~50 min
authentication · oauth · security

Envelope-Encrypt Data with a KMS

Generate a data key per object, encrypt data with it locally, and wrap the data key with a KMS master key so rotation does not require re-encrypting everything.

~45 min
security · encryption · kms

Migrate ESLint to Flat Config

Replace the eslintrc cascade with a flat eslint.config.js, compose typed rule sets explicitly, and keep overrides per file pattern.

~40 min
eslint · tooling · typescript

Add Snapshots to an Event-Sourced Aggregate

Persist periodic snapshots so rebuilding an aggregate does not replay thousands of events, and version snapshots so a schema change can invalidate them safely.

~45 min
event-sourcing · performance · data

Automate Image Updates with Flux

Add an ImageRepository and ImagePolicy, let Flux commit the selected tag back to Git, and keep deployments moving without manually editing tags.

~45 min
gitops · flux · deployment

Propagate gRPC Deadlines in a Service Chain

Set a deadline on every gRPC call, forward the remaining time to downstream calls, and return DEADLINE_EXCEEDED instead of waiting forever.

~35 min
grpc · reliability · timeouts

Harden Third-Party Iframes with Sandbox

Sandbox embedded iframes to the minimum tokens they need, never grant top navigation, and combine with a strict CSP allowlist.

~30 min
security · web · iframe

Implement Infinite Scroll with IntersectionObserver

Load the next page when a sentinel enters the viewport, guard against duplicate requests, and keep a keyboard-accessible fallback for users who never scroll.

~40 min
frontend · performance · ux

Shift Traffic Progressively with Istio

Split traffic between stable and canary with VirtualService weights, watch metrics, and promote or roll back by changing weights rather than redeploying.

~45 min
istio · kubernetes · deployment

Write with an Atomic Kafka Produce-and-Commit

Use transactions so a database commit and a Kafka produce either both happen or neither does, and set a stable transaction id for fencing.

~50 min
kafka · transactions · reliability

Scale on Queue Depth with KEDA

Use KEDA to scale a consumer deployment from queue length, set a sensible target and cooldown, and scale to zero when the queue is empty.

~45 min
kubernetes · autoscaling · messaging

Implement Leader Election with Leases

Elect a single leader using a renewable lease, let followers detect expiry, and make steps idempotent so a brief dual-leader window is harmless.

~45 min
distributed-systems · scheduling · reliability

Implement Secure Magic-Link Login

Issue a single-use, short-lived, hashed token in an email link, verify it atomically, and bind it to the requesting context to prevent reuse.

~40 min
authentication · passwordless · security

Cache Negative Results Safely

Cache not-found results for a short period to protect against repeated lookups, but keep the TTL short and bypass it on user-visible writes.

~30 min
caching · performance · reliability

Add Nginx Rate Limiting Near the Edge

Define a shared memory zone, apply a limit_req with burst and nodelay, and return 429 so abusive clients are slowed before they reach the application.

~30 min
nginx · rate-limiting · reliability

Isolate Workloads with Taints and Tolerations

Taint special nodes so only workloads that tolerate them are scheduled there, and pair it with node affinity so pods land where they belong.

~30 min
kubernetes · scheduling · infrastructure

Build Only Affected Projects with Nx

Let Nx compute the affected graph from the changed files, run only affected targets in CI, and cache outputs so untouched projects are never rebuilt.

~40 min
nx · ci · performance