Templates
35 curated code starters. Search, filter, copy, and build.
REST API with Express.js
A minimal Express.js REST API with CRUD endpoints for managing todo items, including JSON body parsing and error handling middleware.
React Custom Hook (useLocalStorage)
A type-safe React hook that persists state to localStorage with automatic serialization and deserialization.
Python Binary Search
Iterative and recursive binary search implementations that work on any sorted sequence, returning the index or -1.
Python Flask REST API
A lightweight Flask REST API with in-memory storage, request validation, and JSON error responses.
TypeScript Generic Stack
A fully typed generic Stack implementation with push, pop, peek, size, and iterator support.
Go HTTP Server
A production-style Go HTTP server with structured JSON logging, graceful shutdown, and health-check endpoint.
Rust CLI Argument Parser
A zero-dependency CLI argument parser that supports flags, options with values, and positional arguments.
SQL CRUD Queries
Complete CREATE, READ, UPDATE, DELETE queries for a users table with indexing, filtering, and pagination.
Docker Compose (Node + PostgreSQL)
A two-service Docker Compose file that runs a Node.js API alongside a PostgreSQL database with health checks and volume mounts.
GitHub Actions CI/CD Pipeline
A CI/CD workflow that runs tests on push/PR and deploys to a staging environment on the main branch.
Python Decorator Pattern
Reusable decorators for timing, retrying with exponential backoff, and singleton enforcement.
JavaScript Debounce & Throttle
Production-ready debounce and throttle utilities with leading/trailing edge options and cancel support.
React Context + Reducer Pattern
A type-safe React context combined with useReducer for global state management, complete with actions and a custom hook.
TypeScript Event Emitter
A fully typed, generic Event Emitter class supporting on, off, once, and emit with wildcard listeners.
Python Async Web Scraper
A concurrent web scraper using aiohttp and asyncio that fetches multiple pages with rate limiting and error handling.
JWT Auth Middleware (Node.js)
Express middleware for issuing and verifying JSON Web Tokens with configurable secret, expiry, and role-based authorization.
React Testing Library Component Test
A comprehensive test suite for a Counter component using React Testing Library and Vitest/Jest, covering user interactions and edge cases.
Python Sorting Algorithms Comparison
Implementations of bubble sort, merge sort, and quicksort with timing benchmarks and correctness verification.
Bash Script: Project Setup
A portable Bash script that scaffolds a new Node.js/TypeScript project with Git, ESLint, Prettier, and GitHub repo creation.
Next.js API Route with Zod Validation
A Next.js App Router API route that validates request bodies and query params using Zod schemas with proper error responses.
Python Data Class with Validation
A validated data class using __post_init__ for field constraints, a from_dict factory method, and serialization.
JavaScript Promise.all with Error Handling
Robust patterns for concurrent promise execution including settleAll, retryPromise, and batched execution.
TypeScript Middleware Chain Pattern
A composable middleware chain similar to Koa/Express that processes requests through a pipeline of async handlers.
SQL Window Functions
Advanced SQL queries demonstrating ROW_NUMBER, RANK, LAG/LEAD, running totals, and moving averages over an orders table.
Rust File Reader
A Rust utility that reads a text file line-by-line with buffered I/O, counts words and lines, and reports file metadata.
Go REST API with Chi
A clean REST API built with the Chi router featuring CRUD endpoints, JSON middleware, and a custom 404 handler.
Python SQLAlchemy ORM Model
SQLAlchemy 2.0 ORM models with relationships, a typed repository pattern, and query examples including joins and pagination.
JavaScript Deep Clone Utility
A deep clone utility that handles Date, RegExp, Map, Set, Array, plain objects, and circular references without structuredClone.
TypeScript Builder Pattern
A type-safe, fluent Builder pattern for constructing complex objects step-by-step with compile-time validation of required fields.
CSS Grid Layout System
A responsive CSS Grid layout system with utility classes, named grid areas, auto-fit responsive columns, and dark mode support.
Python FastAPI Endpoint
A complete FastAPI application with Pydantic models, path/query/body parameter validation, and automatic OpenAPI docs.
JavaScript Array Utility Functions
A library of reusable higher-order array utilities including chunk, flatten, unique, groupBy, sortBy, and zip.
Python LRU Cache Implementation
A from-scratch LRU cache using an OrderedDict with O(1) get/put operations, eviction policy, and a decorator interface.
YAML Kubernetes Deployment
A production-ready Kubernetes Deployment and Service manifest for a Node.js app with health checks, resource limits, and HPA.
TypeScript Result Error Handling
A Result monad type for functional error handling without try/catch, supporting map, flatMap, unwrap, and match.