The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
refactors the CLI to be more "local dev" focused
Copple91b253f5634f
diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.tsindex e6896c46133..ecb9fc13495 100644--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts@@ -206,7 +206,6 @@ export const gettingstarted: NavMenuConstant = {items: [{ name: 'Features', url: '/guides/getting-started/features' },{ name: 'Architecture', url: '/guides/getting-started/architecture' },- { name: 'Local Development', url: '/guides/getting-started/local-development' },{name: 'Framework Quickstarts',items: [@@ -973,18 +972,27 @@ export const supabase_cli: NavMenuConstant = {title: 'Local Dev / CLI',url: '/guides/cli',items: [- { name: 'Overview', url: '/guides/cli' },- { name: 'Managing Environments', url: '/guides/cli/managing-environments' },+ { name: 'Getting started', url: '/guides/cli' },+ { name: 'Local Development', url: '/guides/cli/local-development' },+ { name: 'Managing environments', url: '/guides/cli/managing-environments' },{- name: 'Using environment variables in config.toml',- url: '/guides/cli/using-environment-variables-in-config',+ name: 'Managing config and secrets',+ url: '/guides/cli/managing-config',+ },+ {+ name: 'Testing emails locally',+ url: '/guides/cli/testing-emails',},{name: 'GitHub Action',url: undefined,items: [- { name: 'Getting started', url: '/guides/cli/github-action/intro' },- { name: 'Managing database migrations', url: '/guides/cli/github-action/migrations' },+ // { name: 'Getting started', url: '/guides/cli/github-action/intro' },+ // { name: 'Managing database migrations', url: '/guides/cli/github-action/migrations' },+ {+ name: 'Generate types from your database',+ url: '/guides/cli/github-action/generating-types',+ },],},{diff --git a/apps/docs/pages/guides/ai/examples/openai.mdx b/apps/docs/pages/guides/ai/examples/openai.mdxindex 7094a8fc936..d2462d371c9 100644--- a/apps/docs/pages/guides/ai/examples/openai.mdx+++ b/apps/docs/pages/guides/ai/examples/openai.mdx@@ -5,7 +5,7 @@ export const meta = {title: 'Generating OpenAI GPT3 completions',description: 'Generate GPT text completions using OpenAI and Supabase Edge Functions.',subtitle: 'Generate GPT text completions using OpenAI and Supabase Edge Functions.',- video: 'https://www.youtube.com/v/29p8kIqyU_Y',+ video: 'https://www.youtube-nocookie.com/v/29p8kIqyU_Y',tocVideo: '29p8kIqyU_Y',}diff --git a/apps/docs/pages/guides/cli.mdx b/apps/docs/pages/guides/cli.mdxindex d2703e85b65..38506dd1df0 100644--- a/apps/docs/pages/guides/cli.mdx+++ b/apps/docs/pages/guides/cli.mdx@@ -4,12 +4,15 @@ export const meta = {title: 'Supabase CLI',description:'The Supabase CLI provides tools to develop your project locally and deploy to the Supabase Platform.',+ subtitle:+ 'The Supabase CLI provides tools to develop your project locally and deploy to the Supabase Platform.',}-The Supabase CLI provides tools to develop your project locally and deploy to the Supabase Platform.-You can also use the CLI to manage your Supabase projects, handle database migrations and CI/CD workflows, and generate types directly from your database schema.+You can use the Supabase CLI to run the entire Supabase stack locally on your machine, simply by running `supabase init` (to create a new local project) and then `supabase start`.++The Supabase CLI provides tools to develop your project locally, deploy to the Supabase Platform, handle database migrations, and generate types directly from your database schema.-## Installation+## Installing the Supabase CLI<Tabsscrollable@@ -74,7 +77,7 @@ and run one of the following:</TabPanel></Tabs>-## Updates+## Updating the Supabase CLIWhen a new [version](https://github.com/supabase/cli/releases) is released, you can update the CLI using the same methods.@@ -121,12 +124,38 @@ npx supabase stop --no-backupnpx supabase start```+## Running Supabase locally++Inside the folder where you want to create your project, run:++```bash+supabase init+```++This will create a new `supabase` folder. It's safe to commit this folder to your version control system.++Now, to start the Supabase stack, run:++```bash+supabase start+```++This takes time on your first run because the CLI needs to download the local Docker images. The CLI includes the entire Supabase toolset, and a few additional images that are useful for local development (like a local SMTP server and a database diff tool).++The local development environment includes Supabase Studio, a graphical interface for working with your database, running by default on [localhost:54323](http://localhost:54323).++++When you are finished working on your Supabase project, you can stop the stack with:++```bash+supabase stop+```+## See also- [Supabase CLI Reference](/docs/reference/cli/introduction)- [Supabase CLI Configuration](/docs/reference/cli/config)-- [Local Development](/docs/guides/getting-started/local-development)-- [Managing Environments](/docs/guides/cli/managing-environments)export const Page = ({ children }) => <Layout meta={meta} children={children} />diff --git a/apps/docs/pages/guides/cli/github-action/[slug].tsx b/apps/docs/pages/guides/cli/github-action/[slug].tsxindex 428072763aa..d1973882fd2 100644--- a/apps/docs/pages/guides/cli/github-action/[slug].tsx+++ b/apps/docs/pages/guides/cli/github-action/[slug].tsx@@ -21,19 +21,29 @@ const externalSite = 'https://supabase.github.io/setup-cli'// Each external docs page is mapped to a local pageconst pageMap = [+ // {+ // slug: 'intro',+ // meta: {+ // title: 'Getting Started',+ // },+ // remoteFile: 'index.md',+ // },+ // {+ // slug: 'migrations',+ // meta: {+ // title: 'Managing database migrations',+ // },+ // remoteFile: 'migrations.md',+ // },{- slug: 'intro',+ slug: 'generating-types',meta: {- title: 'Getting Started',+ title: 'Generate types from your database',+ description: 'End-to-end type safety across client, server, and database.',+ subtitle: 'End-to-end type safety across client, server, and database.',+ tocVideo: 'VSNgAIObBdw',},- remoteFile: 'index.md',- },- {- slug: 'migrations',- meta: {- title: 'Managing database migrations',- },- remoteFile: 'migrations.md',+ remoteFile: 'generating-types.md',},]diff --git a/apps/docs/pages/guides/getting-started/local-development.mdx b/apps/docs/pages/guides/cli/local-development.mdxsimilarity index 95%rename from apps/docs/pages/guides/getting-started/local-development.mdxrename to apps/docs/pages/guides/cli/local-development.mdxindex c6516e0caab..ac9bc42e9b1 100644--- a/apps/docs/pages/guides/getting-started/local-development.mdx+++ b/apps/docs/pages/guides/cli/local-development.mdx@@ -4,7 +4,9 @@ export const meta = {id: 'local-development',title: 'Local Development',description: 'How to use Supabase on your local development machine.',- video: 'https://www.youtube.com/v/vyHyYpvjaks',+ subtitle: 'How to use Supabase on your local development machine.',+ video: 'https://www.youtube-nocookie.com/v/vyHyYpvjaks',+ tocVideo: 'vyHyYpvjaks',}Supabase is a flexible platform that lets you decide how you want to build your projects. You can use the Dashboard directly to get up and running quickly, or use a proper local setup. We suggest you work locally and deploy your changes to a linked project on the [Supabase Platform](https://app.supabase.io/).@@ -25,23 +27,6 @@ The Dashboard provides a wide range of features for setting up your project: cre5. **Work offline**: Need to work from a train? A plane? An automobile? No problem. Developing your project locally allows you to work offline.-<div className="video-container">- <iframe- src="https://www.youtube-nocookie.com/embed/vyHyYpvjaks"- frameBorder="1"- allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"- allowFullScreen- ></iframe>-</div>--## Prerequisites--Make sure you have these installed on your local machine:--- [Docker Desktop](https://docs.docker.com/desktop/)-- [Supabase CLI](/docs/guides/cli)-- [Git](https://github.com/git-guides/install-git)-## Log in to the Supabase CLI```bash@@ -474,7 +459,7 @@ This will switch the logging drivers and will direct logs to the Analytics serve## Limitations and considerations-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 local development environment is not as feature-complete as the Supabase Platform. Here are some of the differences:- You cannot update your project settings in the Dashboard. This must be done using the local config file.- The CLI version determines the local version of Studio used, so make sure you keep your local [Supabase CLI up to date](https://github.com/supabase/cli#getting-started). We're constantly adding new features and bug fixes.diff --git a/apps/docs/pages/guides/cli/managing-config.mdx b/apps/docs/pages/guides/cli/managing-config.mdxnew file mode 100644index 00000000000..1f93c9e52cf--- /dev/null+++ b/apps/docs/pages/guides/cli/managing-config.mdx@@ -0,0 +1,50 @@+import Layout from '~/layouts/DefaultGuideLayout'++export const meta = {+ id: 'managing-config',+ title: 'Managing config and secrets',+ description: 'Managing local configuration using config.toml.',+}++The Supabase CLI uses a `config.toml` file to manage local configuration. This file is located in the `supabase` directory of your project.++## Config reference++The `config.toml` file is automatically created when you run `supabase start`.++There are a wide variety of options available, which can be found in the [CLI Config Reference](/docs/reference/cli/config).++For example, to enable the "Apple" OAuth provider for local development, you can append the following information to `config.toml`:++```toml+[auth.external.apple]+enabled = false+client_id = ""+secret = ""+redirect_uri = "" # Overrides the default auth redirectUrl.+```++## Using secrets inside config.toml++You can reference environment variables within the `config.toml` file using the `env()` function. This will detect any values stored in an `.env` file at the root of your project directory. This is particularly useful for storing sensitive information like API keys, and any other values that you don't want to check into version control.++For example, if your `.env` contained the following values:++```bash+GITHUB_CLIENT_ID=""+GITHUB_SECRET=""+```++Then you would reference them inside of our `config.toml` like this:++```toml+[auth.external.github]+enabled = true+client_id = "env(GITHUB_CLIENT_ID)"+secret = "env(GITHUB_SECRET)"+redirect_uri = "" # Overrides the default auth redirectUrl.+```++export const Page = ({ children }) => <Layout meta={meta} children={children} />++export default Pagediff --git a/apps/docs/pages/guides/cli/managing-environments.mdx b/apps/docs/pages/guides/cli/managing-environments.mdxindex 3807044ad65..b20a4c5c5f1 100644--- a/apps/docs/pages/guides/cli/managing-environments.mdx+++ b/apps/docs/pages/guides/cli/managing-environments.mdx@@ -3,37 +3,15 @@ import Layout from '~/layouts/DefaultGuideLayout'export const meta = {id: 'managing-environments',title: 'Managing Environments',- description: 'How to deploy Supabase schema changes with a CI / CD pipeline.',- video: 'https://www.youtube.com/v/rOLyOsBR1Uc',+ description: 'Manage multiple environments using Database Migrations and GitHub Actions.',+ subtitle: 'Manage multiple environments using Database Migrations and GitHub Actions.',+ video: 'https://www.youtube-nocookie.com/v/rOLyOsBR1Uc',+ tocVideo: 'rOLyOsBR1Uc',}-## Overview+This guide shows you how to set up your local Supabase development environment that integrates with GitHub Actions to automatically test and release schema changes to staging and production Supabase projects.-The Supabase CLI provides the tools you need to manage multiple environments.-This guide shows you how to set up your local Supabase development environment that integrates with GitHub Actions to automatically-test and release schema changes to staging and production Supabase projects.--## Prerequisites--Make sure you have these installed on your local machine:--- [Docker Desktop](https://docs.docker.com/desktop/)-- [Supabase CLI](/docs/guides/cli)-- [Git](https://github.com/git-guides/install-git)--To get started:--- Create a [Supabase project](https://supabase.com/dashboard) or use an existing one-- Initialize a local Git repository--<div className="video-container">- <iframe- src="https://www.youtube-nocookie.com/embed/rOLyOsBR1Uc"- frameBorder="1"- allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"- allowFullScreen- ></iframe>-</div>+## Set up a local environmentdiff --git a/apps/docs/pages/guides/cli/testing-emails.mdx b/apps/docs/pages/guides/cli/testing-emails.mdxnew file mode 100644index 00000000000..49863c741a0--- /dev/null+++ b/apps/docs/pages/guides/cli/testing-emails.mdx@@ -0,0 +1,24 @@+import Layout from '~/layouts/DefaultGuideLayout'++export const meta = {+ id: 'testing-emails-locally',+ title: 'Testing emails locally',+ description: 'Testing emails for Supabase Auth on your local machine.',+ subtitle: 'Testing emails for Supabase Auth on your local machine.',+}++The Supabase CLI uses [Inbucket](https://github.com/inbucket/inbucket) to capture emails sent from your local machine. This is useful for testing emails sent from Supabase Auth.++## Accessing Inbucket++By default, Inbucket is available at [localhost:54324](http://localhost:54324) when you run `supabase start`. Simply open this URL in your browser to view the emails.++## Going into Production++The "default" email provided by Supabase is only for development purposes. It is [heavily restricted](/docs/guides/platform/going-into-prod#auth-rate-limits) to ensure that it is not used for spam.++Before you go into production, you must configure your own email provider. This is as simple as enabling a new SMTP credentials in your [project settings](https://app.supabase.com/project/_/settings/auth).++export const Page = ({ children }) => <Layout meta={meta} children={children} />++export default Pagediff --git a/apps/docs/pages/guides/cli/using-environment-variables-in-config.mdx b/apps/docs/pages/guides/cli/using-environment-variables-in-config.mdxdeleted file mode 100644index b50724d29cb..00000000000--- a/apps/docs/pages/guides/cli/using-environment-variables-in-config.mdx+++ /dev/null@@ -1,35 +0,0 @@-import Layout from '~/layouts/DefaultGuideLayout'--export const meta = {- id: 'using-environment-variables-in-config',- title: 'Using environment variables in config.toml',- description: 'How to use environment variables in config.toml with the Supabase CLI.',-}--The Supabase CLI is capable of utilizing environment variables stored in our project's root directory's `.env` file within the `config.toml` file.--We can reference the environment variable by using the `env()` function.--Inside of our `.env` file we add the environment variable as we normally would--```bash-GITHUB_CLIENT_ID=""-GITHUB_SECRET=""-```--And then reference them inside of our `config.toml`--```toml-[auth.external.github]-enabled = true-client_id = "env(GITHUB_CLIENT_ID)"-secret = "env(GITHUB_SECRET)"-# Overrides the default auth redirectUrl.-redirect_uri = ""-```--These same environment variables will be referenced by the `supabase start` command from the Supabase CLI.--export const Page = ({ children }) => <Layout meta={meta} children={children} />--export default Pagediff --git a/apps/docs/public/img/guides/cli/local-studio.png b/apps/docs/public/img/guides/cli/local-studio.pngnew file mode 100644index 00000000000..563c5cbef58Binary files /dev/null and b/apps/docs/public/img/guides/cli/local-studio.png differdiff --git a/apps/www/lib/redirects.js b/apps/www/lib/redirects.jsindex 6f12eb9e9f6..2ddabc7233c 100644--- a/apps/www/lib/redirects.js+++ b/apps/www/lib/redirects.js@@ -2071,4 +2071,14 @@ module.exports = [source: '/docs/guides/ai/choosing-instance-type',destination: '/docs/guides/ai/choosing-compute-addon',},+ {+ permanent: true,+ source: '/guides/cli/using-environment-variables-in-config',+ destination: '/guides/cli/managing-config',+ },+ {+ permanent: true,+ source: '/guides/getting-started/local-development',+ destination: '/guides/cli/local-development',+ },]