diff --git a/docs/integrations/supabase.md b/docs/integrations/supabase.md index 9e3e5641..7a8a80af 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 +## Develop Locally + +You can also 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