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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.