Edge Sharing & SEO Service (Cloudflare Workers)
A conversational / social-engagement platform
Overview
A Cloudflare Workers edge service that publishes and shares the conversation “interactions” produced by the platform. It stores each generated topic, the people involved, and an image, then serves them at clean, canonical, SEO-friendly URLs, with special handling for traffic arriving from LinkedIn.
Why It Exists
The engagement loop only works if a generated moment can be shared and viewed publicly. This service gives every interaction a durable, crawlable home on the edge, optimized for social distribution and view tracking.
What We Built
A TypeScript Worker (src/index.ts) exposing a small API: POST /api/interactions creates an interaction (topic, article body, people array, image) using nanoid ids and slugify-derived event/topic slugs, persisting metadata to Cloudflare D1 and image assets to an R2 bucket. A canonical GET /s/:event_slug/:topic_slug/:id route renders the shareable page, with isFromLinkedIn referrer/user-agent detection to tailor the response for LinkedIn visitors and a linkedin_views counter for engagement tracking. The D1 schema (schema.sql) defines the interactions table, and wrangler.toml binds the D1 database and R2 photo bucket for deployment.
Technologies & Approach
Cloudflare Workers for globally-distributed, low-latency edge execution; D1 (SQLite) for interaction metadata; R2 for image storage; and Wrangler for deployment. The design favors clean canonical URLs and referrer-aware rendering to maximize shareability and search visibility.
Outcome / Impact
Completed the platform’s share/publish loop: generated conversation moments become public, trackable, SEO-optimized pages served entirely from the edge, with LinkedIn-aware presentation to drive social engagement.
Capabilities Demonstrated
- Building a stateful edge API on Cloudflare Workers
- D1 (SQLite) and R2 object storage bindings for metadata and media
- SEO-friendly canonical slug-based URL design
- Referrer/user-agent-aware rendering and view tracking