LogoTanStarter Docs
LogoTanStarter Docs
HomepageIntroductionCodebaseGetting StartedEnvironments
Configuration
Deployment

Integrations

CloudflareDatabaseAuthenticationEmailNewsletterStoragePaymentNotificationsAnalyticsChatboxAffiliates

Customization

MetadataPagesLanding PageBlogComponentsUser ManagementAPI Key Management

Codebase

Project StructureFormatting & LintingEditor SetupUpdating the Codebase
X (Twitter)

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:

.env
CLOUDFLARE_ACCOUNT_ID=your-account-id

Create 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:

.env
CLOUDFLARE_API_TOKEN=your-api-token

API Token

Next Steps

Now that you have configured the Cloudflare API Token, you can continue with the following:

Database

Create and configure Cloudflare D1 database

Authentication

Configure user authentication

Storage

Create and configure Cloudflare R2 storage

Deployment

Deploy to Cloudflare Workers

Table of Contents

Setup
Sign Up for Cloudflare
Get Account ID
Create API Token
Next Steps