Setting up Supabase Locally
Learn how to set up Supabase locally for development. This guide will show you how to pull the Docker image and set up the environment variables for your Next.js application.
To get started with Supabase locally, you will just need to pull the docker image. Here's how to do it:
Setting up Docker for Supabase
- First, you will need to install Docker on your machine. You can download the installer from the Docker website since it is the recommended way to install Docker on Windows and macOS. If you are using Linux, you can follow the instructions for your specific distribution on the Docker documentation.
- Next, you will need to setup the env variables.
In your repository directory, you should have a .env.local.example
file which looks like this. For dev environment, just copy the .env.local.example
file to .env.local
. The localhost values are used for local development.So nothing needs to change here.
Note. Supabase also reads from .env.local for local development. If you don't need to setup social providers like github, google yet, just leave the dummy values in env.local file. Removing the values will however break supabase start, since the config.toml has social providers enabled by default. Either disable them in config.toml or leave the dummy values. Read more here.
- Once you have Docker installed and running in your machine, you can now pull the Supabase Docker image by running
pnpm supabase start
in your terminal.
Please note that for the first time you run the
pnpm supabase start
command, it will take some time to pull the Docker image. Subsequent runs will be faster since the images will be cached and volumes will be persisted.
- After running the command, you should see the output simmilar to the following:
- You can now access the Supabase Studio by visiting the URL
http://localhost:54323
in your browser. - You can also access the API and GraphQL URLs to interact with your local Supabase instance.
- To connect database clients to your local Supabase instance, you can use the DB URL
postgresql://postgres:postgres@localhost:54322/postgres
- To monitor your inboxes, you can use the Inbucket URL
http://localhost:54324
- You can stop the Supabase server by running the
pnpm supabase stop
command, to save on system resources.