Learning Resources

Tutorials

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

Page 2 of 9

How to Sanitize Before Validate

Sanitize user input with DOMPurify before validation so HTML payloads are stripped of scripts, and the validator sees only the safe text it expects.

Form Validation

How to Scaffold a Project from a CLI

Scaffold a project from a CLI template so the user gets a working starter with their name and choices filled in, in one command.

Cli Tooling

How to Scan an Upload for Viruses

Scan uploaded files with ClamAV asynchronously so malware is rejected before storage, and the upload response waits only for the scan result.

File Upload

How to Secure a JWT Against CSRF

Secure JWT-based auth against CSRF with a double-submit cookie or SameSite, so a cross-site request cannot ride the session cookie.

Auth Jwt

How to Show a CLI Progress Bar

Show a progress bar in the CLI for long tasks so the user knows the task is running and roughly how long is left.

Cli Tooling

How to Sniff Magic Bytes

Detect the real file type by reading the first bytes, so a renamed executable is rejected even when the extension and Content-Type claim it is an image.

File Upload

How to Store a JWT Safely in the Browser

Store access tokens in memory and refresh tokens in httpOnly cookies, so XSS cannot exfiltrate the refresh token and a page refresh restores the session.

Auth Jwt

How to Stream a FastAPI UploadFile

Stream a FastAPI UploadFile in chunks so large files do not load into RAM, and the server stays responsive under concurrent uploads.

File Upload

How to Time a Password Reset Safely

Send password reset tokens with a constant-time comparison and a uniform response, so attackers cannot enumerate accounts by response timing.

Auth Jwt

How to Use TanStack Query for Server State

Use TanStack Query to manage server state so caching, background refetch, and optimistic updates are declarative and the UI stays in sync with the server.

Data Fetching

How to Validate an Array of Objects

Validate a dynamic array of objects with Zod so each item gets its own error path and the UI can highlight the exact row that fails.

Form Validation

How to Validate Config at Startup with Zod

Validate config at startup with Zod so the process exits with a clear message on bad config, and the type is inferred for the rest of the app.

Config Management

How to Validate a Credit Card with Luhn

Validate credit card numbers with the Luhn algorithm and a brand regex, so typos are caught before the payment gateway and the brand is shown inline.

Form Validation

How to Validate a Date Range Cross Field

Validate that a start date is before an end date using a cross-field schema, so the rule lives in the schema and the UI can show the error on either field.

Form Validation

How to Validate Dependent Selects

Validate cascading select dropdowns where the child options depend on the parent value, so an orphan child value is rejected at the boundary.

Form Validation

How to Validate Email Format

Validate email addresses with a pragmatic regex and a DNS MX hint, so format errors are caught instantly and non-deliverable domains are flagged async.

Form Validation

How to Validate an Enum from Config

Build a Zod enum from a runtime config array so the schema stays in sync with the config, and unknown values are rejected without a code deploy.

Form Validation

How to Validate File Size and Type

Check file size and type before uploading so oversized or unsupported files are rejected on the client without wasting bandwidth.

Form Validation

How to Validate Image Dimensions

Validate image dimensions on upload with sharp so avatars are square and banners are wide, and non-conforming images are rejected before storage.

File Upload

How to Validate a Number Range with Step

Validate that a number falls within a range and aligns to a step, so quantity inputs reject fractional steps and out-of-range values at the boundary.

Form Validation

How to Validate Phone Numbers in E.164

Validate phone numbers in E.164 format with libphonenumber, so international numbers are normalized and invalid lengths are rejected before SMS send.

Form Validation

How to Validate RHF Field Arrays

Use useFieldArray to validate dynamic lists of inputs in React Hook Form, so append, remove, and swap preserve the validation state of each row.

Form Validation

How to Validate a URL Against an Allowlist

Validate URLs against an origin allowlist to prevent open redirects and SSRF, so only approved hosts are accepted for redirects and server-side fetches.

Form Validation

How to Validate in a Vue 3 Composable

Build a useValidation composable in Vue 3 so reactive form state, errors, and validity stay in one function reusable across components.

Form Validation

How to Validate a Webhook Signature

Validate a webhook signature with HMAC so a forged webhook is rejected, and replay is prevented with a timestamp check.

Data Integrity

How to Validate with Valibot

Use Valibot as a lightweight schema library for tree-shakeable validation, so the bundle stays small when only a few checks run on the client.

Form Validation

How to Validate Zod Discriminated Unions

Use Zod discriminated unions to validate payloads that share a tag field, so each variant gets its own schema and the wrong variant fails at the boundary.

Form Validation

How to Verify an Email on Signup

Verify email ownership with a signed token link so the account is created only after the user proves control of the inbox.

Auth Jwt

How to build a CLI with subcommands

Structure a CLI into subcommands with shared global flags, per-command help, and a dispatch table so adding a command is one entry.

Cli Tooling

How to cleanup orphaned upload artifacts

Find and delete temporary upload files that were never finalized, using a TTL marker and a scheduled sweep that is safe to run concurrently.

File Upload

How to enforce upload size limits

Reject uploads that exceed a byte budget early in the stream, before they consume disk or memory, with a clear 413 response.

File Upload

How to handle multi-step form state

Manage wizard form state across steps with per-step validation, back navigation that preserves data, and a final atomic submit.

Form Validation

How to Add PKCE to a SPA OAuth Flow

Generate a code verifier and challenge so a public client proves it holds the secret without sending it, blocking authorization code interception.

Auth Jwt

How to Add SRI to Script and Link Tags

Add an integrity attribute with the file hash so a CDN compromise cannot swap a script the browser trusts without the hash changing.

Security Boundaries

How to Build a CLI Plugin Architecture

Load commands from node_modules packages with a naming convention so a CLI extends without changes to its core and plugins ship independently.

Cli Tooling

How to Build a CLI with Rust Clap

Use Clap derive macros to define args and subcommands so a Rust CLI gets parsing, validation, and help from a struct definition.

Cli Tooling

How to Build a Custom Zod Refinement

Write a Zod refinement for a business rule that built-in validators cannot express, keep it composable, and test it with edge cases.

Form Validation

How to Build a Drag-and-Drop Upload Zone

Build a React drop zone that handles dragenter, dragover, and drop, shows visual feedback, and falls back to a file input for keyboard users.

File Upload

How to Build a Type-Safe Form Builder

Build a form builder in TypeScript where the field config, the value type, and the error shape are all derived from one schema definition.

Form Validation

How to Build ABAC Permission Checks

Check attributes of the user, the resource, and the action in a policy so a rule can express owner-only edits without enumerating every role.

Auth Jwt

How to Chunk Files for Resumable Uploads

Split a large file into fixed-size chunks on the client, upload each independently, and reassemble on the server so a retry is one chunk not the whole file.

File Upload

How to Coalesce Requests at the Edge

Collapse identical requests at the CDN edge so a cache miss for one user serves the same response to the next thousand without hitting the origin.

Data Fetching

How to Crash on Bad Config at Boot

Parse and validate config before the service starts so a missing key crashes in the deploy, not in the first request at 3 a.m.

Data Integrity