Skip to content

Commit

Permalink
feat: add hubAI() (#173)
Browse files Browse the repository at this point in the history
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Sébastien Chopin <[email protected]>
  • Loading branch information
3 people authored Aug 15, 2024
1 parent d09df1e commit 5ba86f9
Show file tree
Hide file tree
Showing 97 changed files with 1,801 additions and 694 deletions.
66 changes: 33 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,67 @@
# NuxtHub
# NuxtHub: Full-Stack Nuxt on Cloudflare, with Zero Config

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![License][license-src]][license-href]
[![Nuxt][nuxt-src]][nuxt-href]

Build full-stack applications with Nuxt on Cloudflare, with zero configuration.
Build and deploy powerful full-stack Nuxt applications on your Cloudflare account, with zero configuration.

## Features
NuxtHub supercharges your Nuxt development workflow so you can focus on shipping features.

- **Deploy your Nuxt app** to your Cloudflare account with [`npx nuxthub deploy`](https://github.com/nuxt-hub/cli) or with the [NuxtHub Admin](https://admin.hub.nuxt.com)
- **SQL database** to store your application's data with [`hubDatabase()`](https://hub.nuxt.com/docs/storage/database)
- **Key-Value** to store JSON data accessible globally with low-latency with [`hubKV()`](https://hub.nuxt.com/docs/storage/kv)
- **Blob storage** to store static assets, such as images, videos and more with [`hubBlob()`](https://hub.nuxt.com/docs/storage/blob)
- **Cache storage** to cache your server route responses or functions using Nitro's [`cachedEventHandler`](https://nitro.unjs.io/guide/cache#cached-event-handlers) and [`cachedFunction`](https://nitro.unjs.io/guide/cache#cached-functions)
## ✨ Key Features

NuxtHub provides optional features to help you build full-stack applications:
- [**Deploy your Nuxt app**](https://hub.nuxt.com/docs/getting-started/deploy) to your Cloudflare account with [`npx nuxthub deploy`](https://github.com/nuxt-hub/cli) or with the [NuxtHub Admin](https://admin.hub.nuxt.com)
- [**AI Models**](https://hub.nuxt.com/docs/features/ai) to run machine learning models, such as LLMs in Nuxt.
- [**Files storage**](https://hub.nuxt.com/docs/features/blob) to store static assets, such as images, videos and more
- [**Caching system**](https://hub.nuxt.com/docs/features/cache) for your Nuxt pages, API routes or server functions
- [**SQL database**](https://hub.nuxt.com/docs/features/database) to store your application's data
- [**Key-Value**](https://hub.nuxt.com/docs/features/kv) to store JSON data accessible globally with low-latency
- [**Open API**](https://hub.nuxt.com/docs/features/open-api) to generate your API documentation with [Scalar](https://scalar.com)
- [**Remote Storage**](https://hub.nuxt.com/docs/getting-started/remote-storage) to connect to your project's resources from your local environment, allowing you to work with your remote storage as if it was local with `npx nuxi dev --remote`.

Read more on https://hub.nuxt.com

## Quick Setup
## 🚀 Quickstart

Head over to our [Getting Started](https://hub.nuxt.com/docs/getting-started/installation) guide to learn more.

Duplicate our [nuxt-hub/starter](https://github.com/nuxt-hub/starter) or create a new NuxtHub project with:
Duplicate our `nuxt-hub/hello-edge` template or create a new NuxtHub project with:

```bash
npx nuxthub init my-app
cd my-app
npm run dev
```

## Add to a Nuxt project
Open http://localhost:3000 with your browser.

1. Install `@nuxthub/core` dependency to your project:
Deploy your app to production with:

```bash
npx nypm@latest add @nuxthub/core
npx nuxthub deploy
```

2. Install `wrangler` development dependency to your project:
https://github.com/user-attachments/assets/c591efaa-96e7-4357-8d60-cdc1e20e93ed

```bash
npx nypm@latest add -D wrangler
```
Learn more on [how to deploy a Nuxt app with NuxtHub](https://hub.nuxt.com/docs/getting-started/deploy).

3. Add `@nuxthub/core` to the `modules` section of `nuxt.config.ts`
## 📚 Resources

```js
export default defineNuxtConfig({
modules: [
'@nuxthub/core'
]
})
```

That's it! You can now use NuxtHub features in your Nuxt app ✨
- [NuxtHub Website](https://hub.nuxt.com)
- [NuxtHub Admin](https://admin.hub.nuxt.com)
- [NuxtHub CLI](https://github.com/nuxt-hub/cli)
- [NuxtHub Templates](https://hub.nuxt.com/templates)

## Feedback
## 🤝 Community

- 💡 [Feature request](https://github.com/nuxt-hub/core/issues/new?assignees=&labels=enhancement&projects=&template=%F0%9F%92%A1-feature-request.md&title=): Suggest an idea or improvement.
- 🐞 [Bug report](https://github.com/nuxt-hub/core/issues/new?assignees=&labels=bug&projects=&template=%F0%9F%90%9E-bug-report.md&title=): Create a report to help us improve the platform.
- 🏞️ [New Template](https://github.com/nuxt-hub/core/issues/new?assignees=&labels=template&projects=&template=%F0%9F%8F%9E%EF%B8%8F-new-template.md&title=): Share a template you made based on NuxtHub.


## Contributing
## 💚 Contributing

```bash
# Install dependencies
Expand All @@ -79,12 +82,9 @@ pnpm lint
# Run Vitest
pnpm test
pnpm test:watch

# Release new version
pnpm release
```

## License
## 📄 License

[Apache 2.0](./LICENSE)

Expand Down
2 changes: 1 addition & 1 deletion docs/components/AppFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const links = [
</template>

<template #right>
<UColorModeButton />
<ColorScheme><UColorModeSelect /></ColorScheme>
<UButton
icon="i-simple-icons-x"
color="gray"
Expand Down
2 changes: 1 addition & 1 deletion docs/components/AppHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const navLinks = links.map((link) => {
children: mapContentNavigation(navigation.value)
.find(link => link.label === 'Docs')
.children
.map(({ icon, ...link }) => link)
.map(({ icon, ...link }) => link) // eslint-disable-line @typescript-eslint/no-unused-vars
}
}
return {
Expand Down
33 changes: 16 additions & 17 deletions docs/content/0.index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ hero:
light: '/images/landing/hero-light.svg'
dark: '/images/landing/hero-dark.svg'
headline:
label: Code, Draw, Deploy
to: /blog/drawing-app-with-nuxt-and-cloudflare-r2
label: NuxtHub AI is out
to: /changelog/hub-ai
icon: i-ph-arrow-right
links:
- label: Get started
Expand Down Expand Up @@ -73,30 +73,29 @@ deploy:
trailing-icon: i-ph-arrow-right
color: black
size: lg
to: https://admin.hub.nuxt.com/?utm_source=nuxthub-docs&utm_medium=home
target: _blank
to: /docs/getting-started/deploy
- label: Start locally
color: gray
variant: ghost
to: '/docs/getting-started'
size: lg
database:
img:
src: '/images/landing/nuxthub-database.png'
src: '/images/landing/nuxthub-admin-database.png'
width: 576
height: 314
height: 325
headline: NuxtHub Database
title: A <span class="text-primary">scalable database</span> for your Nuxt application.
description: 'NuxtHub Database unlocks the power of <a class="font-semibold text-gray-800 dark:text-white hover:underline underline-offset-4" href="https://developers.cloudflare.com/d1/" target="_blank">Cloudflare D1</a> to give you access to a serverless SQL database, with zero configuration.
Scale and manage effortlessly, and pay only for what you use.'
features:
- name: 'hubDatabase() server composable'
- name: 'Database browser powered by Drizzle Studio'
- name: 'Nuxt Devtools integration'
- name: 'Nuxt DevTools integration'
buttons:
- label: Database docs
size: lg
to: /docs/storage/database
to: /docs/features/database
trailing-icon: i-ph-arrow-right
- label: nuxt-todos-edge
icon: i-simple-icons-github
Expand All @@ -119,21 +118,21 @@ database:
description: 5 GB (total)
blob:
img:
src: '/images/landing/nuxthub-blob.png'
src: '/images/landing/nuxthub-admin-blob.png'
width: 576
height: 314
height: 325
headline: NuxtHub Blob
title: Add <span class="text-primary">file uploads</span> to your Nuxt application.
description: 'NuxtHub Blob lets you to store and access media files on a global network, thanks to <a class="font-semibold text-gray-800 dark:text-white hover:underline underline-offset-4" href="https://developers.cloudflare.com/r2/" target="_blank">Cloudflare R2</a>
Let users upload data like images, videos and audio files with our server composable with our blob validator.'
features:
- name: 'hubBlob() server composable'
- name: 'Dashboard to upload and manage files'
- name: 'Manage blobs in the Nuxt Devtools'
- name: 'Manage blobs in the Nuxt DevTools'
buttons:
- label: Blob documentation
size: lg
to: /docs/storage/blob
to: /docs/features/blob
trailing-icon: i-ph-arrow-right
- label: nuxt-image-gallery
icon: i-simple-icons-github
Expand All @@ -156,21 +155,21 @@ Let users upload data like images, videos and audio files with our server compos
description: 10 GB / month
kv:
img:
src: '/images/landing/nuxthub-kv.png'
src: '/images/landing/nuxthub-admin-kv.png'
width: 576
height: 314
height: 325
headline: NuxtHub KV
title: A Global <span class="text-primary">Key-Value Database</span> for Nuxt.
description: 'NuxtHub KV leverages <a href="https://developers.cloudflare.com/kv/" target="_blank" class="font-semibold text-gray-800 dark:text-white hover:underline underline-offset-4">Cloudflare Workers KV</a> to access a global, low-latency, key-value data storage across 300+ global locations.
Access it in your Nuxt codebase, with zero-configuration.'
features:
- name: 'hubKV() server composable'
- name: 'Key-Value storage visual browser'
- name: 'Manage KV storage in the Nuxt Devtools'
- name: 'Manage KV storage in the Nuxt DevTools'
buttons:
- label: KV documentation
size: lg
to: /docs/storage/kv
to: /docs/features/kv
trailing-icon: i-ph-arrow-right
- label: atinotes
icon: i-simple-icons-github
Expand Down Expand Up @@ -259,7 +258,7 @@ tool:
description: 'Select a repository from your GitHub account and deploy it globally.'
img: '/images/landing/tool-github.svg'
- title: 'Nuxt DevTools'
description: 'Manage your NuxtHub database, kv & blob in the Nuxt Devtools.'
description: 'Manage your NuxtHub database, kv & blob in the Nuxt DevTools.'
img: '/images/landing/tool-devtools.svg'
testimonials:
headline: 'Wall of love'
Expand Down
110 changes: 74 additions & 36 deletions docs/content/1.docs/1.getting-started/1.index.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,102 @@
---
title: Introduction
description: NuxtHub helps you build full-stack applications on the Edge.
navigation.title: Introduction
title: What is NuxtHub?
description: NuxtHub helps you build and deploy full-stack Nuxt applications globally.
---

NuxtHub aims to provide a complete backend experience for [Nuxt](https://nuxt.com) apps, allowing developers to build full-stack applications on the Edge, read more about [Nuxt on the edge](https://nuxt.com/blog/nuxt-on-the-edge).
On top of deploying your Nuxt application, NuxtHub aims to provide a complete backend experience on top of the framework, allowing developers to build full-stack applications on the Edge, read more about [Nuxt on the Edge](https://nuxt.com/blog/nuxt-on-the-edge).

::callout
It is **currently made to be deployed on [Cloudflare Pages](https://pages.cloudflare.com)** as it leverages many Cloudflare features such as KV, D1, and R2. We are looking to support other platforms in the future.
It leverages Cloudflare features such as Pages, Workers Analytics, AI, KV, D1, R2 and more.

::tip
**NuxtHub is what Vercel / Netlify is for AWS, but for Cloudflare.** :br
It also deploys to your Cloudflare account so you stay in control of your data and billing as we don't mark-up Cloudflare prices.
::

## Features

NuxtHub provides multiple features to help you build full-stack applications:
- **SQL database** to store your application's data with [`hubDatabase()`](/docs/storage/database)
- **Key-Value** to store JSON data accessible globally with low-latency with [`hubKV()`](/docs/storage/kv)
- **Blob storage** to store static assets, such as images, videos and more with [`hubBlob()`](/docs/storage/blob)
- **Cache storage** to cache your server route responses or functions using Nitro's [`cachedEventHandler`](https://nitro.unjs.io/guide/cache#cached-event-handlers) and [`cachedFunction`](https://nitro.unjs.io/guide/cache#cached-functions)

Each storage utils is auto-imported and configured to be used in your [Nuxt's server directory](https://nuxt.com/docs/guide/directory-structure/server).
NuxtHub provides optional features to help you build full-stack applications:
- [AI Models](/docs/features/ai) to run machine learning models, such as LLMs in Nuxt.
- [Blob storage](/docs/features/blob) to store static assets, such as images, videos and more
- [Caching system](/docs/features/cache) for your Nuxt pages, API routes or server functions
- [SQL database](/docs/features/database) to store your application's data
- [Key-Value](/docs/features/kv) to store JSON data accessible globally with low-latency
- [Open API](/docs/features/open-api) to generate your API documentation with [Scalar](https://scalar.com)

::callout{icon="i-ph-plugs-connected-duotone" to="/docs/getting-started/deploy#remote-storage"}
::tip{icon="i-ph-plugs-connected-duotone" to="/docs/getting-started/remote-storage"}
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 with `npx nuxi dev --remote`.
::

## Packages

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

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

::important
We are currently in the early stages of development (beta) and are looking for feedback from the community. If you are interested in contributing, please join us on [nuxt-hub/core](https://github.com/nuxt-hub/core).
::

## Admin
## NuxtHub Admin

::tabs
::div{label="Projects"}
[![nuxt-hub-admin](/images/landing/nuxthub-admin.png){class="border rounded dark:border-gray-700 border-gray-200"}](https://admin.hub.nuxt.com)
![nuxthub-admin](/images/landing/nuxthub-admin.png){class="border rounded dark:border-gray-700 border-gray-200" data-zoom-src="/images/landing/nuxthub-admin.png"}
::
::div{label="Deployments"}
[![nuxt-hub-admin-project](/images/landing/nuxthub-admin-project.png){class="border rounded dark:border-gray-700 border-gray-200"}](https://admin.hub.nuxt.com)
![nuxthub-admin-project](/images/landing/nuxthub-admin-project.png){class="border rounded dark:border-gray-700 border-gray-200" data-zoom-src="/images/landing/nuxthub-admin-project.png"}
::
::div{label="Database"}
[![nuxt-hub-admin-database](/images/landing/nuxthub-admin-database.png){class="border rounded dark:border-gray-700 border-gray-200"}](https://admin.hub.nuxt.com)
![nuxthub-admin-database](/images/landing/nuxthub-admin-database.png){class="border rounded dark:border-gray-700 border-gray-200" data-zoom-src="/images/landing/nuxthub-admin-database.png"}
::
::div{label="KV"}
![nuxthub-admin-kv](/images/landing/nuxthub-admin-kv.png){class="border rounded dark:border-gray-700 border-gray-200" data-zoom-src="/images/landing/nuxthub-admin-kv.png"}
::
::div{label="Blob"}
![nuxthub-admin-blob](/images/landing/nuxthub-admin-blob.png){class="border rounded dark:border-gray-700 border-gray-200" data-zoom-src="/images/landing/nuxthub-admin-blob.png"}
::
::div{label="Logs"}
![nuxthub-admin-logs](/images/landing/nuxthub-admin-server-logs.png){class="border rounded dark:border-gray-700 border-gray-200" data-zoom-src="/images/landing/nuxthub-admin-server-logs.png"}
::
::div{label="Open API"}
![nuxthub-admin-open-api](/images/landing/nuxthub-admin-open-api.png){class="border rounded dark:border-gray-700 border-gray-200" data-zoom-src="/images/landing/nuxthub-admin-open-api.png"}
::
::div{label="Cache"}
![nuxthub-admin-cache](/images/landing/nuxthub-admin-cache.png){class="border rounded dark:border-gray-700 border-gray-200" data-zoom-src="/images/landing/nuxthub-admin-cache.png"}
::
::

The [NuxtHub admin](https://admin.hub.nuxt.com) is a web based dashboard to manage your NuxtHub apps. It helps you deploy your NuxtHub apps with a single command on your Cloudflare account while provisioning all the necessary resources for you. It abstracts the complexity of managing full-stack Nuxt applications on Cloudflare.

### Features
The [NuxtHub admin](https://admin.hub.nuxt.com) is a web based dashboard to manage your NuxtHub apps. It helps you deploy your NuxtHub apps with a single command on your Cloudflare account while provisioning all the necessary resources for you.

It abstracts the complexity of managing full-stack Nuxt applications on Cloudflare:
- Link your Cloudflare account and stay in control, we never mark-up Cloudflare prices
- Deploy your application with `nuxthub deploy` command
- Relax while it provisions all the necessary resources (database, kv, blob)
- [Deploy your application](/docs/getting-started/deploy) with `nuxthub deploy` command or with Cloudflare Pages CI
- Relax while it provisions all the necessary resources (ai, blob, cache, database, kv)
- Manage your app's resources with an admin panel
- Visualize application, database, and cache metrics
- Give access to team members to manage the application without sharing your Cloudflare account
- Monitor your application with logs and analytics

::tip{icon="i-ph-rocket-launch-duotone" to="https://admin.hub.nuxt.com"}
Get started with NuxtHub Admin.
::

## Nuxt DevTools

NuxtHub also integrates with the [Nuxt DevTools](https://devtools.nuxt.com/) to provide a complete development experience.

::tabs
::div{label="Database"}
![nuxt-devtools-database](/images/landing/nuxt-devtools-database.png){class="border rounded dark:border-gray-700 border-gray-200" data-zoom-src="/images/landing/nuxt-devtools-database.png"}
::
::div{label="KV"}
![nuxt-devtools-kv](/images/landing/nuxt-devtools-kv.png){class="border rounded dark:border-gray-700 border-gray-200" data-zoom-src="/images/landing/nuxt-devtools-kv.png"}
::
::div{label="Blob"}
![nuxt-devtools-blob](/images/landing/nuxt-devtools-blob.png){class="border rounded dark:border-gray-700 border-gray-200" data-zoom-src="/images/landing/nuxt-devtools-blob.png"}
::
::

## Upcoming Packages

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

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

::important
We are currently in the early stages of development (beta) and are looking for feedback from the community. If you are interested in contributing, please join us on [nuxt-hub/core](https://github.com/nuxt-hub/core).
::
Loading

0 comments on commit 5ba86f9

Please sign in to comment.