Cloudflare
Learn how to obtain and configure a Cloudflare API Token for operating remote databases, storage, and deployments
ShipSaaS is deployed on Cloudflare Workers. Tasks such as creating databases, executing migrations, creating R2 buckets, and deploying using the Wrangler CLI require permission verification via an API Token.
We recommend completing the Cloudflare API Token configuration in this document before configuring databases, storage, email, and deployments.
Setup
Register a Cloudflare Account
If you don't have a Cloudflare account yet, please head to the Cloudflare Website to sign up.
Create an API Token
Go to the Account API tokens page in Manage account, click Create Token, select Create Custom Token, and we recommend adding the following permissions at once:
- Entire Account > D1 > Edit: Create and operate databases (Required)
- Entire Account > Workers R2 Storage > Edit: Create storage buckets (Required)
- Entire Account > Workers AI > Read: Call models in Workers AI (Optional, skip if not using Workers AI)
- Entire Account > Workers Scripts > Edit: Deploy and configure production environment variables (Required)
- Entire Account > Email Sending > Edit: Send emails (Required, supported on paid plans; free plans can use Resend instead)
- All Domains > Workers Routes > Edit: Bind custom domain routes during deployment (Required)
After creation, copy the Account ID and the generated API Token value, and save them in your environment variables:
.env
CLOUDFLARE_ACCOUNT_ID=your-account-id
CLOUDFLARE_API_TOKEN=your-api-tokenIf you are setting up your environment, you can now return to the Environment Configuration document and continue. The rest of this document can be read later.
Environment Configuration - Set Environment Variables
Next Steps
Now that you have configured your Cloudflare API Token, you can proceed to configure the following features:
-
Database Configuration - Create and configure a Cloudflare D1 database
-
Authentication - Configure user authentication
-
Storage Configuration - Create and configure Cloudflare R2 storage
-
Deployment - Deploy to Cloudflare Workers