Cloudflare
Learn how to obtain and configure Cloudflare API Token for remote database, storage, and deployment operations
TanStarter is deployed on Cloudflare Workers. Both Wrangler CLI and Drizzle Kit require an API Token for authentication when operating on remote resources (creating databases, running migrations, creating R2 buckets, deploying, etc.).
It is recommended to complete the API Token configuration in this guide before setting up database, storage, and deployment.
Setup
Sign Up for Cloudflare
If you don't have a Cloudflare account yet, sign up at Cloudflare first.
Get Account ID
Log in to the Cloudflare Dashboard, click the menu next to your account name, and select Copy Account ID. Save it to your environment variables file:
CLOUDFLARE_ACCOUNT_ID=your-account-idCreate API Token
Go to the API Tokens page, click Create Token, select Create Custom Token, and it's recommended to add the following permissions at once:
- Account > D1 > Edit: Create and operate databases (required)
- Account > Workers R2 Storage > Edit: Create storage buckets (required)
- Account > Workers Scripts > Edit: Deployment and production environment variable configuration (required)
- Zone > Workers Routes > Edit: Bind custom domain routes during deployment (required)
Copy the generated token after creation and save it to your environment variables:
CLOUDFLARE_API_TOKEN=your-api-token
Next Steps
Now that you have configured the Cloudflare API Token, you can continue with the following:
TanStarter Docs