Recipes
Step-by-step solutions for real development tasks.
699 published
Page 5 of 20
Generate an SBOM in the Build Pipeline
Produce a Software Bill of Materials on every build so downstream consumers can audit transitive dependencies.
Detect Schema Drift Between Environments
Dump the schema from staging and production and diff them so a missing index or column is caught before deploy.
Sync Secrets from External Secrets Operator
Reference a secret in the external secrets store so Kubernetes pulls and rotates it without the value ever touching Git.
Automate Secret Rotation with a Cron Job
Schedule a rotation job that generates a new secret, updates consumers, and verifies the old one is revoked within one hour.
Set Secure Cookie Attributes Consistently
Add Secure, HttpOnly, SameSite=Strict to every auth cookie so it is not sent over HTTP, not readable by JS, and not included in cross-site requests.
Enable mTLS Across the Service Mesh
Turn on strict mTLS in the mesh so all inter-service traffic is encrypted and a pod on a compromised node cannot sniff calls.
Cache API Responses with a Service Worker Strategy
Use stale-while-revalidate for API calls so the page loads instantly from cache and updates in the background.
Inject a Sidecar with a Mutating Webhook
Configure a mutating admission webhook so every pod in the namespace gets a proxy sidecar without developers editing specs.
Show Skeleton Placeholders During Data Fetch
Render a skeleton that matches the layout so the user sees structure immediately and there is no layout shift when data arrives.
Define an SLO Error Budget and Burn Policy
Set a 99.9 percent SLO with a 30-day window so the error budget is explicit and a burn rate triggers a freeze on deploys.
Review Snapshot Diffs Before Updating
Configure snapshot tests to fail on mismatch and require a reviewed update flag so blind --update-snapshot does not hide regressions.
Cascade Soft Deletes to Child Records
Set deleted_at on the parent and all children in one transaction so a soft delete is consistent without orphaned rows.
Add Span Attributes for Log Correlation
Attach the user ID and request ID as span attributes so a trace can be correlated to logs and the user's journey is visible.
Detect SQL Injection with Parameterized Queries
Replace string concatenation in SQL with parameterized queries so a user input of ' OR 1=1 -- cannot escape the query structure.
Redrive SQS Dead-Letter Queue Messages
Move messages from the DLQ back to the source queue after fixing the consumer so failed messages are retried not abandoned.
Block SSRF with a Fetch Allowlist
Validate every outbound URL against a host allowlist before fetching so a user-supplied URL cannot reach internal metadata endpoints.
Model Complex UI State with XState
Replace nested boolean flags with a state machine so impossible states like loading AND error are unrepresentable.
Emit Structured JSON Logs for Parsing
Replace console.log with a JSON logger so logs are machine-parseable and queryable in the aggregation system.
Scan for Subdomain Takeover Vulnerabilities
Check dangling DNS records that point to unprovisioned cloud services so an attacker cannot claim the CNAME and host content on your subdomain.
Monitor with Synthetic Probes from Multiple Regions
Run a synthetic check every minute from three regions so a regional outage is detected before users report it.
Enable Terraform State Locking with S3 and DynamoDB
Configure a DynamoDB lock table so concurrent terraform runs do not corrupt the state file.
Use Builder Pattern for Readable Test Data
Create a builder fluent API for test fixtures so complex objects are constructed with only the fields each test cares about.
Isolate Test Database per Worker with Transactions
Wrap each test in a transaction that rolls back so parallel workers never see each other's data and tests are order-independent.
Verify Test Environment Parity with Production
Compare the test and production dependency versions and config so a bug that only reproduces on a version skew is caught early.
Retry Flaky Network Tests with Backoff
Add exponential backoff retry to tests that hit external APIs so transient 503s do not fail the pipeline.
Distribute a Timeout Budget Across Hops
Subtract each hop's elapsed time from the total budget so the last hop gets the remainder not a fresh full timeout.
Pin TLS Certificates for Mobile API Clients
Embed the expected certificate hash so a compromised CA or MITM proxy is rejected even if the chain is technically valid.
Stack Toast Notifications with a Queue Limit
Cap the visible toasts at 3 and queue the rest so a burst of 10 notifications does not cover the screen.
Sample Traces at the Tail for Completeness
Buffer all spans and sample at the end so traces with errors are always kept and healthy traces are sampled by rate.
Retry Transactions on Deadlock with Jitter
Detect a deadlock error, wait with jitter, and retry the transaction so concurrent operations do not permanently fail.
Tree Shake Unused Exports with Side Effects Flag
Mark the package with sideEffects false so the bundler drops unused exports and the bundle shrinks by 30 percent.
Migrate from Serial to UUID Primary Keys
Add a UUID column, backfill with generated values, make it the primary key, and drop the serial so offline ID guessing is impossible.
Reclaim Bloat with a Targeted Vacuum
Run VACUUM with a threshold on the dead tuple ratio so only bloated tables are vacuumed aggressively, not the whole database.
Virtual Scroll Large Lists for Constant DOM
Render only the visible window of a 10000-row list so the DOM stays under 100 nodes and scrolling is smooth.
Set a Visual Regression Threshold per Component
Configure per-component pixel diff thresholds so minor anti-aliasing differences pass but real layout shifts fail the build.
Access Services Privately with a VPC Endpoint
Create a VPC endpoint so traffic to S3 or DynamoDB stays on the AWS network and never traverses the public internet.