export const sqlSetup = `-- Create the table create table instruments ( id bigint primary key generated always as identity, name text not null ); -- Insert sample data into the table insert into instruments (name) values ('violin'), ('viola'), ('cello'); -- Grant the privileges the role needs, which is read access grant select on public.instruments to anon; -- Enable row level security for the table alter table instruments enable row level security; -- Create a policy to allow the anon role to read from the instruments table create policy "public can read instruments" on public.instruments for select to anon using (true);` ## 1. Create a Supabase project Before you can use Supabase, you need a Supabase project. You can create a project visually in the Dashboard or programmatically using [the Management API](/docs/reference/api/introduction). Create a new Supabase project from [the Dashboard of any organization](/dashboard/new/_) you belong to. You can also use [database.new](https://database.new) to create a new Supabase project. First, get your access token from the [**Account Settings > Access Tokens**](/dashboard/account/tokens) section of the Dashboard. Then create a project using [the Management API](/docs/reference/api/introduction): ```bash export SUPABASE_ACCESS_TOKEN="your-access-token" # List your organizations to get the organization ID curl -H "Authorization: Bearer $SUPABASE_ACCESS_TOKEN" \ https://api.supabase.com/v1/organizations # Create a new project (replace with your organization ID) curl -X POST https://api.supabase.com/v1/projects \ -H "Authorization: Bearer $SUPABASE_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "organization_id": "", "name": "My Project", "region": "us-east-1", "db_pass": "" }' ``` ## 2. Install agent skills (optional) [Agent Skills](/docs/guides/ai-tools/ai-skills) are curated instruction sets that give your AI agent procedural knowledge about working with Supabase. Install them in your project with: ```bash npx skills add supabase/agent-skills ``` ## 3. Set up your database When your Supabase project is up and running, create an `instruments` table with some sample data. Then set only the privileges each Postgres role needs, add [Row Level Security (RLS)](/docs/guides/database/postgres/row-level-security) for enhanced security for database data by default, and create an RLS policy to make the data in the table publicly readable. Save some steps by clicking here to prefill the SQL in the SQL Editor, and then clicking **Run**. Or do this manually in your project's [SQL Editor](/dashboard/project/_/sql/new), by pasting the SQL below, and clicking **Run**. ```sql SQL_EDITOR -- Create the table create table instruments ( id bigint primary key generated always as identity, name text not null ); -- Insert sample data into the table insert into instruments (name) values ('violin'), ('viola'), ('cello'); -- Grant the privileges the role needs, which is read access grant select on public.instruments to anon; -- Enable row level security for the table alter table instruments enable row level security; -- Create a policy to allow the anon role to read from the instruments table create policy "public can read instruments" on public.instruments for select to anon using (true); ``` If you disabled the Data API during project setup, enable it in the [**Integrations > Data API**](/dashboard/project/_/integrations/data_api/settings) section of the Dashboard and expose the specific tables or functions you want to access. To automatically grant access for new tables and functions in `public`, enable **Automatically expose new tables**.