Welcome to the Restate TypeScript + Cloudflare Workers template! ✨
- 📦 Node.js 20+ installed
- 🔧 npm or yarn package manager
- 🌐 Cloudflare account (for deployment)
Install dependencies:
npm installLaunch the local Restate server:
npx @restatedev/restate-serverStart the Cloudflare Workers development server:
npm run devConnect your local service to Restate:
npx @restatedev/restate dep add http://localhost:9080 --use-http1.1💡 Note: The
--use-http1.1flag is required only when running locally.
Iterate! 🔧
This template includes a GitHub Actions workflow setup for automated deployment.
Create your Cloudflare Worker project. You can do so by running:
npx wrangler deployAdd the following to Github Actions repository secrets:
CLOUDFLARE_ACCOUNT_ID: Your Cloudflare Account. To get your account id, check https://developers.cloudflare.com/workers/ci-cd/external-cicd/github-actions/#cloudflare-account-idCLOUDFLARE_API_TOKEN: Your Cloudflare API token. To get a token, check https://developers.cloudflare.com/workers/ci-cd/external-cicd/github-actions/. You can use the "Edit Cloudflare Workers" template for creating a token.RESTATE_ADMIN_URL: The Admin URL. You can find it in Developers > Admin URLRESTATE_AUTH_TOKEN: Your Restate Cloud auth token. To get one, go to Developers > API Keys > Create API Key, and make sure to select Admin for role
Once the repo is set up, just push to the main branch and you'll get your services updated.
Check the workflow deploy.yml for more details.
For more info on how to deploy manually, check:
- For cloud: https://docs.restate.dev/cloud/connecting-services
- For on-prem Restate deployments: https://docs.restate.dev/services/deploy/cloudflare-workers
- 🔐 Secure your endpoint as shown in your Restate Cloud Dashboard > Developers > Security
- 📖 Explore the Restate documentation
- 🔍 Check out more examples and tutorials
- 💬 Join the Restate Discord community
Happy building! 🎉