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.
A serverless pastebin running on Val Town, with all pastes stored in a free-tier Supabase Postgres database.
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;
Find these in Supabase under Project Settings β API:
SUPABASE_URLβ your project URL, e.g.https://abcd1234.supabase.coSUPABASE_KEYβ yourservice_rolekey (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.
| Method | Path | Description |
|---|---|---|
| GET | / | Web UI to create a paste |
| POST | /api/pastes | Create a paste (JSON body) |
| GET | /p/:id | View a paste (HTML) |
| GET | /api/pastes/:id | Get a paste as JSON |
| GET | /raw/:id | Get the raw paste content as text |
curl -X POST "$ENDPOINT/api/pastes" \ -H "content-type: application/json" \ -d '{"content":"hello world","title":"My note","language":"text"}'
Rendering mermaid diagram...