Skip to content

Commit b304bbd

Browse files
Update docs for new AstroDB update (#12208)
Co-authored-by: Sarah Rainsberger <[email protected]>
1 parent de4ec8f commit b304bbd

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

src/content/docs/en/guides/astro-db.mdx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,6 @@ Astro DB allows you to connect to both local and remote databases. By default, A
232232

233233
To connect to a hosted remote database, use the `--remote` flag. This flag enables both readable and writable access to your remote database, allowing you to [accept and persist user data](#insert) in production environments.
234234

235-
:::note
236-
While remote connections are generally possible with any deployment platform using static or server rendering mode, there are currently some limitations. Non-Node runtimes like Cloudflare and Deno don't currently support DB on server-rendered routes when using libSQL. Support for these platforms is planned for future implementation.
237-
:::
238-
239235
Configure your build command to use the `--remote` flag:
240236

241237
```json title="package.json" "--remote"
@@ -260,7 +256,7 @@ astro dev --remote
260256
Be careful when using `--remote` in development. This connects to your live production database, and all changes (inserts, updates, deletions) will be persisted.
261257
:::
262258

263-
The `--remote` flag uses the connection to the remote DB both locally during the build and on the server. Ensure you set the necessary environment variables in both your local development environment and your deployment platform.
259+
The `--remote` flag uses the connection to the remote DB both locally during the build and on the server. Ensure you set the necessary environment variables in both your local development environment and your deployment platform. Additionally, you may need to [configure web mode](/en/guides/integrations-guide/db/#mode) for non-Node.js runtimes such as Cloudflare Workers or Deno.
264260

265261
When deploying your Astro DB project, make sure your deployment platform's build command is set to `npm run build` (or the equivalent for your package manager) to utilize the `--remote` flag configured in your `package.json`.
266262

src/content/docs/en/guides/integrations-guide/db.mdx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ i18nReady: true
1111
import { FileTree } from '@astrojs/starlight/components';
1212
import PackageManagerTabs from '~/components/tabs/PackageManagerTabs.astro';
1313
import ReadMore from '~/components/ReadMore.astro';
14+
import Since from '~/components/Since.astro';
1415

1516
Astro DB is a fully-managed SQL database designed for the Astro ecosystem: develop locally in Astro and deploy to any [libSQL-compatible database](/en/guides/astro-db/).
1617

@@ -92,6 +93,38 @@ export default defineDb({
9293
})
9394
```
9495

96+
## Configuration
97+
98+
### `mode`
99+
100+
<p>
101+
102+
**Type:** `'node' | 'web'`<br />
103+
**Default:** `'node'`<br />
104+
<Since v="0.18.0" pkg="@astrojs/db" />
105+
</p>
106+
107+
Configures the driver to use to connect to your database in production.
108+
109+
By default, Astro DB uses a Node.js-based libSQL driver for production deployments. The `node` driver mode is sufficient for most Astro hosted or self-hosted websites with Node.js runtimes. This allows you to connect to your database over several protocols, including `memory:`, `file:`, `ws:`, `wss:`, `libsql`, `http`, and `https`, as well as allowing for more advanced features such as [embedded replicas](/en/guides/astro-db/#syncurl).
110+
111+
When deploying to a serverless environment on a non-Node.js runtime, such as Cloudflare Workers or Deno, a web-based libSQL driver is available. When deploying using the `web` mode, you will be able to make web-based connections over `libsql`, `http`, or `https`.
112+
113+
To use the web libSQL driver mode for non-Node.js environments, set the `mode` property in your adapter's configuration:
114+
115+
```ts title="astro.config.mjs" ins={7}
116+
import { defineConfig } from 'astro/config';
117+
import db from '@astrojs/db';
118+
119+
export default defineConfig({
120+
integrations: [
121+
db({
122+
mode: 'web'
123+
})
124+
]
125+
});
126+
```
127+
95128
## Table configuration reference
96129

97130
### `columns`

0 commit comments

Comments
 (0)