An AI-powered article generator that creates realistic-looking but entirely fabricated news articles on demand — a playful experiment inspired by the dead internet theory.
Built as a learning project to explore two things:
- Google's Gemini Flash models — the new generation of fast, lightweight models that can generate full articles in seconds, making on-demand content generation feel instant.
- Cloudflare Workers and the broader Cloudflare ecosystem — Workers, KV storage, Turnstile, Pages, and AI Gateway. The whole edge-first, serverless approach to building web apps.
The result is a site where any URL path becomes a fully generated article. Visit /the-rise-of-sentient-toasters and you'll get a convincing, styled article about sentient toasters — streamed to your browser in real time.
- A user visits a URL like
/some-article-title - If the article is cached in Cloudflare KV, it's served instantly via SSR
- If not, the user completes a Cloudflare Turnstile challenge
- The title is sent to Gemini 2.0 Flash Lite, which streams back a full markdown article
- The article is checked against OpenAI's moderation API for content safety
- The result is cached in KV and rendered with one of 5 random visual themes
- Streaming generation — articles appear progressively as the AI writes them
- Edge caching — cached articles are served instantly from Cloudflare KV
- Content moderation — OpenAI moderation prevents harmful content
- Multiple themes — 5 different article styles, randomly assigned
- Turnstile protection — prevents automated abuse without annoying CAPTCHAs
- Debug mode — append
?debugto see generation timing metrics
- Runtime: Cloudflare Workers
- AI Generation: Google Gemini 2.0 Flash Lite
- Moderation: OpenAI omni-moderation
- Storage: Cloudflare KV
- CAPTCHA: Cloudflare Turnstile
- Frontend: Vanilla JS + markdown-it
- Language: TypeScript
- Package Manager: pnpm
- Node.js with pnpm
- A Cloudflare account (with KV namespace and Turnstile site configured)
- Google AI Studio API key
- OpenAI API key
pnpm install
pnpm startThe dev server runs at http://localhost:8787.
Set these as secrets in your Cloudflare Workers environment:
GOOGLE_AI_STUDIO_TOKENGOOGLE_AI_GATEWAY_URLOPENAI_API_KEYTURNSTILE_SECRET_KEY
pnpm deployAll articles are AI-generated fiction. Any resemblance to real events or persons is coincidental.