89 lines
2.8 KiB
Plaintext
89 lines
2.8 KiB
Plaintext
---
|
|
title: Running the Supabase Containers
|
|
label: Supabase
|
|
description: Running the Supabase containers locally for development
|
|
---
|
|
|
|
Before we can run the Supabase local environment, we need to run Docker, as Supabase uses it for running its local environment.
|
|
|
|
You can use Docker Desktop, Colima, OrbStack, or any other Docker-compatible solution.
|
|
|
|
### Running the Supabase Environment
|
|
|
|
First, let's run the Supabase environment, which will spin up a local
|
|
instance using Docker. We can do this by running the following command:
|
|
|
|
```bash
|
|
npm run supabase:start
|
|
```
|
|
|
|
Additionally, it imports the default seed data. We use it this data to
|
|
populate the database with some initial data and execute the E2E tests.
|
|
|
|
After running the command above, you will be able to access the Supabase
|
|
Studio UI at [http://localhost:54323/](http://localhost:54323/).
|
|
|
|
### Adding the Supabase Keys to the Environment Variables
|
|
|
|
If this is the first time you run this command, we will need to get the
|
|
Supabase keys and add them to our local environment variables configuration
|
|
file `.env`.
|
|
|
|
When running the command, we will see a message like this:
|
|
|
|
```bash
|
|
> supabase start
|
|
|
|
Applying migration 20221215192558_schema.sql...
|
|
Seeding data supabase/seed.sql...
|
|
Started supabase local development setup.
|
|
|
|
API URL: http://localhost:54321
|
|
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: ****************************************************
|
|
service_role key: ****************************************************
|
|
```
|
|
|
|
Now, we need to copy the `anon key` and `service_role key` values and add
|
|
them to the `.env` file:
|
|
|
|
```
|
|
NEXT_PUBLIC_SUPABASE_ANON_KEY=****************************************************
|
|
SUPABASE_SERVICE_ROLE_KEY=****************************************************
|
|
```
|
|
|
|
|
|
### Running the Stripe CLI
|
|
|
|
Run the Stripe CLI with the following command:
|
|
|
|
```bash
|
|
npm run stripe:listen
|
|
```
|
|
|
|
#### Add the Stripe Webhooks Key to your environment file
|
|
|
|
If this is the first time you run this command, you will need to copy the Webhooks key printed on the console and add it to your development environment variables file:
|
|
|
|
```bash title=".env.development"
|
|
STRIPE_WEBHOOKS_KEY=<PASTE_KEY_HERE>
|
|
```
|
|
|
|
#### Signing In for the first time
|
|
|
|
You should now be able to sign in. To quickly get started, use the following credentials:
|
|
|
|
```
|
|
email = test@makerkit.dev
|
|
password = testingpassword
|
|
```
|
|
|
|
#### Email Confirmations
|
|
|
|
When signing up, Supabase sends an email confirmation to a testing account. You can access the InBucket testing emails [using the following link](http://localhost:54324/monitor), and can follow the links to complete the sign up process.
|
|
|
|
|