Technology Stack

Backend
Framework:Python / Flask
Database:PostgreSQL (ThreadedConnectionPool)
AI Engine:Google Vertex AI (Gemini 1.5 Pro)
Scheduler:APScheduler (BackgroundScheduler)
Email:SMTP / smtplib async
Payment:PayPal REST API v2
TikTok APIs
Creator Auth:TikTok Login Kit (OAuth 2.0)
Business Auth:TikTok Business API
Video API:Direct Post API v2
Comment API:Comment Management v2
Ads API:TikTok for Business v1.3
Security
CSRF:Flask-WTF token protection
Rate Limiting:In-memory sliding window
Input Sanitization:bleach + custom validators
XSS Prevention:Content-Security-Policy headers
Token Storage:AES-encrypted in PostgreSQL
Frontend
CSS Framework:Bootstrap 5.3
Icons:Bootstrap Icons 1.11
Charts:Chart.js 4.x
Design:TikTok Brand Colors (#FE2C55, #25F4EE)
Resilience Architecture

The Vertex AI client automatically fails over from the primary region to a secondary region on errors. Database operations use a ThreadedConnectionPool with a SmartConnection wrapper that automatically returns connections to the pool. An emergency buffer (emergency_buffer.jsonl) captures write operations during database downtime and replays them via the recovery scheduler. Scheduled post jobs use PostgreSQL FOR UPDATE SKIP LOCKED to prevent race conditions in multi-worker deployments.