Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Supabase Service - KindFi

This document provides instructions for developers to set up and run the Supabase service locally within the KindFi monorepo.

Prerequisites

Ensure you have the following installed on your machine:

Setup

  1. Clone the Repository (if you haven't already)
git clone https://github.com/kindfi-org/kindfi.git
cd monorepo/services/supabase
  1. Install Dependencies
bun install
  1. Get Ready For Migrations

To create migrations, please follow this guide, it provides steps to generate migrations, ensure that they work before pushing.

Running Supabase Locally

  1. Start Supabase Services

Use the following command to start the Supabase services:

bun start # supabase start

This will start the Supabase local development environment, including the database, authentication, and storage services.

  1. Generate Types and Schemas

Generate the necessary types and schemas for the Supabase service:

bun gen:remote # generates what it is in the linked (remote) database
bun gen # generates what it is in local database
  1. Environment Variables

Copy the sample environment file and update it with your configuration:

cp .env.sample .env

Update the .env file with the KindFi Supabase project id. This is for remote type generation and to identify the local development host.

Supabase Service Role Key

The SUPABASE_SERVICE_ROLE_KEY is a critical environment variable required for server-side operations with Supabase. It grants admin-level access to your Supabase project and should be handled securely.

Obtaining the Service Role Key

  1. Go to your Supabase Dashboard: https://supabase.com/dashboard.
  2. Select the project you're working on.
  3. In the left sidebar, click on Settings.
  4. Select Data API from the settings menu.
  5. Locate the Service Role Key and reveal and copy it:

Useful Commands

  • Apply (new) migrations to the local database

    bun migrate # When adding new migrations file, this makes sure to apply them.
  • Apply migrations by resetting local database completely

    bun reset # When adding new migrations file, this makes sure to apply them by resetting from the migrations.

Documentation

For more detailed instructions and advanced configurations, refer to the Supabase Local Development Guide.