Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Add codehike steps

Terry Sutton64814d44270e
diff --git a/apps/docs/components/index.tsx b/apps/docs/components/index.tsx
index 0097630387b..2c6de4992b5 100644
--- a/apps/docs/components/index.tsx
+++ b/apps/docs/components/index.tsx
@@ -1,5 +1,6 @@
import { Button, Tabs, Alert, GlassPanel } from 'ui'
import Link from 'next/link'
+import StepHikeCompact from '~/components/StepHikeCompact'
// Common components
import Admonition from './Admonition'
@@ -50,6 +51,7 @@ const components = {
ProjectSetup,
SocialProviderSetup,
SocialProviderSettingsSupabase,
+ StepHikeCompact,
StorageManagement,
Mermaid,
Extensions,
diff --git a/apps/docs/pages/guides/cli/local-development.mdx b/apps/docs/pages/guides/cli/local-development.mdx
index 72850146edc..5405bf6d3eb 100644
--- a/apps/docs/pages/guides/cli/local-development.mdx
+++ b/apps/docs/pages/guides/cli/local-development.mdx
@@ -103,7 +103,7 @@ You can use the [supabase stop](/docs/reference/cli/usage#supabase-stop) command
## Access your project's services
-You can access these services directly with any Postgres client or through the API Gateway ([Kong](https://github.com/Kong/kong)).
+You can now visit your local Dashboard at [http://localhost:54323](http://localhost:54323), and access the services directly with any Postgres client or through the API Gateway ([Kong](https://github.com/Kong/kong)).
<Tabs
scrollable
@@ -177,86 +177,179 @@ Database changes are managed through "migrations." Database migrations are a com
></iframe>
</div>
-### Make database changes
-
For this guide, we'll create a table called `employees` and see how we can make changes to it.
-To get started, generate a [new migration](https://supabase.com/docs/reference/cli/supabase-migration-new) to store the SQL needed to create our `employees` table:
+<StepHikeCompact>
+
+ <StepHikeCompact.Step step={1}>
+ <StepHikeCompact.Details title="Create your first migration file">
+
+ To get started, generate a [new migration](https://supabase.com/docs/reference/cli/supabase-migration-new) to store the SQL needed to create our `employees` table
+
+ </StepHikeCompact.Details>
+
+ <StepHikeCompact.Code>
```bash
supabase migration new create_employees_table
```
-This creates a new migration named `supabase/migrations/<timestamp>_create_employees_table.sql`. To that file, add the SQL to create this `employees` table:
+ </StepHikeCompact.Code>
+
+ </StepHikeCompact.Step>
+</StepHikeCompact>
+
+<StepHikeCompact>
+
+ <StepHikeCompact.Step step={2}>
+ <StepHikeCompact.Details title="Add the SQL to your migration file">
+ This creates a new migration: supabase/migrations/\<timestamp\>
+ _create_employees_table.sql.
+
+ To that file, add the SQL to create this `employees` table
+ </StepHikeCompact.Details>
+
+ <StepHikeCompact.Code>
+ ```sql
-```sql
create table
- employees (
- id integer primary key generated always as identity,
- name text
- );
-```
+employees (
+id integer primary key generated always as identity,
+name text
+);
-Now that we have a migration file, we can run this migration and create our `employees` table. We use the `reset` command here to reset the database to the current migrations:
+````
-```bash
+ </StepHikeCompact.Code>
+
+ </StepHikeCompact.Step>
+</StepHikeCompact>
+
+
+
+
+<StepHikeCompact>
+
+ <StepHikeCompact.Step step={3}>
+ <StepHikeCompact.Details title="Apply your migration">
+ Now that you have a migration file, you can run this migration and create the `employees` table.
+
+ Use the `reset` command here to reset the database to the current migrations
+ </StepHikeCompact.Details>
+
+ <StepHikeCompact.Code>
+ ```bash
supabase db reset
-```
+````
-Now you can visit your new `employees` table in the Dashboard.
+ </StepHikeCompact.Code>
+
+ </StepHikeCompact.Step>
+</StepHikeCompact>
+
+<StepHikeCompact>
+
+ <StepHikeCompact.Step step={4}>
+ <StepHikeCompact.Details title="Modify your employees table">
+ Now you can visit your new `employees` table in the Dashboard.
+
+ Next, modify your `employees` table by adding a column for department. Create a new migration file for that.
+ </StepHikeCompact.Details>
+
+ <StepHikeCompact.Code>
+ ```bash
+ supabase migration new add_department_to_employees_table
+
+````
+ </StepHikeCompact.Code>
+
+ </StepHikeCompact.Step>
+</StepHikeCompact>
-Next, let's modify our `employees` table by adding a column for department. Let's create a new migration file for that:
-```bash
-supabase migration new add_department_to_employees_table
-```
-This creates a new migration named `supabase/migrations/<timestamp>_add_department_to_employees_table.sql`. To that file, add the SQL to create a new department column:
+<StepHikeCompact>
-```sql
+ <StepHikeCompact.Step step={5}>
+ <StepHikeCompact.Details title="Add a new column to your table">
+ This creates a new migration file: supabase/migrations/\<timestamp\>
+ _add_department_to_employees_table.sql.
+
+ To that file, add the SQL to create a new department column
+ </StepHikeCompact.Details>
+
+ <StepHikeCompact.Code>
+ ```sql
alter table
if exists public.employees add department text default 'Hooli';
-```
+````
+
+ </StepHikeCompact.Code>
+
+ </StepHikeCompact.Step>
+</StepHikeCompact>
### Add sample data
-Use the seed script in `supabase/seed.sql` (created with [`supabase init`](/docs/reference/cli/usage#supabase-init)) to add sample data to the table.
+Now that you are managing your database with migrations scripts, it would be great have some seed data to use every time you reset the database.
+
+For this, you can use the seed script in `supabase/seed.sql`. This file was automatically created when you ran [`supabase init`](/docs/reference/cli/usage#supabase-init)) at the beginning.
+
+<StepHikeCompact>
+
+ <StepHikeCompact.Step step={1}>
+ <StepHikeCompact.Details title="Populate your table">
+ Insert data into your `employees` table with your `supabase/seed.sql` file.
+ </StepHikeCompact.Details>
-```sql
- -- in supabase/seed.sql
+ <StepHikeCompact.Code>
+ ```sql
+
+-- in supabase/seed.sql
insert into
- public.employees (name)
+public.employees (name)
values
- ('Erlich Bachman'),
- ('Richard Hendricks'),
- ('Monica Hall');
-```
+('Erlich Bachman'),
+('Richard Hendricks'),
+('Monica Hall');
-Rerun the migration and seed scripts:
+````
+ </StepHikeCompact.Code>
-```bash
-supabase db reset
-```
+ </StepHikeCompact.Step>
+</StepHikeCompact>
-You should now see the contents of `employees` in Studio. All of your database changes are captured in code, and you can reset to a known state at any time, complete with seed data.
-## Deploy your project
+<StepHikeCompact>
-Go to the [Supabase Dashboard](https://app.supabase.com) and create a project to deploy the changes.
+ <StepHikeCompact.Step step={2}>
+ <StepHikeCompact.Details title="Reset your database">
+ Reset your database (apply current migrations), and populate with seed data
+ </StepHikeCompact.Details>
-### Link your project
+ <StepHikeCompact.Code>
+ ```bash
+supabase db reset
+````
-<Admonition type="note">
+ </StepHikeCompact.Code>
-There are a few commands required to link your project. We are in the process of consolidating these commands into a single command. Bear with us!
+ </StepHikeCompact.Step>
+</StepHikeCompact>
-</Admonition>
+You should now see the `employees` table, along with your seed data in the Dashboard! All of your database changes are captured in code, and you can reset to a known state at any time, complete with seed data. The last step is deploying these changes to a live Supabase project.
+
+## Deploy your project
+
+You've been developing your project locally, making changes to your tables via migrations. Its' time to deploy your project to the Supabase Platform and start scaling up to millions of users! Head over to [Supabase](https://app.supabase.com) and create a new project to deploy to.
+
+### Link your project
Associate your project with your remote project using [`supabase link`](/docs/reference/cli/usage#supabase-link).
```bash
supabase link --project-ref <project-id>
-# You can get <project-id> from your project’s dashboard URL: https://app.supabase.com/project/<project-id>
+# You can get <project-id> from your project's dashboard URL: https://app.supabase.com/project/<project-id>
supabase db remote commit
# Capture any changes that you have made to your database before setting up the CLI
@@ -265,6 +358,12 @@ supabase db remote commit
`supabase/migrations` is now populated with a migration in `..._remote_commit.sql`.
This migration captures any changes required for your local database to match the schema of your remote Supabase project.
+<Admonition type="note">
+
+There are a few commands required to link your project. We are in the process of consolidating these commands into a single command. Bear with us!
+
+</Admonition>
+
### Deploy database changes
Deploy any local database migrations using [`db push`](/docs/reference/cli/usage#supabase-db-push):
@@ -275,19 +374,19 @@ supabase db push
### Deploy Edge Functions
-Deploy any Edge Functions using [`functions deploy`](/docs/reference/cli/usage#supabase-functions-deploy):
+If your project uses Edge Functions, you can deploy these using [`functions deploy`](/docs/reference/cli/usage#supabase-functions-deploy):
```sh
supabase functions deploy <function_name>
```
-## Limitations
+## Limitations and considerations
-The local development environment is not as feature-complete as the Supabase Platform. Here are some of the differences:
+The local development environment is not as feature-complete as the Supabase Platform. We're working towards parity between the hosted platform and the local environment. Here are some of the differences:
- The Functions interface is coming soon.
-- Logs are not supported through the interface (however you can access them through the Docker containers).
-- You cannot update your project settings in the Dashboard—this must be done using the CLI.
+- Logs are not supported through the interface, but you can access them through the Docker containers.
+- You cannot update your project settings in the Dashboard. This must be done using the CLI.
export const Page = ({ children }) => <Layout meta={meta} children={children} />