Skip to content

Commit 5309e02

Browse files
committed
feat!: move to layer
1 parent 97820cc commit 5309e02

35 files changed

+261
-466
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ npx nypm@latest add @nuxthub/core
2929
npx nypm@latest add -D wrangler
3030
```
3131

32-
3. Add `@nuxthub/core` to the `modules` section of `nuxt.config.ts`
32+
3. Add `@nuxthub/core` to the `extends` section of `nuxt.config.ts`
3333

3434
```js
3535
export default defineNuxtConfig({
36-
modules: [
36+
extends: [
3737
'@nuxthub/core'
3838
]
3939
})

docs/components/Logo.vue

+5-4
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
<path fill="#00DC82" d="M168 200h111c3.542 0 6.932-1.244 10-3 3.068-1.756 6.23-3.959 8-7 1.77-3.041 3.002-6.49 3-10.001-.002-3.511-1.227-6.959-3-9.998L222 41c-1.77-3.04-3.933-5.2448-7-7-3.067-1.7552-7.458-3-11-3s-6.933 1.2448-10 3-5.23 3.96-7 7l-19 33-38-64.00236c-1.772-3.0398-3.932-6.24273-7-7.99764-3.068-1.754913-6.458-2-10-2s-6.932.245087-10 2c-3.0677 1.75491-6.2283 4.95784-8 7.99764L2 170.001C.226979 173.04.00154312 176.488.00000191 179.999-.0015393 183.51.229648 186.959 2 190c1.77035 3.04 4.93245 5.244 8 7 3.0675 1.756 6.4578 3 10 3h70c27.737 0 47.925-12.442 62-36l34-59 18-31 55 94h-73l-18 32Zm-79-32H40l73-126 37 63-24.509 42.725C116.144 163.01 105.488 168 89 168Z" />
55
<path fill="#00DC82" fill-rule="evenodd" d="M1120.15 197.2c4.93 2.267 10.12 2.8 15.85 2.8 9.73 0 18.35-1.533 25.55-5.8 7.2-4.267 12.67-10.333 16.4-18.2 3.87-7.867 6.05-16.6 6.05-27 0-10.4-2.18-19.933-6.05-27.8-3.73-7.867-9.2-13.933-16.4-18.2-7.07-4.2668-15.4-6.4001-25-6.4001-6.13 0-11.6 1.1333-16.4 3.4-4.8 2.1331-9.22 5.0671-12.15 8.8001V59.3999h-20c-4.42 0-8 3.5817-8 8V200h28v-12c2.8 3.867 7.22 6.933 12.15 9.2Zm-6.4-28.2c-4.53-5.2-6.75-12-6.75-20.4 0-8.533 2.15-15.333 6.55-20.4 4.53-5.2 10.53-7.8 18-7.8 7.47 0 13.4 2.6 17.8 7.8 4.53 5.067 6.8 11.867 6.8 20.4 0 8.4-2.27 15.2-6.8 20.4-4.53 5.067-10.47 7.6-17.8 7.6s-13.27-2.533-17.8-7.6ZM937 200V59.9999h-20c-4.418 0-8 3.5817-8 8V116h-54V59.9999h-28V200h19.946c4.439 0 8.029-3.615 7.999-8.054L854.6 141H909v59h28Zm118-45.989V92.0115h-16c-.12 0-.3.0004-.5.0009-.52.0013-1.21.003-1.5-.0009l-.09-.0012c-2.92-.0397-4.97-.0674-6.91 2.0012-2.23 2.3779-3 4.5651-3 7.9995v52c0 8.059-.46 13.037-4 17-3.54 3.832-6.78 5-14 5-7.09 0-11.457-1.168-15-5-3.543-3.963-4-8.941-4-17v-52c0-3.4344-.769-4.7537-3-6.9995-2.231-2.378-5.588-3-9-3h-16v61.9995c0 14.004 5.389 25.81 13 34 7.742 8.191 19.434 11.989 34 11.989 14.57 0 25.26-3.798 33-11.989 7.74-8.19 13-19.996 13-34Z" clip-rule="evenodd" />
66
</svg>
7-
<div v-else class="flex items-center gap-1" @click.right.prevent="onLogoClick">
8-
<span>Nuxt</span>
9-
<span class="rounded-sm bg-primary-400 dark:bg-primary-500 text-gray-900 px-0.5">hub</span>
7+
<div v-else class="flex items-center gap-1 text-[25px] font-extrabold" @click.right.prevent="onLogoClick">
8+
<UIcon name="i-simple-icons-nuxtdotjs" class="text-green-400 h-[36px] w-[36px] flex-shrink-0" />
9+
<span class="relative top-1">Nuxt</span>
10+
<span class="rounded-sm bg-primary-400 dark:bg-primary-500 text-gray-900 px-[4px] relative top-1">hub</span>
1011
</div>
1112
</template>
1213

1314
<script setup lang="ts">
14-
const defaultLogo = useState('logo-default', () => true)
15+
const defaultLogo = ref(true)
1516
1617
function onLogoClick () {
1718
defaultLogo.value = !defaultLogo.value

docs/content/docs/1.getting-started/1.index.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ Each storage utils is auto-imported and ready to be used in your [Nuxt's server
2222
NuxtHub comes with a powerful proxy system to connect to your project's resources from your local environment, allowing you to work with your remote storage as if it was local.
2323
::
2424

25-
## Modules
25+
## Packages
2626

2727
We plan to provide a complete backend experience for Nuxt apps through various `@nuxthub` modules.
2828

29-
- [`@nuxthub/core`](https://github.com/nuxt-hub/core): Main module to provide storage features
30-
- `@nuxthub/auth`: Authentication module for user management
31-
- `@nuxthub/analytics`: Analytics module to track events within your applicaiton and API
29+
- [`@nuxthub/core`](https://github.com/nuxt-hub/core): Main package to provide storage features
30+
- `@nuxthub/auth`: Add authentication for user management (soon)
31+
- `@nuxthub/email`: Send transactional emails to your users (soon)
32+
- `@nuxthub/analytics`: Understand your traffic and track events within your application and API (soon)
3233
- `@nuxthub/...`: You name it!
3334

3435
::callout

docs/content/docs/1.getting-started/2.installation.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
title: Installation
3-
description: Add NuxtHub core module to your Nuxt project.
3+
description: Add NuxtHub to your Nuxt project.
44
---
55

66

77
## Setup
88

9-
1. Install the NuxtHub module to your project:
9+
1. Install the NuxtHub package to your project:
1010

1111
::code-group
1212

@@ -50,18 +50,18 @@ bun add --dev @nuxthub/core
5050

5151
::
5252

53-
3. Add `@nuxthub/core` to your `modules` section in your `nuxt.config`:
53+
3. Add `@nuxthub/core` to your `extends` section in your `nuxt.config`:
5454

5555
```ts [nuxt.config.ts]
5656
export default defineNuxtConfig({
57-
modules: ['@nuxthub/core']
57+
extends: ['@nuxthub/core']
5858
})
5959
```
6060

61-
That's it! You can now use the NuxtHub module in your Nuxt project.
61+
That's it! You can now use NuxtHub features in your Nuxt project.
6262

6363
::callout
64-
The module will create a `.data/hub` directory in your project root, which contains the necessary configuration files and resources for the module to work. It will also add it to the `.gitignore` file to avoid committing it to your repository.
64+
NuxtHub will create a `.data/hub` directory in your project root, which contains the necessary configuration files and resources for the features to work. It will also add it to the `.gitignore` file to avoid committing it to your repository.
6565
::
6666

6767
## Options
@@ -70,7 +70,7 @@ Configure options in your `nuxt.config.ts` as such:
7070

7171
```ts [nuxt.config.ts]
7272
export default defineNuxtConfig({
73-
modules: ['@nuxthub/core'],
73+
extends: ['@nuxthub/core'],
7474
hub: {
7575
remote: true
7676
}

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

+4-6
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export default defineNuxtConfig({
4949
})
5050
```
5151

52-
The module will use the remote storage from your deployed project **as long as you are logged in with the [NuxtHub CLI](https://github.com/nuxt-hub/cli) and the local project is linked to a NuxtHub project**.
52+
Nuxt will use the remote storage from your deployed project **as long as you are logged in with the [NuxtHub CLI](https://github.com/nuxt-hub/cli) and the local project is linked to a NuxtHub project**.
5353

5454
## Self-hosted
5555

@@ -75,22 +75,20 @@ Once the deployment is done, NuxtHub should be ready to use in your deployed pro
7575

7676
### Remote Storage
7777

78-
To enable remote storage in your self-hosted project, the module requires a secret to access it.
78+
To enable remote storage in your self-hosted project, you need to create a secret key.
7979

80-
1. Set the `NUXT_HUB_PROJECT_SECRET` environment variable in your Cloudflare Pages project settings and retry the last deployment to apply the changes.
80+
1. Set the `NUXT_HUB_PROJECT_SECRET` environment variable in your Cloudflare Pages project settings and retry the last deployment to apply the changes (you can generate a random secret on https://www.uuidgenerator.net/version4)
8181
2. Set the same `NUXT_HUB_PROJECT_SECRET` and `NUXT_HUB_PROJECT_URL` environment variables in your local project
8282

8383
```bash [.env]
8484
NUXT_HUB_PROJECT_SECRET=my-project-secret-used-in-cloudflare-env
8585
NUXT_HUB_PROJECT_URL=https://my-nuxthub-project.pages.dev
8686
```
8787

88-
When restarting your local server, the module will automatically use the remote data from your deployed project as long as the `NUXT_HUB_PROJECT_SECRET` matches the one in your Cloudflare Pages project settings.
89-
9088
Then, start your Nuxt project with:
9189

9290
```bash [Terminal]
9391
npx nuxt dev --remote
9492
```
9593

96-
Your development project will now use the remote storage from your deployed project.
94+
NuxtHub will use the remote data from your deployed project as long as the `NUXT_HUB_PROJECT_SECRET` matches the one in your Cloudflare Pages project settings.

docs/content/index.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
title: 'NuxtHub'
2-
description: 'Build full-stack Nuxt apps, with zero configuration.'
1+
title: 'NuxtHub: Build full-stack Nuxt apps, on the edge.'
2+
description: 'Access to a Database, Key-Value, and Blob storage with zero configuration. Deploy with confidence on your Cloudflare account and access to your remote storage locally with our secured proxy.'
33
navigation: false
44
hero:
55
title: 'Build full-stack <span class="text-primary">Nuxt apps</span>, on the edge.'
66
description: 'Access to a Database, Key-Value, and Blob storage with zero configuration. Deploy with confidence on your Cloudflare account and access to your remote storage locally with our secured proxy.'
77
orientation: horizontal
8+
headline:
9+
to: https://github.com/nuxt-hub/core
10+
label: Alpha version is out!
11+
target: _blank
812
links:
913
- label: Get started
1014
icon: i-heroicons-arrow-right-20-solid

docs/pages/index.vue

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
<script setup lang="ts">
2+
import { joinURL } from 'ufo'
23
const { data: page } = await useAsyncData('index', () => queryContent('/').findOne())
34
5+
const { url } = useSiteConfig()
6+
47
useSeoMeta({
58
title: page.value.title,
69
ogTitle: page.value.title,
710
description: page.value.description,
811
ogDescription: page.value.description,
9-
ogImage: 'https://hub.nuxt.com/social.png'
12+
ogImage: joinURL(url, '/social.png')
1013
})
11-
1214
</script>
1315

1416
<template>

docs/tailwind.config.ts

+28
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,34 @@ import defaultTheme from 'tailwindcss/defaultTheme'
44
export default <Partial<Config>>{
55
theme: {
66
extend: {
7+
colors: {
8+
slate: {
9+
50: '#f8fafc',
10+
100: '#f1f5f9',
11+
200: '#e2e8f0',
12+
300: '#cbd5e1',
13+
400: '#94a3b8',
14+
500: '#64748b',
15+
600: '#475569',
16+
700: '#334155',
17+
800: '#1e293b',
18+
900: '#0f172a',
19+
950: '#020420'
20+
},
21+
green: {
22+
50: '#EFFDF5',
23+
100: '#D9FBE8',
24+
200: '#B3F5D1',
25+
300: '#75EDAE',
26+
400: '#00DC82',
27+
500: '#00C16A',
28+
600: '#00A155',
29+
700: '#007F45',
30+
800: '#016538',
31+
900: '#0A5331',
32+
950: '#052e16'
33+
}
34+
},
735
fontFamily: {
836
sans: ['DM Sans', 'DM Sans fallback', ...defaultTheme.fontFamily.sans]
937
}

nuxt.config.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { createResolver } from '@nuxt/kit'
2+
3+
const { resolve } = createResolver(import.meta.url)
4+
5+
export default defineNuxtConfig({
6+
extends: resolve('src/')
7+
})

package.json

+8-17
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,26 @@
22
"name": "@nuxthub/core",
33
"private": false,
44
"version": "0.1.15",
5-
"description": "Nuxt Toolkit to create full-stack applications on the Edge.",
5+
"description": "Build full-stack Nuxt applications on Cloudflare, with zero configuration.",
66
"repository": {
77
"type": "git",
88
"url": "git+https://github.com/nuxt-hub/core.git"
99
},
1010
"license": "Apache-2.0",
1111
"type": "module",
12-
"exports": {
13-
".": {
14-
"types": "./dist/types.d.ts",
15-
"import": "./dist/module.mjs",
16-
"require": "./dist/module.cjs"
17-
}
18-
},
19-
"main": "./dist/module.cjs",
20-
"types": "./dist/types.d.ts",
12+
"main": "./nuxt.config.ts",
2113
"files": [
22-
"dist"
14+
"src",
15+
"nuxt.config.ts"
2316
],
17+
"keywords": ["nuxt", "fullstack", "cloudflare", "database", "kv", "blob"],
2418
"scripts": {
25-
"prepack": "nuxt-module-build build",
26-
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
19+
"dev:prepare": "nuxi prepare playground",
2720
"dev": "nuxi dev playground",
2821
"dev:build": "nuxi build playground",
2922
"docs": "nuxi dev docs",
3023
"docs:build": "nuxi generate docs",
31-
"release": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
24+
"release": "npm run lint && npm run test && changelogen --release && npm publish && git push --follow-tags",
3225
"lint": "eslint .",
3326
"test": "vitest run",
3427
"test:watch": "vitest watch"
@@ -55,7 +48,6 @@
5548
},
5649
"devDependencies": {
5750
"@nuxt/eslint-config": "^0.2.0",
58-
"@nuxt/module-builder": "^0.5.5",
5951
"@nuxt/schema": "^3.10.3",
6052
"@nuxt/test-utils": "^3.11.0",
6153
"@types/node": "^20.11.20",
@@ -64,7 +56,6 @@
6456
"nuxt": "^3.10.3",
6557
"typescript": "^5.3.3",
6658
"vitest": "^1.3.1",
67-
"vue-tsc": "^1.8.27",
6859
"wrangler": "^3.29.0"
6960
}
70-
}
61+
}

playground/nuxt.config.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
export default defineNuxtConfig({
22
devtools: { enabled: true },
3+
extends: [
4+
'../'
5+
],
36
modules: [
4-
'../src/module',
57
'@nuxt/ui',
68
'@kgierke/nuxt-basic-auth'
79
],
810
ui: {
911
icons: ['heroicons', 'simple-icons']
1012
},
11-
// hub: {
12-
// remote: true
13-
// },
1413
basicAuth: {
1514
enabled: process.env.NODE_ENV === 'production',
1615
allowedRoutes: ['/api/_hub/'],

playground/server/api/test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export default eventHandler(async () => {
88
await kv.set('react:next', { version: 2016 })
99
await kv.set('react:gatsby', { version: 2015 })
1010

11+
1112
return kv.keys()
1213
// const db = hubDatabase()
1314
// return useProjectKV(projectUrl).getKeys()

0 commit comments

Comments
 (0)