Skip to content
Go back / Studio

Code Snippets Manager

A Next.js 16 app for saving, tagging, and sharing code snippets, with an AI generator that turns a plain-English prompt into titled, tagged, syntax-highlighted code — snippets are stored in Supabase and shareable via tokenized links.

Code Snippets Manager

Overview

personal2026-06

A Next.js 16 app for saving, tagging, and sharing code snippets, with an AI generator that turns a plain-English prompt into titled, tagged, syntax-highlighted code — snippets are stored in Supabase and shareable via tokenized links.

Tech stack
Next.jsTypeScriptSupabaseTailwind CSSOpenAIshadcn/uiVercel

Challenges & Learnings

The app solves a small, real annoyance: scattered snippets with no fast way to save, search, and share them. A user either pastes a snippet directly or describes what they need in plain English; the description goes to an LLM endpoint which returns structured JSON — title, content, language, tags — parsed straight into a Supabase table alongside a share token and copy counter. Two decisions stand out. Every API route degrades gracefully — a config check short-circuits with a 503 and a setup hint if Supabase or the AI provider isn't configured, so the app runs and can be demoed with nothing wired up. And rate limiting is custom in-memory middleware, simple and dependency-free, with the same per-instance tradeoff as the rest of this stack: on Vercel's serverless model it's not a shared global limit. The AI response parser is defensive too, regexing for a JSON object or fenced code block and falling back to a generic shape if the model's output doesn't parse cleanly. A custom dynamic OG image route renders a themed code-editor mockup per snippet for link previews.