Skip to content

Commit e166063

Browse files
authored
feat: add support for nuxthub v1 (#3576)
1 parent 0ec629a commit e166063

File tree

19 files changed

+1753
-532
lines changed

19 files changed

+1753
-532
lines changed

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

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -327,21 +327,21 @@ export default defineNuxtConfig({
327327

328328
### `Postgres`
329329

330-
If you plan to deploy your application using PostgreSQL database you need to use the `postgres` database adapter.
330+
If you plan to deploy your application using PostgreSQL database you need to use the `postgresql` database adapter.
331331

332332
First, make sure to install the `pg` package:
333333

334334
```bash [Terminal]
335-
npx npm i pg
335+
npm i pg
336336
```
337337

338-
Then, configure the `postgres` adapter in your `nuxt.config.ts`:
338+
Then, configure the `postgresql` adapter in your `nuxt.config.ts`:
339339

340340
```ts [nuxt.config.ts]
341341
export default defineNuxtConfig({
342342
content: {
343343
database: {
344-
type: 'postgres',
344+
type: 'postgresql',
345345
url: process.env.POSTGRES_URL,
346346
/* Other options for `pg` */
347347
}
@@ -356,7 +356,7 @@ If you plan to deploy your application using a LibSQL database you need to use t
356356
First, make sure to install the `@libsql/client` package:
357357

358358
```bash [Terminal]
359-
npx npm i @libsql/client
359+
npm i @libsql/client
360360
```
361361

362362
Then, configure the `libsql` adapter in your `nuxt.config.ts`:
@@ -377,6 +377,33 @@ export default defineNuxtConfig({
377377
The most popular LibSQL hosting services is [Turso](https://turso.tech/).
378378
::
379379

380+
### `PGlite`
381+
382+
If you plan to deploy your application using a PGlite database you need to use the `pglite` database adapter.
383+
384+
First, make sure to install the `@electric-sql/pglite` package:
385+
386+
```bash [Terminal]
387+
npm i @electric-sql/pglite
388+
```
389+
390+
Then, configure the `pglite` adapter in your `nuxt.config.ts`:
391+
392+
```ts [nuxt.config.ts]
393+
export default defineNuxtConfig({
394+
content: {
395+
database: {
396+
type: 'pglite',
397+
dataDir: '.data/content/pglite'
398+
}
399+
}
400+
})
401+
```
402+
403+
::note
404+
We recommend to only use PGlite in development.
405+
::
406+
380407
## `renderer`
381408

382409
Configure content renderer.

docs/content/docs/6.deploy/2.serverless.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Before deploying your project, you need to select a database service:
3232
export default defineNuxtConfig({
3333
content: {
3434
database: {
35-
type: 'postgres',
35+
type: 'postgresql',
3636
url: process.env.POSTGRES_URL
3737
}
3838
}

docs/nuxt.config.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@ export default defineNuxtConfig({
3535
return Object.assign(acc, { [from]: { redirect: to } })
3636
}, {} as Record<string, { redirect: string }>),
3737
},
38-
future: {
39-
compatibilityVersion: 4,
38+
nitro: {
39+
compatibilityDate: {
40+
// Don't generate observability routes
41+
vercel: '2025-07-14',
42+
},
4043
},
4144
hub: {
42-
database: true,
45+
database: 'sqlite',
4346
cache: true,
4447
},
45-
github: {
46-
rootDir: 'docs',
47-
},
4848
llms: {
4949
domain: 'https://content.nuxt.com',
5050
title: 'Nuxt Content',

docs/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@
55
"build": "nuxt build"
66
},
77
"dependencies": {
8+
"@libsql/client": "^0.15.15",
89
"@nuxt/content": "link:..",
9-
"@nuxthub/core": "https://pkg.pr.new/@nuxthub/core@3d374d9",
10+
"@nuxt/ui": "^4.1.0",
11+
"@nuxthub/core": "npm:@nuxthub/[email protected]",
1012
"@nuxtjs/plausible": "^2.0.1",
1113
"@vueuse/nuxt": "^14.0.0",
1214
"better-sqlite3": "^12.4.1",
13-
"docus": "https://pkg.pr.new/docus@1194",
15+
"docus": "^5.2.1",
16+
"drizzle-orm": "^0.44.7",
1417
"minisearch": "^7.2.0",
15-
"@nuxt/ui": "^4.1.0",
1618
"nuxt": "^4.2.0"
1719
}
1820
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
"shiki": "^3.14.0",
9797
"slugify": "^1.6.6",
9898
"socket.io-client": "^4.8.1",
99+
"std-env": "^3.10.0",
99100
"tar": "^7.5.1",
100101
"tinyglobby": "^0.2.15",
101102
"ufo": "^1.6.1",

playground/content/0.index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ date: 2024-09-23
55

66
## 🎨 Documentations
77

8-
- [Nuxt v3](/nuxt/getting-started/introduction)
9-
- [Nuxt Content v2](/content-v2/getting-started/installation)
8+
- [Nuxt](/nuxt/getting-started/introduction)
9+
- [Nuxt Content](/content-v2/getting-started/installation)
1010

1111
## 🎨 Playground
1212

playground/nuxt.config.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
export default defineNuxtConfig({
22
modules: [
33
'@nuxt/ui',
4-
'@nuxt/content',
54
'@nuxthub/core',
5+
'@nuxt/content',
66
],
77
content: {
88
experimental: {
99
nativeSqlite: true,
1010
},
11+
// Uncomment to use PGlite instead of SQLite
12+
// database: {
13+
// type: 'pglite',
14+
// dataDir: '.data/content/pglite' // or omit for in-memory database
15+
// },
1116
build: {
1217
markdown: {
1318
remarkPlugins: {
@@ -31,8 +36,10 @@ export default defineNuxtConfig({
3136
},
3237
},
3338
},
34-
compatibilityDate: '2024-07-24',
39+
compatibilityDate: '2025-10-15',
3540
hub: {
36-
database: true,
41+
database: 'sqlite',
42+
// Or use PGlite with NuxtHub:
43+
// database: 'postgresql',
3744
},
3845
})

playground/package.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,21 @@
33
"private": true,
44
"type": "module",
55
"scripts": {
6-
"dev": "nuxi dev",
7-
"build": "nuxi build",
8-
"generate": "nuxi generate",
6+
"dev": "nuxt dev",
7+
"build": "nuxt build",
8+
"generate": "nuxt generate",
99
"dev:prepare": "nuxt prepare"
1010
},
1111
"devDependencies": {
12+
"@electric-sql/pglite": "^0.3.10",
13+
"@libsql/client": "^0.15.15",
1214
"@nuxt/content": "latest",
1315
"@nuxt/ui": "^4.1.0",
14-
"@nuxthub/core": "^0.9.0",
16+
"@nuxthub/core": "npm:@nuxthub/[email protected]",
17+
"better-sqlite3": "^12.4.1",
18+
"drizzle-orm": "^0.44.7",
1519
"nuxt": "^4.2.0",
20+
"pg": "^8.16.3",
1621
"remark-code-import": "^1.2.0",
1722
"shiki-transformer-color-highlight": "^1.0.0"
1823
}

playground/pages/[...slug].vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
const route = useRoute()
33
44
const { data: navigation } = await useAsyncData('contents-list', () => queryCollectionNavigation('content'))
5-
const { data } = await useAsyncData('posts' + route.path, async () => {
5+
const { data } = await useAsyncData(() => 'posts' + route.path, async () => {
66
return await queryCollection('content').path(route.path).first()
77
})
88
9-
const { data: surround } = await useAsyncData('content-surround' + route.path, () => {
9+
const { data: surround } = await useAsyncData(() => 'content-surround' + route.path, () => {
1010
return queryCollectionItemSurroundings('content', route.path, {
1111
before: 1,
1212
after: 1,
@@ -17,6 +17,7 @@ const { data: surround } = await useAsyncData('content-surround' + route.path, (
1717

1818
<template>
1919
<ContentPage
20+
v-if="data"
2021
:data="data"
2122
:navigation="navigation"
2223
:surround="surround"

0 commit comments

Comments
 (0)