2. Setting up Supabase Locally

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

  1. 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.
  2. 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.

  1. After running the command, you should see the output simmilar to the following:
Terminal Output for [pnpm supabase start]
Status: Downloaded newer image for public.ecr.aws/supabase/studio
Started supabase local development setup.
         API URL: http://localhost:54321
     GraphQL URL: http://localhost:54321/graphql/v1
          DB URL: postgresql://postgres:postgres@localhost:54322/postgres
      Studio URL: http://localhost:54323
    Inbucket URL: http://localhost:54324
      JWT secret: super-secret-jwt-token-with-at-least-32-characters-long
        anon key: anon-key-for-local-development
service_role key: service-role-key-for-local-development
  1. You can now access the Supabase Studio by visiting the URL http://localhost:54323 in your browser.
  2. You can also access the API and GraphQL URLs to interact with your local Supabase instance.
  3. To connect database clients to your local Supabase instance, you can use the DB URL postgresql://postgres:postgres@localhost:54322/postgres
  4. To monitor your inboxes, you can use the Inbucket URL http://localhost:54324
  5. You can also use the JWT secret, anon key, and service role key for local development.
  6. 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:

# These values never change when supabase is ran locally regardless of project

← 1. First Steps

3. Setting up Stripe →