scribase
One command

Add a backend to a Vite React app with one command

A single-page app needs a backend it can call straight from the browser, with the rules enforced on the server. One command sets that up: database, auth, storage and realtime, with the public keys in .env.local and a client in src/lib.

What you see (your project URL will differ)terminal
$ npx scribase init
Backend ready: https://acme-my-app-production-c2b0ea0a.scribase.com
  framework   vite
  project     acme/my-app (production)
  env file    .env.local (VITE_SUPABASE_URL, VITE_SUPABASE_ANON_KEY, SCRIBASE_API_URL, SCRIBASE_ORG, SCRIBASE_PROJECT, SCRIBASE_ENV)
  client      src/lib/supabase.ts

Next:
  - import { supabase } from './src/lib/supabase' and query: await supabase.from('todos').select()
  - create tables with SQL migrations (supabase/migrations/*.sql) and `scribase db push`, or the MCP server

1.Run init

Run it in the project root. If you are not signed in, it prints a link and a code: approve it in the browser (sign up takes one click plus the $1 card check, credited back), and init carries on. No key is ever pasted. It creates the project, writes the env file, adds the env file to .gitignore, installs @supabase/supabase-js and writes a small client module.

bash
npx scribase init

2.What it wrote

Vite exposes VITE_ variables to browser code as import.meta.env. The service role key is never written for Vite projects, because everything a Vite app reads ends up in the bundle.

.env.localbash
# Scribase (written by `npx scribase init`)
VITE_SUPABASE_URL=https://acme-my-app-production-c2b0ea0a.scribase.com
VITE_SUPABASE_ANON_KEY=<publishable key>
SCRIBASE_API_URL=https://api.scribase.com
SCRIBASE_ORG=acme
SCRIBASE_PROJECT=my-app
SCRIBASE_ENV=production

3.Create your first table

Open your project in the console, go to Editor, then SQL, and run this. Or ask your coding agent: with the Scribase MCP server connected it applies the same SQL as a migration. Row-level security is on, so the public key can only read what the policy allows.

sql
create table public.todos (
  id bigint generated always as identity primary key,
  title text not null,
  done boolean not null default false,
  created_at timestamptz not null default now()
);

alter table public.todos enable row level security;

create policy "todos are readable" on public.todos
  for select to anon, authenticated using (true);

insert into public.todos (title) values ('Ship the backend'), ('Tell a friend');

4.Use it in a component

Restart `npm run dev` once so Vite loads .env.local.

src/App.tsxtsx
import { useEffect, useState } from 'react';
import { supabase } from './lib/supabase';

type Todo = { id: number; title: string };

export default function App() {
  const [todos, setTodos] = useState<Todo[]>([]);
  useEffect(() => {
    supabase.from('todos').select('id, title').then(({ data }) => setTodos(data ?? []));
  }, []);
  return <ul>{todos.map((t) => <li key={t.id}>{t.title}</li>)}</ul>;
}
Let your agent do it

Paste this into Claude Code, Cursor or Codex

The agent runs init, asks you to approve once in the browser, creates the table and wires up the first screen.

Vite + React setup promptprompt
Add a Scribase backend to this Vite + React app.
1. Run `npx scribase init --yes --json` in the project root. If it returns authorization_pending, show me the link and code, wait for me to approve, then run it again.
2. Create a `todos` table (id, title, done, created_at) with row-level security on and a policy that lets anyone read it; use the Scribase MCP server or a SQL migration, not the service-role key in app code.
3. Render the todos in src/App.tsx with the client in src/lib/supabase.ts.
4. Never print, log or commit the env file; it is already in .gitignore.

Connect the MCP server first so the agent can run SQL safely: connect your agent.

FAQ

Common questions

Where do secrets go if everything is in the browser?

Nowhere in the app. Anything privileged runs as a policy in the database or in an edge function; the browser only ever holds the publishable key.

Does it work with Vite + Vue, Solid or Preact?

Yes. Detection only looks for Vite, so the env file and client are the same; only the component code differs.

Your Vite + React backend, live in a minute

$9 a month per project, flat. Sign up with one click; the $1 card check is credited to your first invoice.

Start now