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 application running locally with Layercode. If not, pleae follow our getting started guide To deploy to Vercel:
  1. push your changes to a remote repo (i.e. GitHub/GitLab).
  2. Sign up at Vercel, Click Add New project
  3. Then import your Git Respository
  4. Paste in your environmental variables from .env
  5. Deploy
  6. Take that url (e.g. https://fullstack-nextjs-vercel-five.vercel.app/) 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://fullstack-nextjs-vercel-five.vercel.app/api/agent)

Troubleshooting authentication issues

When deploying to Vercel, you MUST disable Vercel Authentication to allow Layercode webhooks to be received. By default for pro plans, Vercel blocks external requests to your application /api routes. This means that Layercode webhooks will not be received by your application, and your voice agent will not work. Disable Vercel Authentication by going to your project settings in the Vercel dashboard, then go to “Deployment Protection” in left sidebar menu, then turn off “Vercel Authentication” and Save. You do not need to redeploy. You can check your Webhook Logs in the Layercode dashboard to ensure that webhooks are being received successfully. If you receive a 405 error response to webhooks, this indicates that Vercel Authentication is still enabled. Note: if you’re on a free tier, you may not need to make this change. Vercel authentication