The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
sql and env vars in readme
awaliasf0f463e8b41b
diff --git a/examples/todo/README.md b/examples/todo/README.mdindex 9c40dcdc3d8..3f38accb4cd 100644--- a/examples/todo/README.md+++ b/examples/todo/README.md@@ -1,5 +1,10 @@This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).+## Required env vars++`REACT_APP_SUPABASE_URL=`+`REACT_APP_SUPABASE_KEY=`+## Available ScriptsIn the project directory, you can run:diff --git a/examples/todo/db/task_list_schema.sql b/examples/todo/db/task_list_schema.sqlnew file mode 100644index 00000000000..30d178f55af--- /dev/null+++ b/examples/todo/db/task_list_schema.sql@@ -0,0 +1,14 @@+CREATE TABLE lists (+ uuid text,+ id bigserial PRIMARY KEY,+ inserted_at timestamp without time zone DEFAULT timezone('utc' :: text, now()) NOT NULL,+ updated_at timestamp without time zone DEFAULT timezone('utc' :: text, now()) NOT NULL+);+CREATE TABLE tasks (+ task_text text NOT NULL,+ complete boolean DEFAULT false,+ id bigserial PRIMARY KEY,+ list_id bigint REFERENCES lists NOT NULL,+ inserted_at timestamp without time zone DEFAULT timezone('utc' :: text, now()) NOT NULL,+ updated_at timestamp without time zone DEFAULT timezone('utc' :: text, now()) NOT NULL+);\ No newline at end of filediff --git a/examples/todo/src/Store.js b/examples/todo/src/Store.jsindex 71f56fa5145..12f06292109 100644--- a/examples/todo/src/Store.js+++ b/examples/todo/src/Store.js@@ -2,8 +2,8 @@ import { useState, useEffect } from 'react'import { createClient } from '@supabase/supabase-js'const supabase = createClient(- 'https://NqizgGpcFvHFzGKvEyia.supabase.co',- 'drvzTxRwkZPeKSBoKLOtxvAV9Nei2n'+ process.env.REACT_APP_SUPABASE_URL,+ process.env.REACT_APP_SUPABASE_KEY)export const useStore = (props) => {@@ -22,6 +22,7 @@ export const useStore = (props) => {}, [])useEffect(() => {+ console.log(newTask)const handleAsync = async () => {if (newTask) {// could be an update@@ -43,6 +44,7 @@ export const useStore = (props) => {useEffect(() => {if (!taskListener && list) {+ console.log(list.id)setTaskListener(supabase.from(`tasks:list_id=eq.${list.id}`)@@ -85,7 +87,11 @@ export const createList = async (uuid) => {export const fetchList = async (list_uuid) => {try {- let { body } = await supabase.from('lists').eq('uuid', list_uuid).select(`*, tasks(*)`).single()+ let { body } = await supabase+ .from('lists')+ .eq('uuid', list_uuid)+ .select(`*, tasks(*)`)+ .single()return body} catch (error) {console.log('error', error)