From 629753bcd0627f713d3de4101e392b023ad13587 Mon Sep 17 00:00:00 2001 From: Rotimi Best Date: Sat, 4 Oct 2025 06:56:14 +0100 Subject: [PATCH] chore: update docs of supabase instructions --- .gitpod.yml | 6 ++++-- apps/dashboard/scripts/play.js | 20 +++++++++++++++++++ .../contributor-guides/supabase-cloud.mdx | 8 ++++++-- package.json | 3 ++- 4 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 apps/dashboard/scripts/play.js diff --git a/.gitpod.yml b/.gitpod.yml index 5191f9ad..c9e6d675 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -9,11 +9,13 @@ tasks: cd ../dashboard && cp .env.example .env && cd ../.. && - pnpm supabase:start + pnpx supabase start command: | - SUPABASE_ANON_KEY=$(pnpm supabase:status | grep "anon key" | awk '{print $3}' | tr -d '\\n') && + SUPABASE_ANON_KEY=$(pnpx supabase status | grep "anon key" | awk '{print $3}' | tr -d '\\n') && cd apps/dashboard && sed -i "s/PUBLIC_SUPABASE_ANON_KEY=.*/PUBLIC_SUPABASE_ANON_KEY=$SUPABASE_ANON_KEY/g" .env && + sed -i "s/PRIVATE_SUPABASE_SERVICE_ROLE=.*/PRIVATE_SUPABASE_SERVICE_ROLE=$SUPABASE_SERVICE_ROLE/g" .env && + cd ../classroomio-com && cd ../.. && pnpm dev diff --git a/apps/dashboard/scripts/play.js b/apps/dashboard/scripts/play.js new file mode 100644 index 00000000..180e3100 --- /dev/null +++ b/apps/dashboard/scripts/play.js @@ -0,0 +1,20 @@ +import { createClient } from '@supabase/supabase-js'; + +const supabase = createClient( + 'https://kmpdoztwluxrgnthfkau.supabase.co', + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImttcGRvenR3bHV4cmdudGhma2F1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTc0MTA1NjAsImV4cCI6MjA3Mjk4NjU2MH0.A9pIKBSMNQXgumNYEzhQV6PjBV7iCc1bZ42hYkO0sC8' +); + +const localSupabase = createClient( + 'http://127.0.0.1:54321', + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0' +); + +async function main() { + const { data, error } = await supabase.from('profile').select('*'); + + console.log(data); + console.log(error); +} + +main(); diff --git a/apps/docs/pages/contributor-guides/supabase-cloud.mdx b/apps/docs/pages/contributor-guides/supabase-cloud.mdx index 92ef5cc2..1a7d23ad 100644 --- a/apps/docs/pages/contributor-guides/supabase-cloud.mdx +++ b/apps/docs/pages/contributor-guides/supabase-cloud.mdx @@ -52,12 +52,16 @@ Once you have an account just click on the _New Project_ on your dashboard. Afte anywhere in the dashboard for security reasons. +### Setup Supabase CLI + +Follow the instructions [here](https://supabase.com/docs/guides/local-development/cli/getting-started) to setup the Supabase CLI on your computer. + ### Login to Supabase via the CLI Open your terminal and go to the root of the project. Run the following: ```bash copy -pnpm supabase:login +supabase login ``` Follow the instruction in your terminal to generate your access token. Paste the token in the console and hit **Enter** @@ -74,7 +78,7 @@ Follow the instruction in your terminal to generate your access token. Paste the - Then run in your terminal: ```bash copy -pnpx supabase@1.51.1 db push --db-url "URL HERE" +supabase db push --db-url "URL HERE" ``` diff --git a/package.json b/package.json index ea5cfc2e..09e06a6e 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "release": "standard-version", "ci": "cypress run", "dashboard:build": "cd apps/dashboard && pnpm i && PUBLIC_IS_SELFHOSTED=true NODE_OPTIONS='--max-old-space-size=20384' DEPLOYMENT_PROVIDER=docker pnpm build", - "dashboard:start": "cd apps/dashboard && node build" + "dashboard:start": "cd apps/dashboard && node build", + "supabase:push": "pnpx supabase link --project-ref $PROJECT_ID && pnpx supabase db push --include-all" }, "license": "MIT", "dependencies": {