Project overview

One API. Five Platforms. Automated Publishing

A lightweight Python service for publishing messages across multiple platforms through a single REST API.

Rest API Python API Integration FastAPI Docker
One API. Five Platforms. Automated Publishing preview
Project overview

Overview

A Dockerized FastAPI service that takes one short message and publishes it through five platform adapters. The client sends a single JSON field. The service checks the message, then talks to Dev.to, Mastodon, Bluesky, Telegram, and Discord on its own. A failure or missing key on one network does not cancel the others.

The problem

Announcing the same link means five different APIs, five credential setups, and five ways to fail. Dev.to expects an article. Mastodon expects a status. Bluesky expects an authenticated AT Protocol record. Telegram expects a bot message. Discord expects a webhook. Doing that inline in application code couples the product to every vendor and makes one outage block the whole announcement.

The solution

POST /posting accepts one message of at most 200 characters with exactly one http or https link. The service validates that contract first and returns 422 when it is wrong. A valid message is handed to five adapters behind one interface. The response lists each platform with status, posted URL when the network returns one, a public-access flag, timestamp, and error. Overall success is true when at least one platform accepts the post.

Key engineering decisions

  • One adapter per platform. Dev.to creates a published article through the Forem API. Mastodon posts a status. Bluesky opens a session, then writes an app.bsky.feed.post record. Telegram sends through a bot. Discord posts through a channel webhook.

  • Failures stay inside the adapter. A missing key returns Missing credentials for that platform only. An HTTP or API error is caught and reported. The remaining platforms still run.

  • Dry-run is the default. The API validates the message and returns the same result shape without calling third-party APIs, so the flow can be demoed and tested before live credentials exist.

  • Secrets stay in environment variables and are never part of the request. Turning on live posting is DRY_RUN=false plus the keys for the accounts you actually have.

  • The platform list is internal. Callers cannot pick a subset or inject credentials. Adding another network means a new adapter, not a new endpoint.

  • The service runs in Docker on Python 3.12, with Uvicorn, Pydantic validation, and httpx. Interactive docs are served at /docs.

Results

  • Five live adapters behind one endpoint: Dev.to, Mastodon, Bluesky, Telegram, and Discord.

  • Input rules enforced before any publish: length, exactly one URL, and a real scheme and host.

  • Seven automated tests covering health, the five-platform dry-run, rejected messages, and missing credentials when dry-run is off.

  • Local run is docker compose up --build. No local Python install is required.