Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add hubAI() #173

Merged
merged 37 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
1ab8574
feat: add ai
RihanArfan Jun 18, 2024
2a03a99
feat: add hubAi()
RihanArfan Jun 18, 2024
d62023a
test: add basic tests for ai
RihanArfan Jun 18, 2024
f8dfde8
fix: typo with comments
RihanArfan Jun 18, 2024
e2ed0fe
feat: add ai
RihanArfan Jun 18, 2024
c1cc3f7
feat: basic ai playground
RihanArfan Jun 18, 2024
1874ed5
feat: support specifying account id to wrangler
RihanArfan Jun 18, 2024
83655de
fix: typo in error message
RihanArfan Jun 19, 2024
08cfc88
feat: include ai in manifest
RihanArfan Jun 25, 2024
005ecaf
feat: remote ai
RihanArfan Jun 25, 2024
582e815
[autofix.ci] apply automated fixes
autofix-ci[bot] Jun 25, 2024
2388d3a
Merge branch 'main' into feat/ai
atinux Jun 27, 2024
9be445a
Merge branch 'main' into feat/ai
atinux Jun 27, 2024
4619d96
docs: nuxthub ai
RihanArfan Jun 27, 2024
6950711
chore: update model used in playground example
RihanArfan Jun 27, 2024
6790e27
chore: rename to hubAI
atinux Jul 25, 2024
f82efba
chore: update to hubAI() and support NuxtHub proxy
atinux Jul 30, 2024
f48a899
chore: changelog wip
atinux Aug 4, 2024
232ab65
up
atinux Aug 5, 2024
48ebfc2
Merge branch 'main' into pr/173
atinux Aug 5, 2024
3358420
chore: add a warning if token not ready
atinux Aug 5, 2024
f5b8db6
chore: up
atinux Aug 6, 2024
1121b3b
chore: update docs
atinux Aug 6, 2024
f51aa5e
up
atinux Aug 7, 2024
7731b63
chore: update
atinux Aug 7, 2024
0c1a449
up
atinux Aug 7, 2024
0f9d46e
up
atinux Aug 8, 2024
476a418
[autofix.ci] apply automated fixes
autofix-ci[bot] Aug 8, 2024
7aebc93
debug: return content-type when available and fallback to image
atinux Aug 10, 2024
91e945d
fix(ai): return content type for image generatin
atinux Aug 10, 2024
e46b60e
wip
atinux Aug 11, 2024
842a365
Merge branch 'main' into pr/173
atinux Aug 13, 2024
bc7fa1b
chore: more update
atinux Aug 15, 2024
601f084
Merge branch 'main' into feat/ai
atinux Aug 15, 2024
03fee11
chore: update
atinux Aug 15, 2024
125aacd
chore: lint fix
atinux Aug 15, 2024
10821db
chore: handle blog post as draft
atinux Aug 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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