diff --git a/docs/content/2.deploy/2.workers.md b/docs/content/2.deploy/2.workers.md new file mode 100644 index 0000000000..91421ea5fa --- /dev/null +++ b/docs/content/2.deploy/2.workers.md @@ -0,0 +1,53 @@ +--- +title: Workers +description: Nitro provides out of the box support for deploying to Edge Workers. +--- + +## Deploy to Workers + +Nitro provides out of the box support for deploying any Nitro app to different Edge Worker offerings as well as Service Workers. + +- [Cloudflare](/deploy/providers/cloudflare) +- [Vercel](/deploy/providers/vercel#vercel-edge-functions) +- [Netlify](/deploy/providers/netlify#netlify-edge-functions) +- [Lagon](/deploy/providers/lagon) +- [Browser Service Workers](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) (via experimental preset `service-worker`) + +::alert{type="warning"} +**Limitations** +:br +Deploying to edge workers has some limitations. See [limitations](/deploy/workers/#limitations) for more details. +:: + +### Limitations + +- No support for raw TCP/IP traffic +- Execution time is limited compared to classic serverless offerings (normally 15-30 seconds) +- No access to the filesystem (use the [nitro storage](/guide/introduction/storage) layer) +- Budnle size is very limited (normally a few MBs) +- Limited access Node.js APIs (nitro provides compatibility layer via [unjs/unenv](https://github.com/unjs/unenv)) + +### Incompatible libraries + +::alert{type="info"} +**Help us** +:br +If you come across a library that you assume to be incompatible with edge workers, please open an issue on the [nitro repo](https://github.com/unjs/nitro/issues/new/choose) and help us keeping this list up to date. +:: + +The following libraries are known to be incompatible with edge workers because of one of the above mentioned limitations: + +- `mongodb` + +> There are possible fixes for MongoDB, like using Realm and the [Realm SDK](https://www.mongodb.com/docs/realm/sdk/node/) or +> using http interfaces (only available when self hosting MongoDB), but these are untested. You can find an example for using realm [here](https://github.com/albionstatus/albionstatus-backend/) + +- `mysql` + +> You can find an example with a modified MySQL driver [here](https://github.com/cloudflare/worker-template-mysql) + +- `rhea` +- `gremlin` +- `ioredis` +- `cassandra-driver` +- `kafkajs`