|
| 1 | +--- |
| 2 | +title: NuxtHub on Workers |
| 3 | +description: "Deploy your Nuxt apps to Cloudflare Workers and build real-time experiences with zero configuration." |
| 4 | +date: 2025-04-15 |
| 5 | +image: '/images/changelog/workers-support.png' |
| 6 | +authors: |
| 7 | + - name: Sebastien Chopin |
| 8 | + avatar: |
| 9 | + src: https://avatars.githubusercontent.com/u/904724?v=4 |
| 10 | + to: https://bsky.app/profile/atinux.com |
| 11 | + username: atinux |
| 12 | + - name: Rihan Arfan |
| 13 | + avatar: |
| 14 | + src: https://avatars.githubusercontent.com/u/20425781?v=4 |
| 15 | + to: https://bsky.app/profile/rihan.dev |
| 16 | + username: rihan.dev |
| 17 | + - name: Ahad Birang |
| 18 | + avatar: |
| 19 | + src: https://avatars.githubusercontent.com/u/2047945?v=4 |
| 20 | + to: https://bsky.app/profile/farnabaz.dev |
| 21 | + username: farnabaz.dev |
| 22 | +--- |
| 23 | + |
| 24 | +::tip |
| 25 | +This feature is available on both [free and pro plans](/pricing) and in [`@nuxthub/core >= v0.8.24`](https://github.com/nuxt-hub/core/releases/tag/v0.8.24). |
| 26 | +:: |
| 27 | + |
| 28 | +After much development (and [many](https://x.com/Atinux/status/1907552625559744865/photo/1) [teasers](https://x.com/Atinux/status/1884315020982657452/video/1)), we're thrilled to announce that NuxtHub now supports deploying to Cloudflare Workers! |
| 29 | + |
| 30 | +## Why Workers |
| 31 | + |
| 32 | +For a while, Cloudflare have been releasing exciting new features such as [observability & persistent logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/), [workflows](https://developers.cloudflare.com/workflows/), [cron triggers](https://developers.cloudflare.com/workers/configuration/cron-triggers/), and [much more](https://developers.cloudflare.com/workers/static-assets/migrate-from-pages/#compatibility-matrix). However, these features are only available on Cloudflare Workers, and were not brought to Cloudflare Pages. |
| 33 | + |
| 34 | +Now with the introduction of [static assets](https://developers.cloudflare.com/workers/static-assets/), suddenly it is now viable to deploy Nuxt applications to Cloudflare Workers, and we can benefit from the new features and services available on Cloudflare Workers. |
| 35 | + |
| 36 | +## Real-time |
| 37 | + |
| 38 | +Projects deployed to NuxtHub on Workers also fully support [Nitro WebSocket](https://nitro.build/guide/websocket), allowing you to create real-time experiences on NuxtHub. Simply set `nitro.experimental.websocket` to `true` in your `nuxt.config.ts`, create your websocket server route with crossws, and deploy! |
| 39 | + |
| 40 | +Under the hood this is powered by Cloudflare Durable Objects. Nitro and NuxtHub magically takes care of everything related to the Durable Object, from building to deploying. |
| 41 | + |
| 42 | +Check out our [multiplayer-globe](https://github.com/nuxt-hub/multiplayer-globe) template for an example of using websockets ([live demo](https://multiplayer-globe.nuxthub.workers.dev/)). |
| 43 | + |
| 44 | +::note{to=https://nitro.build/guide/websocket icon="i-lucide-book"} |
| 45 | +Learn more about Nitro WebSocket on the Nitro documentation |
| 46 | +:: |
| 47 | + |
| 48 | +## Deploying to Workers |
| 49 | + |
| 50 | +Get started by creating a new project and selecting the Cloudflare Workers type on the [NuxtHub Admin](https://admin.hub.nuxt.com) or with the latest version of the `nuxthub` CLI ([v0.9.0](https://github.com/nuxt-hub/cli/releases)). All our templates are fully compatible with NuxtHub on Workers. |
| 51 | + |
| 52 | +We're working on a migration path to help simplify the switch from Cloudflare Pages to Workers. Until then, you can deploy your existing Nuxt apps to Cloudflare Workers by setting `hub.workers` to `true`, and linking them to a separate new project with the Workers type, then manually moving any data stored in your database, KV or blob. |
| 53 | + |
| 54 | +::note |
| 55 | +While NuxtHub on Workers is in beta, preview environments aren't unavailable. Stay tuned for updates. |
| 56 | +:: |
| 57 | + |
| 58 | +::important |
| 59 | +**If you already have a NuxtHub account**, make sure to add the `Workers Scripts` permission on your Cloudflare API token. |
| 60 | + |
| 61 | +- Open [Cloudflare User API Tokens](https://dash.cloudflare.com/profile/api-tokens) |
| 62 | +- Find your NuxtHub token(s) |
| 63 | +- Add the `Workers Scripts > Edit` permission |
| 64 | +- Save the changes |
| 65 | + |
| 66 | +Another solution is to link again your Cloudflare account from your NuxtHub team settings by clicking on `Connect a different Cloudflare account` > `Create a token`. |
| 67 | +:: |
| 68 | + |
| 69 | +## What's next |
| 70 | + |
| 71 | +Throughout the next few weeks, we'll be enhancing NuxtHub on Workers with new features and integration with more Cloudflare Workers-specific services, including: |
| 72 | + |
| 73 | +- **Observability**: Automatically ingest, filter, and analyse logs |
| 74 | +- **Queues**: Process background tasks effectively at scale |
| 75 | +- **Cron Tasks**: Run Nitro tasks automatically on a schedule |
| 76 | +- **Environments**: Bringing the preview environment to NuxtHub on Workers |
| 77 | + |
| 78 | +Let us know your feedback by joining our [Discord ](https://discord.gg/vW89dsVqBF), following us on [X ](https://x.com/nuxt_hub), or emailing us at [email protected]. |
0 commit comments