Moving Lunch Train off AWS onto Cloudflare
Why we consolidated Lunch Train onto Cloudflare Workers, R2, D1, Workers AI, and AI Gateway.
Lindholmen Lunch Train shows daily lunch menus around Lindholmen. Scrapers + AI turn restaurant sites into JSON; the SPA and MCP read it.
Why we moved
- Two platforms were too much. Runtime lived on AWS; LLM calls went to Google AI Studio. Separate accounts, keys, dashboards, and failure modes.
- Cloudflare covers a full-stack app in one place: Workers, Static Assets, R2, D1, cron, Email Sending, Workers AI, AI Gateway.
- Cost and model reliability nudged us too (AWS usage after Free Tier, flaky AI Studio responses), but the main win was leaving the split stack.
Before vs after
Before
Before
Clients
- Browser SPA on EC2
- AI assistants MCP
AWS
- EC2 + nginx SPA
- S3 Menu JSON
- Docker Lambdas Scraper · notifier · API
- API Gateway + DynamoDB Subscriptions
- SES Email
- EventBridge Schedules
- AI Studio / Gemini Separate LLM platform
Main flows
-
Menus
LambdaGeminiS3SPA
-
Notifier
S3GeminiSES
After
After
Clients
- Browser lunchtrain.se
- AI assistants /mcp*
Cloudflare
- Workers Assets SPA
- R2 Menus · no egress fees
- Workers + cron Scraper · API · notifier
- D1 Subscriptions
- Email Sending Notifications
- Workers AI Via AI Gateway
- AI Gateway Retries · usage insight
- MCP Worker Assistants
Main flows
-
Menus
WorkerAI GatewayWorkers AIR2SPA
-
Notifier
R2 + D1AI GatewayEmail Sending
-
MCP
AssistantsMCP WorkerR2
Workers AI + AI Gateway
- Scrapers and the notifier call models through AI Gateway into Workers AI (no Gemini keys in Lambdas).
- Gateway gives retries, routing, and usage visibility we did not have with AI Studio alone.
What we gained
- One platform: SPA, APIs, menus, scrapers, mail, AI.
- Simpler architecture: fewer services, one deploy story.
- AI usage insight: AI Gateway metrics and traces.
- Region Earth: Workers run at the edge by default.
- No R2 egress fees: menu JSON stays cheap to serve.