The Guesswork Problem
Most content marketing operates on hunches. "I think this keyword will perform." "This topic feels right." Without data linking content to outcomes, teams burn budget on posts that never drive traffic, conversions, or revenue.
AIKit changes this. Because every blog post lives in Cloudflare D1 — a SQL database, not a static file — you can query content performance with SQL and feed that data back into your generation pipeline.
The Closed-Loop Architecture
```
D1 (posts table) → Analytics → Query top topics → Generate similar content → D1
```
Every post has slug, published_at, title, excerpt, and content. By joining with analytics data (Cloudflare Web Analytics or Zaraz), you can:
```sql
-- Find your top-performing content topics
SELECT p.slug, p.title, p.category, COUNT(*) as views
FROM ec_posts p
JOIN web_analytics w ON w.page_path LIKE '%' || p.slug || '%'
WHERE p.status = 'published'
AND p.published_at > date('now', '-30 days')
GROUP BY p.slug
ORDER BY views DESC
LIMIT 10;
```
This query tells you exactly which categories, formats, and angles drive traffic. Feed those signals into your LLM prompt for the next batch of posts.
Marketing Automation Meets Data Science
The CMO pipeline I built on top of AIKit uses this exact pattern:
1. **Query D1** for top categories by post count and recency
2. **Apply theme rotation** — Content/Growth, Marketing Automation, Sales Channel, Hybrid Dev+Marketing
3. **Select project focus** — AIKit, CCFish, AiSalonHub, PlayableAd Studio, DeFiKit — based on hour modulo
4. **Generate** 800-1500 word posts with LLM
5. **Validate** JSON structure before writing to queue
6. **Publish** via wrangler D1 execute → live in seconds
D1 Queries for Content Intelligence
Here are the most useful D1 queries for content marketers:
```sql
-- Category distribution
SELECT category, COUNT(*) as post_count
FROM ec_posts WHERE status = 'published'
GROUP BY category ORDER BY post_count DESC;
-- Recency-weighted topic heatmap
SELECT slug, title, published_at
FROM ec_posts WHERE status = 'published'
ORDER BY published_at DESC LIMIT 20;
-- Content gaps (categories with few posts)
SELECT category, COUNT(*) as cnt
FROM ec_posts WHERE status = 'published'
GROUP BY category HAVING cnt < 5;
```
Results: From 0 to 184 Posts
Running this pipeline since April 2026:
- **184 published posts** across 12+ categories
- **5 active projects** in rotation — AIKit, CCFish, AiSalonHub, PlayableAd Studio, DeFiKit
- **Zero manual publishing** — every post goes through the automated queue
- **Auto-generated sitemap** — `/sitemap.xml` and `/llms.txt` update dynamically
What's Next
The next evolution is connecting Cloudflare Analytics API directly into the pipeline — so the theme rotation adjusts based on real-time traffic data. When a category spikes, the pipeline auto-prioritizes it. When a topic flatlines, it drops from rotation.
That's the difference between a blog and a data-driven content engine.