Inspiration
As developers, we constantly find ourselves writing the same utility functions, boilerplate code, and clever one-liners across multiple projects. We were tired of digging through old repositories, Slack messages, and random text files just to find that one snippet we wrote six months ago. We wanted a dedicated, clean space to store, organize, and share code snippets — something that felt like a personal vault for a developer's best work. That idea became snip.it.
What it does
snip.it is a code snippet manager built for developers. It lets you:
- Save and organize code snippets with titles, descriptions, tags, and language labels
- Search and filter your vault by language or tag instantly
- Archive snippets you no longer need active but don't want to delete
- Share any snippet publicly via a unique shareable link, no login required for viewers
- Collaborate by creating groups, inviting teammates by GitHub username, and sharing snippets within the team
- Each group has its own archive — Active and Archived tabs per group keep every team's workspace independently organized
- Switch between light and dark mode with syntax highlighting powered by CodeMirror 6 across 16 languages
How we built it
We divided the project across our four-person team by area of expertise:
- Database & Infrastructure (Aayush) — Designed the full PostgreSQL schema on
Supabase including all six tables, foreign key relationships, indexes, and Row Level
Security policies. Built security-definer helper functions to prevent RLS recursion
on group membership queries. Built the Supabase client integration and all data
access functions for snippets, groups, tags, and users. Implemented the AuthContext
with proper session handling, the auto-profile trigger for GitHub OAuth users, and
parallel tag synchronization using
Promise.all. Handled all deployment configuration on Vercel. - Pages (Veerpartap and Shaan) — Built all route-level page components including the dashboard, editor, viewer, share page, archived page, auth callback flow, and the group collaboration page with per-group Active/Archived tab switching and search and filter support across all views.
- Components & UI (Darwin) — Built the entire component library from scratch in plain CSS with no UI framework — sidebar, snippet cards, tag input, code editor wrapper, and icon system.
Challenges we ran into
- Row Level Security recursion — Our group membership policies initially caused
infinite recursion because the policy on
group_memberswas subquerying itself. We solved this by writingsecurity definerhelper functions that bypass RLS when called inside policies. - Group creation chicken-and-egg problem — When a user created a group, the
insert succeeded but the subsequent insert into
group_membersfailed because the groups select policy only allowed members to see groups — and the creator wasn't a member yet. Fixed by updating the policy to also allow the owner to see their own group immediately after creation. - Auth state on cold start — The
onAuthStateChangelistener had a race condition where signing out and back in without a page reload left the user stuck as null. We refactored to separate first-load resolution from the persistent listener. - Public share links for unauthenticated users — Supabase blocks the
anonrole from reading tables by default. Share links showed "not found" for logged-out visitors until we explicitly grantedselecton snippets and users to theanonrole. - Stale closure in keyboard shortcuts — The
Cmd+Ssave shortcut was capturing a stale version of the save function because the effect dependency array was incomplete. Fixed by wrapping the save handler inuseCallbackand using it as the sole dependency. - Tags upsert silently hanging — Saving snippets with tags would buffer
indefinitely. The root cause was a missing UPDATE policy on the
tagstable — Supabase upsert requires both INSERT and UPDATE permission to work correctly.
Accomplishments that we're proud of
- Built a fully functional production-ready app from scratch during the hackathon with real users already using it
- Designed a clean RLS security model that properly isolates personal snippets, group snippets, and public snippets without any data leaking between users
- The per-group archive system — each group has its own completely independent Active / Archived tab keeping team workspaces clean
- A public share page that works with zero authentication, renders full syntax-highlighted code, and includes a sign-up CTA
- The entire UI is built in plain CSS with no component library — every button, card, modal, and layout was hand-crafted
What we learned
- How PostgreSQL Row Level Security works at a deep level — writing policies that reference each other without causing infinite recursion was a real lesson in how the database evaluates queries
- The difference between
security definerandsecurity invokerfunctions in Postgres and when each is appropriate - How CodeMirror 6's extension-based architecture works — everything from syntax highlighting to themes to keybindings is just an extension added to an array
- How React's
useCallbackanduseEffectdependency arrays interact — getting the keyboard shortcut right taught us how stale closures form and how to prevent them - The full GitHub OAuth flow through Supabase and the importance of updating redirect URLs in both Supabase and the GitHub OAuth app when deploying to production
What's next for snip.it
- Ownership transfer on group deletion — currently deleting your account removes your groups. The next version will automatically promote the longest-standing member to owner so the group survives
- Star / favourite system — pin your most-used snippets to the top of your vault
- Snippet versioning — track the edit history of a snippet over time
- Embed widget — drop a read-only syntax-highlighted snippet into any webpage with one line of HTML
- VS Code extension — save snippets directly from your editor without opening the browser
- Snippet duplication — clone any snippet as a starting point for a new one
Try it yourself
Prerequisites
- Node.js 18+
- A Supabase project with GitHub OAuth enabled
Installation
# 1. Clone the repository
git clone https://github.com/Iamaayush00/snip.it.git
cd snip.it
# 2. Install dependencies
npm install
# 3. Configure environment variables
cp .env.example .env
# Fill in your Supabase project URL and anon key
# 4. Run the database schema
# Paste the contents of supabase-schema.sql into the Supabase SQL editor and run it
# 5. Start the dev server
npm run dev
For further setup instructions including deployment and Supabase configuration, please refer to the GitHub repository.
Built With
- codemirror6
- css
- githuboauth
- javascript
- postgresql
- react
- react-hot-toast
- react-router-dom
- supabase
- vercel
- vite
Log in or sign up for Devpost to join the conversation.