如何在 DoAide Pulse 建立內容日曆
Building a Content Calendar in DoAide Pulse
DoAide Pulse 將內容日曆整合為 AI 驅動工作流程,串連內容草稿生成、排程及向 Dev.to 發佈。系統結合 FastAPI、Celery、Redis 和 React,並透過 OpenAI API 生成草稿;用戶可在互動日曆中拖放內容卡片以調整排程。另設分析儀錶板,展示訂閲者增長及互動數據。
Calendar Idea Planning
Problem
Side‑project developers often publish blog posts and social updates on a whim. Without a structured schedule, content gets missed, deadlines slip, and the marketing cadence feels ad‑hoc. The result is an inconsistent presence on channels like Dev.to and Bluesky, which hurts discoverability. This is where content calendar pays off in practice.
How It Works
DoAide Pulse solves this by turning the idea‑to‑publish pipeline into a single, AI‑driven workflow. The feature is split into three layers:
- FastAPI API – exposes CRUD endpoints for calendar entries.
- Celery Workers – generate drafts, run quality gates, and push to the Dev.to API on a schedule.
- React UI – presents an interactive calendar that lets users drag‑and‑drop ideas and preview AI‑generated content.
When a developer creates a new entry, they provide a headline, tags, and an optional focus keyword. The backend calls an AI model (via OpenAI’s API) to draft the post body, social copy, and meta tags. The draft is stored in PostgreSQL, then queued in Redis for a Celery task that will publish it at the scheduled time. Getting content calendar right early saves rework later.
Implementation Details
FastAPI Endpoint
@router.post("/calendar/", response_model=CalendarEntry)
async def create_entry(entry: CalendarCreate, db: Session = Depends(get_db)):
db_entry = CalendarEntry(**entry.dict())
db.add(db_entry)
db.commit()
db.refresh(db_entry)
# Queue AI generation
task = generate_content.delay(db_entry.id)
db_entry.task_id = task.id
db.commit()
return db_entry
The endpoint validates that the headline is non‑empty and that the URL is HTTP/HTTPS, mirroring the recent fix: a blank template name or idea headline is refused commit.
Celery Task
@celery.task
def generate_content(entry_id):
entry = db.query(CalendarEntry).get(entry_id)
prompt = f"Write a 600‑word blog post about {entry.headline} with focus keyword {entry.focus_keyword}."
draft = openai.Completion.create(engine="gpt-4", prompt=prompt, max_tokens=800)
entry.draft = draft.choices[0].text
db.commit()
# Schedule publish
publish_task.apply_async((entry.id,), eta=entry.scheduled_at)
The task uses the openai Python client, stores the draft, and schedules a separate publish_task that will hit the Dev.to API.
Publish Task
@celery.task
def publish_task(entry_id):
entry = db.query(CalendarEntry).get(entry_id)
response = devto_api.publish(entry.draft, entry.tags)
entry.published_at = datetime.utcnow()
entry.devto_url = response.url
db.commit()
The devto_api wrapper encapsulates the official Dev.to API endpoints, handling authentication and rate limiting. Good content calendar keeps the rest of the workflow predictable.
React Calendar UI
The UI is built with Vite, React, and Tailwind CSS. The calendar component uses the react‑datepicker library to render a month view. Each cell can contain a stack of cards representing scheduled posts.
<Calendar>
{entries.map(entry => (
<Day key={entry.id} date={entry.scheduled_at}>
<Card title={entry.headline} status={entry.status} />
</Day>
))}
</Calendar>
Drag‑and‑drop is implemented with react‑dnd. When a card is moved, a PATCH request updates the scheduled_at field in the FastAPI backend. Treat content calendar as a habit rather than a one-off task.
Example Workflow
- Create an Idea – The developer opens the calendar UI, clicks Add Post, and fills in the headline and tags.
- AI Draft – The backend immediately queues a Celery task. Within seconds, a draft appears in the card preview.
- Adjust Schedule – The user drags the card to a desired date. The backend updates the schedule.
-
Publish – At the scheduled time, the
publish_taskposts the content to Dev.to and records the URL. -
Analytics – A separate dashboard shows subscriber growth and engagement, tied to the
subscriber growth analyticscommit.
The process eliminates the need for manual drafting, scheduling, and publishing, giving indie developers a reliable marketing cadence.
Conclusion
The Calendar Idea Planning feature turns a chaotic, manual workflow into a predictable, AI‑augmented pipeline. By combining FastAPI, Celery, Redis, and React, DoAide Pulse provides a developer‑friendly marketing automation stack that keeps side projects visible on the channels that matter.
All code snippets are illustrative and reflect the architecture described in the recent GitHub commits.
Related reading
來源:DEV Community · dev.to