Learning Resources

Tutorials

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

Page 2 of 9

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

How to Dedupe Rows by a Stable Hash

Hash each record, skip hashes seen in the window, and emit the rest so a load that runs twice does not double the data.

Data Integrity

How to Deduplicate Concurrent Requests

Share the in-flight promise for the same URL so three components fetching the same data fire one request and all three get the same result.

Data Fetching

How to Detect and Repair Data Drift

Compare the distribution of a dataset to a baseline and flag when it shifts so a silent change in the source is caught before it corrupts the output.

Data Integrity

How to Detect File Type by Magic Bytes

Read the first bytes of a file and match against a magic-number table so an uploaded exe renamed to jpg is caught before it is stored.

File Upload

How to Distribute a CLI via npx

Publish to npm so users run the tool with npx without a global install, and pin the Node engine so the right runtime is enforced.

Cli Tooling

How to Distribute Uploads Across Backends

Route uploads to different storage backends by file type or size so large videos go to object storage and small avatars stay on the local disk.

File Upload

How to Enforce File Size Limits Early

Reject uploads over the size limit before the first byte hits the server using a Content-Length check and a streaming guard that aborts on overflow.

File Upload

How to Fetch with Retry and Jitter

Retry with exponential backoff and jitter so a transient failure is retried but a fleet of clients does not hammer the server in sync after an outage.

Data Fetching