The CodeKits notebook
Ideas into working code.
Practical tutorials, project walkthroughs and development notes. Explore the code, understand the structure, and build something of your own.
16 articles · Newest first
Next.js
Add resumable uploads with progress and cancellation
Build resumable upload progress around server-confirmed chunks, distinguish pause from cancel, and recover safely after an uncertain response.
· 4 min read
Next.js
Add canonical URLs, social cards, RSS and sitemaps
Give a Next.js blog consistent canonical URLs, share images, RSS and sitemap entries using one published-post collection and real dates.
· 3 min read
Next.js
Add drafts and scheduled blog publication
Use one publication rule for blog pages, listings, RSS and sitemaps, then account for timezone boundaries and cached pages when scheduling posts.
· 4 min read
Next.js
Resize blog images and remove camera metadata
Prepare blog images with bounded uploads, orientation correction, WebP resizing and metadata removal while keeping useful alt text and captions.
· 4 min read
Next.js
Build expiring download links with Next.js and MySQL
Design expiring private download links with random bearer tokens, hashed lookup values, database expiry and authorization at the download boundary.
· 4 min read
Next.js
Build Next.js on a memory-limited VPS
Measure Next.js build memory, distinguish heap failures from OOM kills, and reduce avoidable work without silently skipping validation.
· 4 min read
Next.js
Clean up expired uploads without deleting active files
Use explicit upload states and expiring claims to clean abandoned data, retry storage failures and reconcile orphans without racing active transfers.
· 4 min read
Next.js
Deploy Next.js on Ubuntu with Nginx and systemd
Deploy a Next.js release behind Nginx on Ubuntu, run it as an unprivileged systemd service, add HTTPS and verify each layer.
· 4 min read
Next.js
Make download limits safe under concurrent requests
Use atomic database claims for limited downloads, define whether attempts or sessions count, and handle retries and ranges without overselling delivery.
· 4 min read
Next.js
Move a PHP blog to Next.js and keep its URLs
Move a PHP blog to Next.js with an explicit URL inventory, permanent redirects, preserved publication dates and a tested rollback plan.
· 4 min read
Next.js
Build a Markdown blog with Next.js metadata
Create a Markdown publishing pipeline with validated frontmatter, article metadata and readable dates in a Next.js App Router website.
· 4 min read
Next.js
Resume large uploads after iPhone browser suspension
Recover mobile uploads using server-confirmed chunks and explicit resume actions, without promising that iPhone browsers keep uploading in the background.
· 4 min read
Next.js
Stage a Next.js release and roll back safely
Build Next.js in a separate release directory, smoke-test before promotion and restore a known-good release without overwriting live files.
· 4 min read
Next.js
Stream large uploads in Next.js
Stream bounded upload chunks into private storage, reject oversized bodies, and handle partial writes without holding the complete file in memory.
· 4 min read
Next.js
Stream ZIP downloads without buffering whole folders
Design a streaming ZIP export with an authorized immutable manifest, bounded resources, backpressure and explicit handling of interrupted archives.
· 4 min read
Next.js
Upload folders and preserve their directory tree
Preserve a selected folder's relative paths while rejecting traversal, duplicate portable names and file-directory conflicts before storing any bytes.
· 4 min read
