# uroojfatima-052/flyrank-capstone-social-studio architecture

> Architecture diagram of the GitHub repository uroojfatima-052/flyrank-capstone-social-studio, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/uroojfatima-052/flyrank-capstone-social-studio
- Repository: https://github.com/uroojfatima-052/flyrank-capstone-social-studio

## Overview

Social Media Studio turns submitted blog content into reviewed, platform-specific campaign variants, schedules approved variants, and publishes them with attempt tracking and history. The principal flow runs from HTTP endpoints through domain services to persistent records; a background scheduler dispatches due slots to the publishing service and configured platform adapters. AI generation has a template fallback, and validation enforces platform and brand constraints. Some service wiring is described in the README but not sampled, so uncertain internal calls are omitted.

Main entry points: [`app/main.py`](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/main.py) (FastAPI App), [`app/database.py`](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/database.py) (Application Database), [`app/services/ai_generator.py`](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/services/ai_generator.py) (AI Generator), [`app/services/publisher.py`](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/services/publisher.py) (Publish Service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_main["FastAPI App<br/>[main.py]"]
  node_posts_router["Posts API<br/>[posts.py]"]
  node_campaign_router["Campaign API<br/>[campaigns.py]"]
  node_variants_router["Variants API<br/>[variants.py]"]
  node_schedule_router["Schedule API<br/>[schedule.py]"]
  node_history_router["History API<br/>[history.py]"]
end

subgraph group_content["Content And Review"]
  node_fetcher["Content Fetcher<br/>[fetcher.py]"]
  node_posts_service["Post Service<br/>[posts.py]"]
  node_campaign_service["Campaign Service<br/>[campaigns.py]"]
  node_variant_service["Variant Service<br/>[variants.py]"]
  node_generator["Variant Generator<br/>[generator.py]"]
  node_ai_generator["AI Generator<br/>[ai_generator.py]"]
  node_validator["Content Validator<br/>[validator.py]"]
  node_profiles["Platform Profiles<br/>[profiles.py]"]
end

subgraph group_delivery["Scheduling And Publishing"]
  node_schedule_service["Schedule Service<br/>[schedule.py]"]
  node_runner["Scheduler Runner<br/>[runner.py]"]
  node_worker["Publish Worker<br/>[worker.py]"]
  node_publisher["Publish Service<br/>[publisher.py]"]
  node_history_service["History Service<br/>[history.py]"]
end

subgraph group_integrations["External Integrations"]
  node_registry["Adapter Registry<br/>[registry.py]"]
  node_adapter_base["Publisher Interface<br/>[base.py]"]
  node_discord_adapter["Discord Adapter<br/>[discord.py]"]
  node_mock_adapter["Mock Adapters<br/>[mock.py]"]
end

subgraph group_state["Persistent State"]
  node_database[("Application Database<br/>[database.py]")]
  node_models["Domain Records<br/>[models.py]"]
end

node_user(("User"))
node_gemini{{"Gemini API"}}
node_discord{{"Discord"}}

node_user -->|"sends requests"| node_main
node_main -->|"routes requests"| node_posts_router
node_main -->|"routes requests"| node_campaign_router
node_main -->|"routes requests"| node_variants_router
node_main -->|"routes requests"| node_schedule_router
node_main -->|"routes requests"| node_history_router
node_posts_router -->|"invokes"| node_posts_service
node_posts_service -->|"fetches URLs"| node_fetcher
node_campaign_router -->|"invokes"| node_campaign_service
node_campaign_service -->|"generates variants"| node_ai_generator
node_ai_generator -.->|"falls back to"| node_generator
node_ai_generator -.->|"requests generation"| node_gemini
node_ai_generator -->|"validates output"| node_validator
node_generator -->|"validates output"| node_validator
node_validator -->|"reads constraints"| node_profiles
node_variants_router -->|"invokes"| node_variant_service
node_schedule_router -->|"invokes"| node_schedule_service
node_history_router -->|"invokes"| node_history_service
node_main -->|"starts and stops"| node_runner
node_runner -->|"schedules job"| node_worker
node_worker -->|"publishes due slots"| node_publisher
node_publisher -->|"selects adapter"| node_registry
node_registry -->|"resolves adapter"| node_discord_adapter
node_registry -->|"resolves adapter"| node_mock_adapter
node_publisher -->|"uses interface"| node_adapter_base
node_discord_adapter -.->|"posts webhook"| node_discord
node_posts_service -->|"persists posts"| node_database
node_campaign_service -->|"persists campaigns"| node_database
node_variant_service -->|"persists variants"| node_database
node_schedule_service -->|"persists slots"| node_database
node_worker -->|"reads due slots"| node_database
node_publisher -->|"records attempts"| node_database
node_history_service -->|"reads history"| node_database
node_database -->|"stores records"| node_models

click node_main "https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/main.py"
click node_posts_router "https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/routers/posts.py"
click node_campaign_router "https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/routers/campaigns.py"
click node_variants_router "https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/routers/variants.py"
click node_schedule_router "https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/routers/schedule.py"
click node_history_router "https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/routers/history.py"
click node_fetcher "https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/services/fetcher.py"
click node_posts_service "https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/services/posts.py"
click node_campaign_service "https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/services/campaigns.py"
click node_variant_service "https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/services/variants.py"
click node_generator "https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/services/generator.py"
click node_ai_generator "https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/services/ai_generator.py"
click node_validator "https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/services/validator.py"
click node_profiles "https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/profiles.py"
click node_schedule_service "https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/services/schedule.py"
click node_runner "https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/scheduler/runner.py"
click node_worker "https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/scheduler/worker.py"
click node_publisher "https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/services/publisher.py"
click node_history_service "https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/services/history.py"
click node_registry "https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/adapters/registry.py"
click node_adapter_base "https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/adapters/base.py"
click node_discord_adapter "https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/adapters/discord.py"
click node_mock_adapter "https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/adapters/mock.py"
click node_database "https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/database.py"
click node_models "https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/models.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_posts_router,node_campaign_router,node_variants_router,node_schedule_router,node_history_router,node_user toneBlue
class node_fetcher,node_posts_service,node_campaign_service,node_variant_service,node_generator,node_ai_generator,node_validator,node_profiles toneAmber
class node_schedule_service,node_runner,node_worker,node_publisher,node_history_service,node_gemini toneMint
class node_registry,node_adapter_base,node_discord_adapter,node_mock_adapter toneRose
class node_database,node_models,node_discord toneIndigo
```

## Components

### HTTP API

- [FastAPI App](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/main.py): `app/main.py`
- [Posts API](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/routers/posts.py): `app/routers/posts.py`
- [Campaign API](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/routers/campaigns.py): `app/routers/campaigns.py`
- [Variants API](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/routers/variants.py): `app/routers/variants.py`
- [Schedule API](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/routers/schedule.py): `app/routers/schedule.py`
- [History API](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/routers/history.py): `app/routers/history.py`

### Content And Review

- [Content Fetcher](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/services/fetcher.py): `app/services/fetcher.py`
- [Post Service](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/services/posts.py): `app/services/posts.py`
- [Campaign Service](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/services/campaigns.py): `app/services/campaigns.py`
- [Variant Service](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/services/variants.py): `app/services/variants.py`
- [Variant Generator](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/services/generator.py): `app/services/generator.py`
- [AI Generator](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/services/ai_generator.py): `app/services/ai_generator.py`
- [Content Validator](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/services/validator.py): `app/services/validator.py`
- [Platform Profiles](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/profiles.py): `app/profiles.py`

### Scheduling And Publishing

- [Schedule Service](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/services/schedule.py): `app/services/schedule.py`
- [Scheduler Runner](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/scheduler/runner.py): `app/scheduler/runner.py`
- [Publish Worker](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/scheduler/worker.py): `app/scheduler/worker.py`
- [Publish Service](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/services/publisher.py): `app/services/publisher.py`
- [History Service](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/services/history.py): `app/services/history.py`

### External Integrations

- [Adapter Registry](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/adapters/registry.py): `app/adapters/registry.py`
- [Publisher Interface](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/adapters/base.py): `app/adapters/base.py`
- [Discord Adapter](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/adapters/discord.py): `app/adapters/discord.py`
- [Mock Adapters](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/adapters/mock.py): `app/adapters/mock.py`

### Persistent State

- [Application Database](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/database.py): `app/database.py`
- [Domain Records](https://github.com/uroojfatima-052/flyrank-capstone-social-studio/blob/main/app/models.py): `app/models.py`

### Other components

- **User**
- **Gemini API**
- **Discord**

## Connections

- User → FastAPI App: sends requests
- FastAPI App → Posts API: routes requests
- FastAPI App → Campaign API: routes requests
- FastAPI App → Variants API: routes requests
- FastAPI App → Schedule API: routes requests
- FastAPI App → History API: routes requests
- Posts API → Post Service: invokes
- Post Service → Content Fetcher: fetches URLs
- Campaign API → Campaign Service: invokes
- Campaign Service → AI Generator: generates variants
- AI Generator → Variant Generator: falls back to
- AI Generator → Gemini API: requests generation
- AI Generator → Content Validator: validates output
- Variant Generator → Content Validator: validates output
- Content Validator → Platform Profiles: reads constraints
- Variants API → Variant Service: invokes
- Schedule API → Schedule Service: invokes
- History API → History Service: invokes
- FastAPI App → Scheduler Runner: starts and stops
- Scheduler Runner → Publish Worker: schedules job
- Publish Worker → Publish Service: publishes due slots
- Publish Service → Adapter Registry: selects adapter
- Adapter Registry → Discord Adapter: resolves adapter
- Adapter Registry → Mock Adapters: resolves adapter
- Publish Service → Publisher Interface: uses interface
- Discord Adapter → Discord: posts webhook
- Post Service → Application Database: persists posts
- Campaign Service → Application Database: persists campaigns
- Variant Service → Application Database: persists variants
- Schedule Service → Application Database: persists slots
- Publish Worker → Application Database: reads due slots
- Publish Service → Application Database: records attempts
- History Service → Application Database: reads history
- Application Database → Domain Records: stores records
