Everything runs on Cloudflare's Free Plan — no credit card required, no Docker, no domain purchase required.
- Sign up at dash.cloudflare.com/sign-up and verify your email.
- Copy your Account ID (from Workers & Pages right sidebar).
- In the Cloudflare Dashboard, go to Storage & Databases → D1 SQL Database → Create.
- Name it
socratic-dband click Create. - Copy the Database ID (you'll add it as a GitHub Secret in Step 3 —
wrangler.jsoncintentionally keeps"database_id": "REPLACE_WITH_YOUR_D1_DATABASE_ID"in git and injects the real ID during CI deploy). - (Recommended, 10 GB Free Tier) Go to Storage & Databases → R2 Object Storage → Create bucket, name it
socratic-uploads(for scanned page photos and cached TTS audio), and click Create.
- Go to My Profile → API Tokens → Create Token.
- Use the Edit Cloudflare Workers template and also add Account → D1: Edit (and Account → Workers R2 Storage: Edit if binding R2).
- In GitHub →
fmalhe/socratic→ Settings → Secrets and variables → Actions → Secrets, add:CLOUDFLARE_API_TOKENCLOUDFLARE_ACCOUNT_IDD1_DATABASE_ID(from Step 2)R2_BUCKET_NAME(optional Secret or Actions Variable, e.g.socratic-uploads— binds theUPLOADSR2 bucket at deploy time)
- (Optional) Add Actions Variable
CLOUDFLARE_DEPLOY_ENABLED=trueto auto-deploy on every push tomain.
- Run GitHub → Actions → Deploy to Cloudflare → Run workflow (applies
migrations/0001_init.sqlthroughmigrations/0006_kid_ux_reading_passage.sqlto D1 and deployshttps://socratic.<your-subdomain>.workers.dev). - In Cloudflare Dashboard → Workers & Pages →
socratic→ Settings → Variables and Secrets, add:GEMINI_API_KEY(free tier key from aistudio.google.com/apikey — powers bothgemini-4-hydrogenOCR/Socratic tutoring and primary Gemini 3.8 TTSgemini-3.8-flash-lite-tts→gemini-3.8-flash-tts→gemini-2.5-flash-preview-ttswith/api/audio/streamSSE-to-PCM streaming and R2 WAV caching)ALLOWED_IPS= your home public IP from ifconfig.me (locks the app strictly to your home network, even on free*.workers.dev!)- (Optional)
GOOGLE_TTS_API_KEYas a fallback Cloud TTS provider (Google Cloud TTS Wavenet MP3, stored in an isolated fallback R2 namespace) when Gemini 3.8 TTS is temporarily unavailable or rate-limited, before falling back to devicespeechSynthesis.
Tip: If you later connect a custom domain, you can also add Cloudflare Access (Free) with Policy 1 =
Bypassfor your Home IP and Policy 2 =Allowfor your parent email (OTP fallback when your ISP rotates your IP).
Open https://socratic.<your-subdomain>.workers.dev in Safari on your iPad (on home Wi-Fi) and tap Share → Add to Home Screen.