mirror of
https://github.com/supabase/supabase.git
synced 2026-10-08 10:55:06 +03:00
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? - Cleaning of partial affecting all frameworks first steps for database setup. - Removed unnecessary and somehow broken accordion. - Improved copy. - Removed unnecessary button. As a result instruction for both LLMs and humans are inline, though encoded link is not produce, the instructions are below for agents to pick. <img width="889" height="797" alt="Screenshot 2026-07-06 at 17 27 22" src="https://github.com/user-attachments/assets/91a4fda0-5be9-4452-bcf9-93540f4c88f7" /> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Simplified the “Set up your database” quickstart into a clearer, single-step flow. * Embedded the complete setup SQL directly in the guide for easy copy/paste. * Replaced the prior prefill button and accordion/manual steps with a tip containing a prefilled-SQL link, plus optional guidance to run the SQL as needed. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Chris Chinchilla <chris.ward@supabase.io>
127 lines
4.1 KiB
Plaintext
127 lines
4.1 KiB
Plaintext
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).
|
|
|
|
<Tabs scrollable size="small" type="underlined" defaultActiveId="dashboard" queryGroup="create-project">
|
|
|
|
<TabPanel id="dashboard" label="Dashboard">
|
|
|
|
Create a new Supabase project from [the Dashboard of any organization](/dashboard/new/_) you belong to.
|
|
|
|
<Admonition type="tip">
|
|
|
|
You can also use [database.new](https://database.new) to create a new Supabase project.
|
|
|
|
</Admonition>
|
|
|
|
</TabPanel>
|
|
|
|
<TabPanel id="management-api" label="Management API">
|
|
|
|
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 <org-id> 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": "<org-id>",
|
|
"name": "My Project",
|
|
"region": "us-east-1",
|
|
"db_pass": "<your-secure-password>"
|
|
}'
|
|
```
|
|
|
|
</TabPanel>
|
|
|
|
</Tabs>
|
|
|
|
## 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.
|
|
|
|
<Admonition type="tip">
|
|
|
|
Save some steps by <a href={`/dashboard/project/_/sql/new?content=${encodeURIComponent(sqlSetup)}`}>clicking here to prefill the SQL</a> in the SQL Editor, and then clicking **Run**.
|
|
|
|
</Admonition>
|
|
|
|
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);
|
|
```
|
|
|
|
<Admonition type="note" label="Disabled the Data API during project setup?">
|
|
|
|
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**.
|
|
|
|
</Admonition>
|