GitHub RepositoryPython · Gemini API · FastAPI · SaaS ArchitectureGenerative AI Systems

SocialLogger: Multi-Platform SaaS Architecture & Gemini AI

An automated content scheduling and publishing platform leveraging Google Gemini AI for tone-adaptive copy generation, background queuing for multi-platform distribution (Twitter/X, LinkedIn, Instagram), and engagement analytics.

Architecture Summary: SocialLogger integrates Google Gemini models to automatically adapt a single core message into platform-optimized variants (concise punchy hooks for Twitter/X vs long-form narrative for LinkedIn), coordinating delivery through queued background worker tasks and real-time OAuth token refresh middleware.

1. Architectural Overview & Gemini Prompt Design

Cross-posting identical content across disparate social networks consistently yields low engagement due to divergent audience expectations. SocialLogger utilizes structured system prompts with few-shot examples to transform raw developer release notes into audience-appropriate formats:

  • LinkedIn Channel: Structures insights with executive summaries, technical takeaways, and career context.
  • Twitter/X Channel: Condenses core ideas into high-velocity 280-character threads with syntax-highlighted code screenshots.
  • Instagram Channel: Formats bulleted key takeaways with carousel captions and hashtag clusters.

2. Backend Queuing & Token Security

To prevent long-running generative AI calls from blocking client HTTP request threads, the backend employs a decoupled task architecture:

1. Client POST /publish → FastAPI validates JWT and writes payload to background queue.
2. Worker consumes job → calls Gemini API with structured response schemas.
3. Multi-platform dispatcher calls platform APIs using encrypted OAuth2 refresh tokens.
4. Webhook updates frontend with broadcast confirmation and analytics URLs.