organization | Agency tenant | id (UUID), name, domain, settings (JSON) |
users | Agency team members | id (UUID), org_id (FK), email, role, password_hash |
subscription | Stripe billing | id (UUID), org_id (FK), stripe_subscription_id, plan_tier, clients_limit, posts_limit |
client | Managed client/brand | id (UUID), org_id (FK), brand_name, industry, description, logo_url, settings (JSON) |
platform_account | Connected social account | id (UUID), client_id (FK), platform, account_handle, access_token_enc, status |
campaign | Marketing campaign | id (UUID), client_id (FK), org_id (FK), name, objective, start_date, end_date, status, budget (JSON) |
content | Content piece (post) | id (UUID), campaign_id (FK), client_id (FK), org_id (FK), body, media_urls (JSON), hashtags (JSON), platform, status, scheduled_at |
content_schedule | Publishing schedule entry | id (UUID), content_id (FK), platform_account_id (FK), scheduled_at, published_at, external_post_id, status |
approval | Approval workflow entry | id (UUID), content_id (FK), reviewer_id (FK), status, feedback, decided_at |
asset | Media library item | id (UUID), org_id (FK), client_id (FK), filename, s3_key, mime_type, size_bytes, tags (JSON) |
analytics_snapshot | Performance metrics | id (UUID), platform_account_id (FK), content_id (FK), date, impressions, reach, engagement, clicks, followers_delta (JSON) |
client_report | Generated client report | id (UUID), client_id (FK), period_start, period_end, metrics_summary (JSON), ai_insights, report_url |