Karakoram Technologies Logo
← Back to Case StudiesArchitecture Case Study

Decoupling the UI with Asynchronous Publishing Pipelines

The Business Problem

A social media automation tool is only as good as its reliability. In early prototypes, when a user clicked "Publish Now", the web server would open an HTTP connection to the LinkedIn or Facebook API. If LinkedIn was slow, the user's browser would freeze. If the network dropped, the post was lost forever. This synchronous design was fragile and unscalable.

The Requirements

  • 99.9% reliability for scheduled posts.
  • The UI must remain perfectly snappy, regardless of external API latency.
  • The system must automatically recover from temporary external API outages (e.g., rate limiting).

The Architecture & Implementation

We completely decoupled the web presentation layer from the external execution layer by introducing Hangfire—a robust, database-backed background job processor for .NET.

When a user interacts with the React frontend to schedule a post, the ASP.NET Core backend simply validates the request, saves the Draft to SQL Server, and returns a 202 Accepted response. The UI updates instantly. Behind the scenes, the backend enqueues a Hangfire job targeted for the exact timestamp.

The Technical Challenge

Social media APIs enforce strict rate limits (HTTP 429 Too Many Requests). If a user scheduled 50 posts to go out at the exact same minute, the API would reject the payload.

The Solution

We implemented Exponential Backoff Retry Policies within our Hangfire workers. If a worker received a 429 or a 503 error, it did not fail the job. Instead, the worker caught the exception and re-queued the job to try again in 1 minute. If it failed again, it waited 5 minutes, then 15. This allowed the system to smoothly "drain" the queue without getting our API keys blacklisted.

Lessons Learned

In distributed systems, you must assume external dependencies will fail. By moving external API integrations off the main web thread and into a persistent queue, we achieved massive horizontal scalability. The web server only handles fast database writes, while dedicated worker nodes handle the slow, unpredictable network calls.

Karakoram AI

Online

Hi! I am the Karakoram AI assistant. How can I help you today?