Skip to main content
Layercode runs in our cloud, but you will need to deploy your Next.js application to provide your APIs and agent functionality (LLMs and tool calling). Plus if you are building for web, your Next.js acts as the client. This guide assumes you already have your Next.js application running locally with Layercode. If not, pleae follow our getting started guide If you are using our Cloudflare getting-started project, you can simply run npm run deploy Otherwise, you should run
  npm i @opennextjs/cloudflare
and add a deploy script in your package.json
"deploy": "opennextjs-cloudflare build && opennextjs-cloudflare deploy"
Then run
npm run deploy
You will be asked to create/connect a Cloudflare account if you don’t already have one connected.
note: you will need to use npm to deploy to Cloudflare because it expects a package-lock.json file*
You should see an ouput like this:
Total Upload: 5867.42 KiB / gzip: 1177.82 KiB
Worker Startup Time: 25 ms
Your Worker has access to the following bindings:
Binding            Resource
env.ASSETS         Assets

Uploaded jolly-queen-84e7 (16.45 sec)
Deployed jolly-queen-84e7 triggers (4.70 sec)
  https://jolly-queen-84e7.jacksbridger.workers.dev
Current Version ID: 047446f6-055e-46b0-b67a-b45cb14fa8e8
Take that url (e.g. https://jolly-queen-84e7.jacksbridger.workers.dev) of your backend and save it into the Layercode agent backend settings under webhook url (append the appropriate path for your API e.g. https://jolly-queen-84e7.jacksbridger.workers.dev/api/agent) Then your application should run. But please reach out if you run into any issues.