Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Local development

Paul Hultgren edited this page Jan 4, 2023 · 2 revisions

Admin portal

  1. Configure env.local (and set MULTI_TENANCY=true if working on Cloud)
  2. yarn dev (unless you need to migrate using DATABASE_URL env var) and migrate up

Runs on :3000

Snippet

Initial setup

With NextJS Dev (Recommended)

  1. npm install
  2. Setup your environment configuration:
cp .env.example .env.local

Enter the required config from Supabase .env.local.

  1. Run the DB migrations:
DATABASE_URL=postgresql://postgres:<YOUR_SUPABASE_DB_PASSWORD>@<YOUR_SUPABASE_DB_HOST>:5432/postgres yarn migrate up

  1. Start the development server:
npm run dev
# or
yarn dev

  1. Open http://localhost:3000 with your browser.

With Docker Image

  1. Install Docker on your machine
  2. Build the container: docker build -t squeak .
  3. Run the container:
docker run \\
  -e "NEXT_PUBLIC_SUPABASE_URL=<YOUR URL>" \\
  -e "NEXT_PUBLIC_SUPABASE_ANON_KEY=<YOUR ANON KEY>" \\
  -e "SUPABASE_SERVICE_ROLE_KEY=<YOUR SERVICE ROLE KEY>" \\
  -e "DATABASE_URL=<YOUR DATABASE_URL>" \\
  -p 3000:3000 squeak

Running DB migrations

To run the database migrations, run:

DATABASE_URL=<YOUR_DATABASE_URL> yarn migrate up

Generating Typescript Types

After running a migration, you can generate typescript types for the database schema:

npx openapi-typescript "<https://YOUR_DATABASE_URL.supabase.co/rest/v1/?apikey=><YOUR_NEXT_PUBLIC_SUPABASE_ANON_KEY>" --output @types/supabase.d.ts

Running squeak-react

  1. Add API key and values to the <Squeak /> component in src/main.tsx
  2. Run yarn dev