Initial Setup Guide - Cloudflare Workers¶
Note: This guide is for first-time setup of Cloudflare Workers. For current deployment workflows, see Cloudflare.
Prerequisites¶
- Cloudflare account with Workers access
nutrieapp.comdomain added to Cloudflare- Wrangler CLI installed (
npm install -g wrangler) - OpenAI API key
Step 1: Set Up KV Namespaces¶
Create required KV namespaces for rate limiting and subscriptions.
Via Cloudflare Dashboard¶
- Go to https://dash.cloudflare.com
- Select your account -> Workers & Pages -> KV
- Create namespaces:
RATE_LIMIT,SUBSCRIPTIONS
Via CLI¶
cd cloudflare-worker
wrangler kv:namespace create "RATE_LIMIT"
wrangler kv:namespace create "SUBSCRIPTIONS"
Update wrangler.toml with the namespace IDs.
Step 2: Configure Secrets¶
Step 3: Deploy Workers¶
See Cloudflare for deployment instructions.
Step 4: Configure App Store Connect¶
See Subscriptions for webhook URL configuration.