DEV Community

Cover image for I Built a Free Code Sharing Tool Because Pastebin Has Too Many Ads
Muhammad Tayyab
Muhammad Tayyab

Posted on

I Built a Free Code Sharing Tool Because Pastebin Has Too Many Ads

Every developer shares code snippets. Daily.

During code reviews, pair programming, debugging sessions, Slack conversations, Stack Overflow questions — we're constantly copying and pasting code between places.

And yet the tools we have for this are either:

  • GitHub Gist — great, but requires login. Too much friction for a 15-line snippet you'll forget about tomorrow.
  • Pastebin — been around forever, but the ads have gotten unbearable. Also no real syntax highlighting.
  • Hastebin — was perfect. Minimalist, fast. But it's been unreliable lately.
  • Pasting into Slack/Discord — formatting gets destroyed. Anything over 10 lines becomes unreadable.

So I built my own: Code Share on DevPik

What It Does

Exactly what you'd expect, nothing more:

  1. Paste your code
  2. Pick a language (20+ supported)
  3. Optionally add a title and expiry time
  4. Click "Share Code"
  5. Get a short URL — send it to anyone

That's it. The person who opens the link sees your code with syntax highlighting, a copy button, and the language badge. No login wall. No ads. No cookie banners.

The Expiry Feature

This is the one thing I wanted that most paste tools don't offer well. Not every snippet needs to live forever.

You can set expiry to:

  • 1 hour — for "hey look at this real quick" moments
  • 24 hours — for code review discussions that'll be done by tomorrow
  • 7 days — for sprint-length collaboration
  • 30 days — for longer projects
  • Never — for permanent reference snippets

Expired links return a clean 404 instead of stale code floating around forever.

How I Built It

Frontend: Next.js (App Router) + TypeScript + Tailwind CSS

Backend: Supabase (PostgreSQL)

How it works:

When you click "Share Code", the frontend sends a POST request to a Next.js API route. The route generates a random 8-character alphanumeric short code, inserts the snippet into a pastes table in Supabase, and returns the shareable URL.

When someone opens a shared link (devpik.com/p/abc12345), a server component fetches the paste by short code, checks if it's expired, increments the view count, and renders the code with syntax highlighting.

The database schema is simple:

CREATE TABLE pastes (
  id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
  short_code TEXT UNIQUE NOT NULL,
  title TEXT DEFAULT 'Untitled',
  content TEXT NOT NULL,
  language TEXT DEFAULT 'plaintext',
  view_count INTEGER DEFAULT 0,
  expires_at TIMESTAMPTZ,
  created_at TIMESTAMPTZ DEFAULT now()
);
Enter fullscreen mode Exit fullscreen mode

Row Level Security is enabled — anyone can insert and read pastes, but nobody can update or delete them (except through the admin dashboard).

Supported Languages

JavaScript, TypeScript, Python, HTML, CSS, JSON, SQL, Bash, Go, Rust, Java, C, C++, PHP, Ruby, Swift, Kotlin, YAML, XML, Markdown, and Plaintext.

Syntax highlighting is handled client-side so the code never needs to be processed by any external service.

What I'd Like to Add Next

A few things I'm considering:

  • Password-protected snippets — for sharing sensitive code privately
  • Fork/edit — click a button to create a new snippet based on an existing one
  • Raw text endpointdevpik.com/p/abc12345/raw for piping into curl
  • CLI toolcat file.js | dpk to create a paste from terminal

Try It

👉 devpik.com/developer-tools/code-share

No login. No ads. No tracking. Just paste code, get a link.

If you share code snippets regularly, give it a try and let me know what's missing. I'm building this based on what developers actually need, so feedback goes directly into the next update.


I'm Tayyab — I build free developer tools at devpik.com. This is one of 24 tools on the site, all free, most running 100% in the browser. Follow me for more.

Top comments (0)