title: AI Marketing Automation
emoji: π€
colorFrom: blue
colorTo: purple
sdk: docker
sdk_version: latest
app_port: 7860
pinned: false
license: mit
π€ Autonomous AI Marketing Agency
Multi-tenant AI-powered marketing automation platform with intelligent content generation, video creation, and WhatsApp approval workflows.
β¨ Features
π¨ AI Content Generation
- Multi-platform content creation using Claude and GPT-4
- Platform-specific optimization (LinkedIn, X/Twitter, Instagram, Facebook)
- Quality-based refinement loop with AI critic agent
- DALL-E 3 image generation with multiple aspect ratios
- Voice-to-text with OpenAI Whisper
π₯ Video Generation
- Automated video creation with Google Veo
- Text-to-speech integration
- Cinematic prompt generation
- Multiple style and mood options
- Video library management
π¬ WhatsApp Approval Workflow
- Human-in-the-loop content approval via WhatsApp
- Command-based interface (YES/NO/EDIT)
- 24-hour approval timeout with reminders
- Multi-platform publishing after approval
- Complete audit trail
π Self-Learning Analytics
- Real-time engagement tracking across all platforms
- AI-powered pattern recognition
- Statistical trend analysis
- Automatic prompt enhancement based on performance
- Insights dashboard with interactive charts
π³ SaaS Multi-Tenancy
- Stripe-powered subscription management
- Tiered pricing (Basic, Pro, Agency)
- Usage tracking and limit enforcement
- Row-level security for data isolation
- Admin dashboard for user management
π Security & Authentication
- Better Auth - Self-hosted authentication system
- Email/password authentication with strong password requirements
- OAuth social login (Google, GitHub)
- Password reset and email verification
- Session management with JWT tokens
- Admin role management
- AES-256 encryption for API tokens
- Rate limiting on all endpoints
- CSRF protection with state parameters
ποΈ Architecture
Technology Stack
Frontend
- Next.js 14 (App Router)
- TypeScript
- Tailwind CSS
- React Query
- Recharts
Backend
- FastAPI (Python 3.11+)
- SQLAlchemy (async)
- Alembic (migrations)
- Celery (background jobs)
- APScheduler (scheduled tasks)
AI & ML
- OpenAI GPT-4 & DALL-E 3
- Anthropic Claude
- Google Veo (video generation)
- Google Cloud TTS
Infrastructure
- PostgreSQL (Neon/Supabase)
- Redis (caching & sessions)
- Docker & Docker Compose
- HuggingFace Spaces (deployment)
Phase Architecture
The platform is organized into 6 independent phases:
- Phase 1: Core Infrastructure - Authentication, user management, OAuth
- Phase 2: AI Content Engine - Multi-agent content generation
- Phase 3: WhatsApp Approval - Human-in-the-loop workflow
- Phase 4: Learning Loop - Analytics and self-improvement
- Phase 5: Video Engine - Automated video generation
- Phase 6: SaaS Core - Multi-tenancy and subscriptions
π Quick Start
Prerequisites
- Docker & Docker Compose (recommended) OR
- Python 3.11+ and Node.js 18+ for local development
- PostgreSQL Database (Neon or Supabase recommended)
- Redis (Upstash recommended)
Option 1: Docker Deployment (Recommended)
# 1. Clone repository
git clone <repository-url>
cd autonomous-ai-marketing-agency
# 2. Configure environment
cp .env.example .env
# Edit .env with your API keys and database URLs
# 3. Start all services
docker-compose up -d
# 4. Run database migrations
docker-compose exec backend alembic upgrade head
# 5. Access application
# Frontend: http://localhost:3000
# Backend API: http://localhost:8000
# API Docs: http://localhost:8000/docs
Option 2: Local Development
# 1. Clone repository
git clone <repository-url>
cd autonomous-ai-marketing-agency
# 2. Configure environment
cp .env.example .env
# Edit .env with your configuration
# 3. Install backend dependencies
cd phase-1-core-infra/backend
pip install -r requirements.txt
# 4. Run migrations
alembic upgrade head
# 5. Start backend (Terminal 1)
uvicorn src.main:app --reload --host 0.0.0.0 --port 8000
# 6. Install frontend dependencies (Terminal 2)
cd ../frontend
npm install
# 7. Start frontend
npm run dev
# 8. Access application
# Frontend: http://localhost:3000
# Backend API: http://localhost:8000
Required Environment Variables
Minimum Configuration:
DATABASE_URL- PostgreSQL connection string (see Database Setup)REDIS_URL- Redis connection stringBETTER_AUTH_SECRET- Generate with:openssl rand -base64 32ENCRYPTION_KEY- Generate with:python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"JWT_SECRET- Generate with:openssl rand -hex 32OPENAI_API_KEY- From OpenAI PlatformANTHROPIC_API_KEY- From Anthropic Console
Optional (for full features):
STRIPE_SECRET_KEY- For subscription managementGOOGLE_CLIENT_ID/GOOGLE_CLIENT_SECRET- For Google OAuthGITHUB_CLIENT_ID/GITHUB_CLIENT_SECRET- For GitHub OAuthWHATSAPP_API_TOKEN- For WhatsApp approval workflowVEO_API_KEY- For video generation
See Environment Variables Guide for complete configuration.
π Documentation
Getting Started
- Database Setup Guide - PostgreSQL setup with Neon/Supabase
- Environment Variables Guide - Complete configuration reference
- Deployment Guide - Local, Docker, and HuggingFace Spaces deployment
- Architecture Overview - System design and data flow
Operations
- Troubleshooting Guide - Common issues and solutions
- Migration Guide - Database migration instructions
Phase Documentation
- Phase 1: Core Infrastructure - Authentication and user management
- Phase 2: AI Engine - Content generation
- Phase 3: Approval System - WhatsApp workflow
- Phase 4: Learning Loop - Analytics and insights
π― Project Status
Overall Completion: ~58% β Target: 95%
- β Phase 1-3: Production-ready (100%)
- β οΈ Phase 4: Functionally complete (78%)
- π Phase 5: In progress (37% β 90%)
- π Phase 6: In progress (35% β 90%)
- β
Better Auth Migration: Complete (Phases 5-9)
- OAuth social login (Google, GitHub)
- Password reset with email
- Email verification
- Admin role management
- Comprehensive documentation
See PROJECT_STATUS_REPORT.md for detailed status.
π§ͺ Testing
# Run unit tests
cd phase-1-core-infra/backend
pytest
# Run with coverage
pytest --cov=src --cov-report=html
# Run E2E tests
cd ../frontend
npx playwright test
See TESTING_GUIDE.md for comprehensive testing documentation.
π Security
- Encryption: AES-256 for social media tokens, bcrypt for passwords
- Authentication: JWT-based with refresh tokens, OAuth 2.0 support
- Authorization: Role-based access control (RBAC)
- Data Isolation: Row-level security (RLS) for multi-tenancy
- Rate Limiting: 100 requests/minute per user
- CSRF Protection: Enabled on all state-changing operations
- Input Validation: Pydantic schemas for all API inputs
π€ Contributing
Contributions are welcome! Please read our contributing guidelines before submitting PRs.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
- Built with Claude Code
- Powered by Anthropic Claude
- Deployed on HuggingFace Spaces
π Support
- Documentation: See
docs/directory - Issues: Open an issue on GitHub
- Questions: Check Troubleshooting Guide
Last Updated: 2026-02-12 | Version: 1.0.0-beta
Built with β€οΈ using AI-powered development