Installation
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.
- 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 also use the JWT secret, anon key, and service role key for local development.
- You can stop the Supabase server by running the
pnpm supabase stop
command, to save on system resources.
Setting up .env.local for Supabase
To connect your Next.js application to your local Supabase instance, you will need to create a .env.local
file in the root of your project and add the following environment variables: