Deploy to Cloudflare
Deployment Process
- Modify all page files (
page.tsx
) and API files (route.ts
) in theapp
directory
Add this line:
app/[locale]/(default)/new-page/page.tsx
export const runtime = "edge";
- Create a
.env.production
file in the project root directory
Terminal
cp .env.example .env.production
Update all configurations in the .env.production
file with production environment settings.
- Create a
wrangler.toml
file in the project root directory
Terminal
cp wrangler.toml.example wrangler.toml
Copy the production environment variables configured in .env.production
to the [vars] section in wrangler.toml
, and modify the project name in wrangler.toml
- Deploy to Cloudflare
Run the following command in the project root directory:
Terminal
npm run cf:deploy
Follow the prompts to enter the project name and branch name (main), connect to your Cloudflare account, and wait for the deployment to complete.
- Go to the Cloudflare console to see your successfully deployed project
- Access the project
You can access the project using the default generated domain. Bind a custom domain to officially launch.