Add a backend to a Flutter app
npx scribase init is for JavaScript projects, so a Flutter app takes the manual path, which is short: create the project in the console, copy two values, and use the supabase_flutter package, which works with Scribase unchanged.
1.Create the backend
Sign up in the console (one click plus the $1 card check, credited back). Your first project is created automatically and the "Your backend is live" screen shows the Project URL and the publishable key with one-click copy.
2.Add the package
supabase_flutter is the Dart client for this API; Scribase is wire-compatible with it.
flutter pub add supabase_flutter3.Initialize it at startup
Read the values from --dart-define so they never sit in source control.
import 'package:flutter/material.dart';
import 'package:supabase_flutter/supabase_flutter.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Supabase.initialize(
url: const String.fromEnvironment('SUPABASE_URL'),
anonKey: const String.fromEnvironment('SUPABASE_ANON_KEY'),
);
runApp(const MyApp());
}
final supabase = Supabase.instance.client;4.Run with the two values
Or put them in a JSON file and pass --dart-define-from-file=env.json (and add env.json to .gitignore).
flutter run \
--dart-define=SUPABASE_URL=https://acme-my-app-production-c2b0ea0a.scribase.com \
--dart-define=SUPABASE_ANON_KEY=<publishable key>5.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.
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');6.Query from a widget
A FutureBuilder is enough for a first screen.
final todos = await supabase.from('todos').select('id, title');
// todos is a List<Map<String, dynamic>>: [{id: 1, title: 'Ship the backend'}, ...]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.
Add a Scribase backend to this Flutter app.
1. Add supabase_flutter with `flutter pub add supabase_flutter`.
2. Initialize it in lib/main.dart from String.fromEnvironment('SUPABASE_URL') and String.fromEnvironment('SUPABASE_ANON_KEY'); I will pass them with --dart-define-from-file=env.json. Create env.json with placeholder values and add it to .gitignore.
3. Create a `todos` table with row-level security on and a read policy using the Scribase MCP server or a SQL migration.
4. Show the todos on the home screen with a FutureBuilder. Never put the service role key in the app.Connect the MCP server first so the agent can run SQL safely: connect your agent.
Common questions
Will npx scribase init support Flutter?
It does not today; in a folder without package.json it would write a JavaScript client you do not need. Use the console path above, which takes about a minute.
Do auth deep links work?
Yes. Configure the redirect URL for your app scheme in the project auth settings, exactly as supabase_flutter documents.
Your Flutter 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