Skip to content

Commit e345fdc

Browse files
committed
feat: add support for LibSQL
1 parent 893252b commit e345fdc

File tree

6 files changed

+297
-27
lines changed

6 files changed

+297
-27
lines changed

docs/content/docs/1.getting-started/3.configuration.md

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,54 @@ export default defineNuxtConfig({
4949
})
5050
```
5151

52-
5352
### `Postgres`
5453

55-
If you plan to deploy your application using PostgreSql database you need to use `postgres` database adapter.
54+
If you plan to deploy your application using PostgreSql database you need to use `postgres` database adapter.
55+
56+
First, make sure to install the `pg` package:
57+
58+
```bash [Terminal]
59+
npx nypm i pg
60+
```
61+
62+
Then, configure the `postgres` adapter in your `nuxt.config.ts`:
5663

5764
```ts [nuxt.config.ts]
5865
export default defineNuxtConfig({
5966
content: {
6067
database: {
6168
type: 'postgres',
62-
url: 'POSTGRES_URL',
69+
url: process.env.POSTGRES_URL,
6370
/* Other options for `pg` */
6471
}
6572
}
6673
})
6774
```
6875

76+
### `LibSQL` / `Turso`
77+
78+
If you plan to deploy your application using LibSQL/Turso database you need to use `libsql` database adapter.
79+
80+
First, make sure to install the `@libsql/client` package:
81+
82+
```bash [Terminal]
83+
npx nypm i @libsql/client
84+
```
85+
86+
Then, configure the `libsql` adapter in your `nuxt.config.ts`:
87+
88+
```ts [nuxt.config.ts]
89+
export default defineNuxtConfig({
90+
content: {
91+
database: {
92+
type: 'libsql',
93+
url: process.env.TURSO_DATABASE_URL,
94+
authToken: process.env.TURSO_AUTH_TOKEN,
95+
}
96+
}
97+
})
98+
```
99+
69100
## `build`
70101

71102
Nuxt Content read and parse all the available contents at built time. This option let you control over parsing contents.

docs/nuxt.config.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ export default defineNuxtConfig({
2828

2929
content: {
3030
database: {
31-
type: 'd1',
32-
binding: 'DB',
31+
// type: 'd1',
32+
// binding: 'DB',
33+
type: 'libsql',
34+
url: process.env.TURSO_DATABASE_URL!,
35+
authToken: process.env.TURSO_AUTH_TOKEN!,
3336
},
3437
},
3538

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@
7878
"zod-to-ts": "^1.2.0"
7979
},
8080
"peerDependencies": {
81-
"pg": "*"
81+
"pg": "*",
82+
"@libsql/client": "*"
8283
},
8384
"devDependencies": {
8485
"@cloudflare/workers-types": "^4.20241106.0",

0 commit comments

Comments
 (0)