Learning Resources

Tutorials

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

Page 4 of 9

How to Sanitize HTML with DOMPurify

Pass user HTML through DOMPurify with an allowlist so script tags and event handlers are stripped before the HTML reaches the DOM.

Security Boundaries

How to Scan Uploads for Viruses Async

Pipe uploaded files to ClamAV in a background task so the user does not wait on the scan and infected files are quarantined after detection.

File Upload

How to Secure JWTs Against CSRF

Use a double-submit cookie so a cross-site request lacks the cookie-bound token and the server rejects it before the JWT is ever checked.

Auth Jwt

How to Show Accessible Error Summaries

Render a linked, aria-live error summary that lists every invalid field so screen reader users hear what to fix and can jump to it.

Form Validation

How to Store JWTs Safely in Browsers

Choose between httpOnly cookies and in-memory storage by the threat model, never localStorage for sensitive tokens, and defend against XSS and CSRF.

Auth Jwt

How to Stream Partial JSON to the Client

Parse a JSON stream incrementally so the UI renders the first items before the full response arrives and the user sees progress not a spinner.

Data Fetching

How to Stream Uploads Without Buffering

Pipe a multipart upload straight to storage with Node streams so a 2 GB file never sits in memory and the server stays responsive under load.

File Upload

How to Sync Client and Server Schemas

Share one Zod schema between client and server so the validation rules never drift and a change in one place updates both sides.

Form Validation

How to Upload to S3 with Presigned URLs

Generate a presigned S3 URL so the browser uploads directly to the bucket and your server never proxies the bytes or pays for the bandwidth.

File Upload

How to Validate Credit Cards with Luhn

Implement the Luhn checksum to validate credit card numbers client-side, strip spaces, and reject obviously invalid input early.

Form Validation

How to Validate Dates Across Timezones

Parse, normalize, and compare dates across timezones with a library so a midnight UTC date does not become the wrong day locally.

Form Validation

How to Validate Enum Inputs in Forms

Validate select and radio inputs against an enum so a tampered POST with an out-of-range value is rejected at the boundary, not in the UI.

Form Validation

How to Validate JWT Claims Strictly

Check the issuer, audience, expiry, and required claims on every token so a token from the wrong audience or a missing role is rejected at the boundary.

Auth Jwt

How to Validate Multipart Boundaries

Parse multipart form data with a streaming parser that enforces boundary and part limits so a malformed request cannot exhaust the server.

File Upload

How to Validate Nested Data with Zod

Compose Zod object schemas to validate deeply nested data and collect every error path so the user sees all problems at once.

Data Integrity

How to Validate on Blur vs Submit

Choose when validation fires so blur gives early feedback without blocking typing and submit gives the full check before the request leaves.

Form Validation

How to Validate Password Strength Scores

Score password strength with a rule set for length, character classes, and entropy, show feedback live, and reject weak passwords at submit.

Form Validation

How to implement async form validation

Validate form fields against the server without blocking typing, debouncing requests and cancelling stale ones with AbortController.

Form Validation

How to implement CLI progress bars

Show a progress bar for long tasks by writing carriage returns to the same line, and hide it when stdout is not a TTY.

Cli Tooling

How to implement graceful degradation

Serve a reduced experience when a dependency is down by falling back to cached data or a default, never showing an error page for a non-critical feature.

Resilience

How to implement OAuth2 PKCE flow

Secure public-client authorization with PKCE by generating a code verifier, sending its challenge, and validating on token exchange.

Auth Jwt

How to queue work during outages

When a downstream service is down, enqueue the work in a durable queue and process it on recovery instead of failing the user request.

Resilience

How to sanitize HTML output against XSS

Encode data on output, not input, and use a context-aware encoder so values inserted into HTML, attributes, or script contexts are all safe.

Security Boundaries

How to secure JWT against CSRF

Store JWT in an httpOnly cookie with SameSite=strict and a double-submit token for stateless CSRF defense, not in localStorage.

Auth Jwt

How to stream partial JSON responses

Parse a large JSON stream incrementally as chunks arrive, so the UI can render the first items before the whole response downloads.

Data Fetching

How to sync conflicting concurrent edits

Resolve concurrent edits to the same record with last-write-wins per field or a CRDT merge, so collaboration does not silently drop changes.

Data Fetching