Frontend
AI Content Generation for Developer Marketing
Subhendu Das DEV Community
1 views
Problem
Indie developers and small teams often ship code but struggle to document it. Writing consistent blog posts or social copy requires time that many already lack. The result is missed visibility and a fragmented promotion strategy.
How It Works
Herald solves this by turning repository activity into publishable content automatically. When a commit lands that changes a readme, a new feature flag is added, or a release tag is pushed, a GitHub webhook triggers a FastAPI endpoint. The request payload is parsed and stored in PostgreSQL via SQLAlchemy. A Celery worker picks up the trigger record, calls an AI model (OpenAI GPT‑4) to draft a markdown article, and stores the draft.
The front‑end, built with React and Vite, presents a content calendar where developers can review drafts, edit them, and schedule publication. Tailwind CSS keeps the UI concise and responsive.
Drafting Pipeline
# tasks.py
from celery import shared_task
from openai import OpenAI
from app.models import Trigger, Draft
@shared_task
def generate_draft(trigger_id: int):
trigger = Trigger.get(trigger_id)
prompt = f"Write a 700‑word blog post about the change: {trigger.summary}."
response = OpenAI().chat.completions.create(
model="gpt-4",
messages=[{"role": "system", "content": "You are a senior dev‑blogger."},
{"role": "user", "content": prompt}],
temperature=0.7,
)
Draft.create(trigger_id=trigger_id, content=response.choices[0].message.content)
The worker writes the draft to the database; the React UI fetches it via a FastAPI endpoint:
# api.py
@router.get("/drafts/{draft_id}")
async def get_draft(draft_id: int, db: Session = Depends(get_db)):
return Draft.get(draft_id)
Publishing Pipeline
When a draft is approved and scheduled, Celery schedules a publish task. The task uses the dev.to API to create the article.
# publish.py
import requests
DEVTO_TOKEN = os.getenv("DEVTO_TOKEN")
@shared_task
def publish_to_devto(draft_id: int, scheduled_at: datetime):
draft = Draft.get(draft_id)
if datetime.utcnow() < scheduled_at:
# Reschedule until the time arrives
publish_to_devto.apply_async((draft_id, scheduled_at), eta=scheduled_at)
return
headers = {"api-key": DEVTO_TOKEN, "Content-Type": "application/json"}
data = {
"article": {
"title": draft.title,
"description": draft.summary,
"body_markdown": draft.content,
"published": True,
"tags": ["devops", "automation", "ai"],
}
}
resp = requests.post("https://dev.to/api/articles", json=data, headers=headers)
resp.raise_for_status()
# Store the dev.to URL for later metrics
draft.update(devto_url=resp.json()["url"])
-Berkeley the task is idempotent; if the API call fails, Celery retries up to 3 times.
Using the Feature
цию GitHub webhook** – Add the Herald endpoint to your repository’s webhook settings.
Approve drafts – In the dashboard, read the AI‑generated markdown, tweak if necessary.
Schedule – Pick a date/time; the calendar shows a 7‑day queue. The worker will publish automatically.
Track engagement – After publication, Herald polls the dev.to API every 12 hours to pull the read count and.patterns. The dashboard visualises engagement per post.
The process requires no manual copy‑pasting; the entire workflow runs in the background.
Technical Highlights
FastAPI handles async HTTP requests with low latency, enabling real‑time webhook handling.
SQLAlchemy models map triggers, drafts, and posts to PostgreSQL tables. A single transient table holds unprocessed triggers, removed by a sweep job.
Celery + Redis orchestrates background tasks. Workers limit concurrency to 4 to avoid hitting OpenAI or dev.to rate limits.
React + Vite + Tailwind CSS deliver a lightweight UI; the calendar uses react-big-calendar for drag‑and‑drop scheduling.
Continuous testing reaches 100 % coverage; a recent commit raised the floor to 99.9 % and introduced a hard limit on the project list query.
Performance Optimizations
Recent changes addressed bottlenecks:
The transient table now reads in full via a single query, eliminating the unbounded loop that previously inflated latency.
The all my triggers endpoint was refactored to paginate results, reducing the 20‑fold memory spike.
A hard limit on project queries prevents accidental overload.
Unit tests no longer pay bcrypt 2,300 times; a mock replaces the password hash during testing.
These adjustments keep the system responsive even when a repository receives dozens of commits per day.
Summary
Herald’s AI‑powered drafting and publishing engine eliminates the friction between code commits and marketing content. By leveraging FastAPI, Celery, and the dev.to API, developers can ship code and let the platform turn each change into a polished, scheduled blog post or social snippet. The result is continuous, automated developer marketing without a dedicated marketing team.
Read original: https://dev.to/sumaninster/ai-content-generation-for-developer-marketing-38mp
← Previous
How to Build a Self-Healing CI/CD Pipeline with AI Agents (2026 Guide)
Next →
Spent way too many weekends wiring up auth, RLS, queues, and file uploads for every new side project so I finally built a starter that does it once, properly. Modular, type-safe, and designed to work with AI coding tools instead of confusing them.
Related
Automating the Indian CA Compliance Calendar
Frontend
1
DEV Community
Automating the Indian CA Compliance Calendar: GST, TDS, ROC and ITR
Frontend
0
DEV Community
409A Valuation for Founders: Safe Harbor, Fair Market Value and the Strike Price — 409A Valuation Guide (Part 1)
Frontend
1
DEV Community
Built a User-Agent Parser for Kotlin Multiplatform
Frontend
4
Dev.to (EN Zone)
Comments0
No comments yet — be the first