Public
Serverless pastebin backed by Supabase
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.

πŸ“‹ Supabase Pastebin

A serverless pastebin running on Val Town, with all pastes stored in a free-tier Supabase Postgres database.

Setup (one time, ~3 minutes)

1. Create the table in Supabase

In your Supabase project, open SQL Editor and run:

create table if not exists pastes ( id text primary key, title text, language text default 'text', content text not null, created_at timestamptz not null default now() ); -- This val uses the service_role key, which bypasses RLS. -- Keep RLS enabled so the table isn't exposed via the public anon key. alter table pastes enable row level security;

2. Add your Supabase credentials as environment variables

Find these in Supabase under Project Settings β†’ API:

  • SUPABASE_URL β€” your project URL, e.g. https://abcd1234.supabase.co
  • SUPABASE_KEY β€” your service_role key (secret; never expose it client-side)

Add them here:

πŸ‘‰ SUPABASE_URL: https://www.val.town/x/eliana/supabase-pastebin/environment-variables?key=SUPABASE_URL

πŸ‘‰ SUPABASE_KEY: https://www.val.town/x/eliana/supabase-pastebin/environment-variables?key=SUPABASE_KEY

That's it β€” open the val's HTTP endpoint and start pasting.

Routes

MethodPathDescription
GET/Web UI to create a paste
POST/api/pastesCreate a paste (JSON body)
GET/p/:idView a paste (HTML)
GET/api/pastes/:idGet a paste as JSON
GET/raw/:idGet the raw paste content as text

Create via API

curl -X POST "$ENDPOINT/api/pastes" \ -H "content-type: application/json" \ -d '{"content":"hello world","title":"My note","language":"text"}'

Architecture

Rendering mermaid diagram...