Deploy to Cloudflare Workers
Shapeless can be deployed to Cloudflare Workers, giving you a globally distributed, serverless runtime for your API. This guide walks you through the deployment.
Prerequisites
Everything is mostly setup and no need to actually set up much
- Install the Wrangler CLI:
- Have a Cloudflare account: https://www.cloudflare.com/
Deployment Steps
1. Deploy via GitHub (recommended)
- Push your Shapeless project to GitHub.
- Set up a Cloudflare Pages project connected to your repo.
- Choose the OpenNext framework preset.
- Cloudflare Pages will build and deploy your app automatically on every push.
2. Deploy locally using provided scripts
You can also deploy manually using Shapeless’s helper scripts which handle OpenNext build and deployment:
These scripts wrap Wrangler but also run the Next.js build process required for OpenNext.
Update your client
After deployment, update your API client to point to your deployed Worker URL:
Environment Variables
Add environment variables to your Worker using Wrangler:
For bulk updates, see Wrangler secret bulk commands.
Common Issues
CORS Configuration
If you experience CORS problems, verify your Worker is configured with CORS middleware correctly: