Herman Stander
Core team developer and marketing
2025-04-10
When building applications with RedwoodSDK, you'll often need to maintain separate environments for development, staging, and production. Cloudflare makes this process incredibly simple with their environment-based configuration system. In this guide, we'll walk through how to set up and manage different environments for your RedwoodSDK application.
The key to managing different environments lies in your wrangler.jsonc
configuration file. Here's how you can set up staging and production environments:
{
"env": {
"staging": {
"vars": {
"APP_NAME": "redwoodsdk-staging"
}
},
"production": {
"vars": {
"APP_NAME": "redwoodsdk-production"
},
"routes": [
{
"pattern": "rwsdk.com",
"custom_domain": true
},
{
"pattern": "www.rwsdk.com",
"custom_domain": true
}
]
}
}
}
This configuration:
Deploying to different environments is as simple as setting an environment variable before running the release command:
pnpm release
CLOUDFLARE_ENV=staging pnpm release
That's it! The same command works for both environments, with the environment variable determining where your application gets deployed.
If you haven't set up custom domains:
Managing multiple environments with RedwoodSDK and Cloudflare is straightforward and requires minimal configuration. The environment-based deployment system makes it easy to maintain separate instances of your application while keeping the deployment process simple and consistent.
Remember:
pnpm release
for productionCLOUDFLARE_ENV=staging pnpm release
for stagingwrangler.jsonc
with environment-specific settingsHappy deploying! 🚀