Skip to content

hengm3467/snippet-manager

Repository files navigation

Snippet Manager

Personal project for storing and sharing code snippets.

Features

  • Create/Edit/Delete snippets with Monaco Editor (27+ languages)
  • Public/Private toggle - Public snippets can be embedded
  • Embed functionality - JavaScript embed code for external websites
  • Authentication - Email/password + GitHub OAuth via Supabase

Tech Stack

  • Next.js 16.1.1 (App Router) + React 19.2.3 + TypeScript
  • Tailwind CSS 4
  • Supabase (Auth + PostgreSQL with RLS)
  • Monaco Editor

Environment Variables

NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key

Database Schema

CREATE TABLE snippets (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  user_id UUID REFERENCES auth.users(id) ON DELETE CASCADE,
  title TEXT NOT NULL,
  code TEXT NOT NULL,
  language VARCHAR(50) NOT NULL,
  description TEXT,
  is_public BOOLEAN DEFAULT false,
  created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
  updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);

With RLS policies:

  • Users can only view/modify their own snippets
  • Public snippets are viewable by everyone

Routes

  • / - Landing page
  • /login - Sign in/up
  • /auth/callback - OAuth callback
  • /dashboard - My snippets
  • /snippets/new - Create new
  • /snippets/[id] - View snippet
  • /snippets/[id]/edit - Edit snippet
  • /embed/[id] - Embed endpoint

Development

npm run dev    # Start dev server
npm run build  # Build for production
npm run start  # Start production server
npm run lint   # Run ESLint

About

Managing code snippets in all your tutorials, blog posts, or documentation in one place.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors