Carefully crafted code snippets, zero bloat, pure explanation.
SnippetCrafted is a human-curated library of verified copy-paste recipes for React, Next.js, regex patterns, and Tailwind. Every entry comes with full source code, performance notes, and the gotchas that bite you in production.
Interactive Snippets Deck
useDebounce
Delay updating a value until the input has stopped changing.
"Search boxes and live filters that fire a request on every keystroke waste API calls and feel janky. useDebounce holds off updating the value it returns until a set delay has passed with no new changes, so you only act once the user has actually paused typing."
useLocalStorage
Sync component state with localStorage without breaking on the server.
Token bucket rate limiter
In-memory rate limiting for a Next.js route handler.
Webhook signature verification
Verify an incoming webhook payload before trusting it.
Indian mobile number
Match a 10-digit Indian mobile number, with or without +91.
Responsive navbar with mobile drawer
A navbar that collapses into a slide-out drawer on small screens.
useOnClickOutside
Detect clicks outside of an element, useful for closing dropdowns or modals.
useMediaQuery
React state hook that tracks media query matches in real-time.
JWT signature verification
Extract and verify JSON Web Tokens (JWT) in route handlers.
RFC 5322 Email regex
A robust, standard-compliant email matching pattern.
Secure password complexity
Check for minimum complexity (length, numbers, letters, symbols).
Glassmorphism modal dialog
A modern, animated backdrop blur modal component.
Why SnippetCrafted?
Production Tested
Every single line of code in our index is tested inside active web systems, assuring you avoid initial bugs or build breaks.
Gotchas Included
We focus on warning you about visual flashes, API rate limits, or hydration errors that developers usually miss when copy-pasting.
MIT Licensed
All code snippets are completely free to use in your personal, academic, or commercial systems. No attribution required.