From fbd54de8195e3450b51d75ec90a7c6bc73d154b4 Mon Sep 17 00:00:00 2001 From: Peter Kraft Date: Mon, 9 Dec 2024 13:22:17 -0800 Subject: [PATCH 1/4] better supabase --- docs/integrations/supabase.md | 275 +++++++++++++++++++++++++++++++++- 1 file changed, 271 insertions(+), 4 deletions(-) diff --git a/docs/integrations/supabase.md b/docs/integrations/supabase.md index 9e3e5641..87394076 100644 --- a/docs/integrations/supabase.md +++ b/docs/integrations/supabase.md @@ -1,12 +1,16 @@ --- sidebar_position: 5 title: Supabase +hide_table_of_contents: true --- +import InstallNode from '/docs/partials/_install_node.mdx'; +import LocalPostgres from '/docs/partials/_local_postgres.mdx'; + # Use DBOS With Supabase -This guide shows you how to deploy a DBOS application with [Supabase](https://supabase.com/). -Your application is hosted in DBOS Cloud, but stores its data in Supabase. +This guide shows you how to build an application with DBOS and [Supabase](https://supabase.com/). +While Supabase stores your application's data, DBOS serverlessly hosts its code and makes it resilient to any failure. ### 1. Connect to Supabase Visit [https://console.dbos.dev/provision](https://console.dbos.dev/provision) and click "Connect Supabase" to connect your DBOS and Supabase accounts. @@ -62,6 +66,269 @@ If you continue to your [application page](https://console.dbos.dev/applications To start building, edit your application on GitHub (for the DBOS + FastAPI starter, source code is in `app/main.py`), commit your changes, then press "Deploy From GitHub" to see your changes reflected in the live application. -### Next Steps +### Developing Locally + +You can also use develop your DBOS application locally while storing its data in Supabase! Here's how: + + + + +
+
+ +#### 1. Git Clone Your Application +Clone your application from git and enter its directory. +
+ +
+ +```shell +git clone my-app +cd my-app +``` + +
+
+ +
+
+ +#### 2. Set up a Virtual Environment +Create a virtual environment and install dependencies. + +
+ +
+ + + +```shell +python3 -m venv .venv +source .venv/bin/activate +pip install -r requirements.txt +``` + + +```shell +python3 -m venv .venv +.venv\Scripts\activate.ps1 +pip install -r requirements.txt +``` + + +```shell +python3 -m venv .venv +.venv\Scripts\activate.bat +pip install -r requirements.txt +``` + + + +
+
+ + +
+
+ +#### 3. Install the DBOS Cloud CLI + +The Cloud CLI requires Node.js 20 or later. +
+ +
+ +
+Instructions to install Node.js + + + +
+
+ +
+Run this command to install it. +
+ +
+```shell +npm i -g @dbos-inc/dbos-cloud@latest +``` +
+
+ +#### 4. Connect to Supabase +
+
+ +Connect your local application to your Supabase database. Enter your Supabase password when prompted. + +
+ +
+ +``` +dbos-cloud db local +``` +
+ +
+ +#### 5. Run the App + +
+ +
+Run these commands to start your app locally! +
+ +
+```bash +dbos migrate +dbos start +``` +
+ +
+To see that your app is working, visit this URL in your browser: http://localhost:8000/ +
+ +
+ +**Welcome to DBOS!** + +
+ +
+Congratulations, you've started a DBOS+Supabase app locally! +To learn more about building DBOS apps, check out our [Python programming guide](./python/programming-guide.md). +
+ +
+ +
+ + + +
+
+ +#### 1. Git Clone Your Application +Clone your application from git and enter its directory. +
+ +
+ +```shell +git clone my-app +cd my-app +``` + +
+
+ +
+
+ +#### 2. Install Dependencies +DBOS TypeScript requires Node.js 20 or later. + +
+ +
+ +
+Instructions to install Node.js + + + +
+
+ +
+ +Install dependencies. + +
+ + +
+ +```shell +npm install +``` + +
+
+ + +
+
+ +#### 3. Install the DBOS Cloud CLI + +Run this command to install the Cloud CLI globally. +
+ +
+```shell +npm i -g @dbos-inc/dbos-cloud@latest +``` +
+
+ +#### 4. Set up a Postgres Database +
+
+ +Connect your local application to your Supabase database. Enter your Supabase password when prompted. + +
+ +
+ +``` +dbos-cloud db local +``` +
+ +
+ + +#### 5. Run the App + + +
+ +
+Run these commands to build and start your app locally! +
+ +
+```bash +npx dbos migrate +npm run build +npx dbos start +``` +
+ +
+To see that your app is working, visit this URL in your browser: http://localhost:3000/ +
+ +
+ +**Welcome to DBOS!** + +
+ + +
+Congratulations, you've started a DBOS+Supabase app locally! +To learn more about building DBOS apps, check out our [TypeScript programming guide](./typescript/programming-guide.md). +
+ +
-To learn more about building reliable applications with DBOS, check out the programming guide ([Python](../python/programming-guide.md), [TypeScript](../typescript/programming-guide.md)). +
+
\ No newline at end of file From d4b7a3bb494d8a4493ac1362a5cb31b665949519 Mon Sep 17 00:00:00 2001 From: Peter Kraft Date: Mon, 9 Dec 2024 13:25:22 -0800 Subject: [PATCH 2/4] Nit --- docs/integrations/supabase.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/integrations/supabase.md b/docs/integrations/supabase.md index 87394076..7c1b9ce5 100644 --- a/docs/integrations/supabase.md +++ b/docs/integrations/supabase.md @@ -68,7 +68,7 @@ To start building, edit your application on GitHub (for the DBOS + FastAPI start ### Developing Locally -You can also use develop your DBOS application locally while storing its data in Supabase! Here's how: +You can also develop your DBOS application locally while storing its data in Supabase! Here's how: From 511b4bf97feab4a304dc813d66367a9e282ba0c6 Mon Sep 17 00:00:00 2001 From: Peter Kraft Date: Mon, 9 Dec 2024 13:35:34 -0800 Subject: [PATCH 3/4] fix --- docs/integrations/supabase.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/integrations/supabase.md b/docs/integrations/supabase.md index 7c1b9ce5..707922e7 100644 --- a/docs/integrations/supabase.md +++ b/docs/integrations/supabase.md @@ -201,7 +201,7 @@ To see that your app is working, visit this URL in your browser: http://localhos
Congratulations, you've started a DBOS+Supabase app locally! -To learn more about building DBOS apps, check out our [Python programming guide](./python/programming-guide.md). +To learn more about building DBOS apps, check out our [Python programming guide](../python/programming-guide.md).
@@ -325,7 +325,7 @@ To see that your app is working, visit this URL in your browser: http://localhos
Congratulations, you've started a DBOS+Supabase app locally! -To learn more about building DBOS apps, check out our [TypeScript programming guide](./typescript/programming-guide.md). +To learn more about building DBOS apps, check out our [TypeScript programming guide](../typescript/programming-guide.md).
From 2738231c29b2c4f86b906be3b83c2785b5841f9b Mon Sep 17 00:00:00 2001 From: Qian Li Date: Mon, 9 Dec 2024 14:53:41 -0800 Subject: [PATCH 4/4] Update docs/integrations/supabase.md Signed-off-by: Qian Li --- docs/integrations/supabase.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/integrations/supabase.md b/docs/integrations/supabase.md index 707922e7..7a8a80af 100644 --- a/docs/integrations/supabase.md +++ b/docs/integrations/supabase.md @@ -66,7 +66,7 @@ If you continue to your [application page](https://console.dbos.dev/applications To start building, edit your application on GitHub (for the DBOS + FastAPI starter, source code is in `app/main.py`), commit your changes, then press "Deploy From GitHub" to see your changes reflected in the live application. -### Developing Locally +## Develop Locally You can also develop your DBOS application locally while storing its data in Supabase! Here's how: