AI-powered content creation and social media management platform with mobile PWA support
Maya AI is an advanced AI-powered content optimization system designed for social media creators and businesses. It combines machine learning, automated content generation, and multi-platform publishing capabilities with a modern Progressive Web App (PWA) interface.
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β API Gateway β β Load Balancer β β Nginx β
β (FastAPI) β β (Nginx) β β (Reverse β
β β β β β Proxy) β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Content β β AI Models β β Social β
β Processor β β Integration β β Platforms β
β β β β β β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Database β β Redis β β Monitoring β
β (PostgreSQL) β β (Cache & β β (Prometheus/ β
β β β Queue) β β Grafana) β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
- FastAPI-based REST API
- JWT authentication and authorization
- Rate limiting and security middleware
- Comprehensive error handling
- Platform-specific content optimization
- Content validation and formatting
- Hashtag and mention processing
- Multi-platform content adaptation
- OpenAI GPT models for content generation and analysis
- HuggingFace transformers for sentiment analysis
- Configurable model selection and fallbacks
- Content enhancement recommendations
- Twitter/X API integration
- Instagram Business API integration
- Scheduling and publishing workflow
- Content unpublishing and management
- n8n workflow integration for automation
- Custom n8n nodes and triggers
- Webhook endpoints for external system integration
- Task submission API for background processing
- JWT token management
- Password hashing and validation
- Input sanitization and validation
- Rate limiting and security headers
- Prometheus metrics collection
- Health checks and alerting
- Performance tracking
- Structured logging with Sentry integration
Maya uses Pydantic Settings for configuration management with support for environment variables and configuration files.
DATABASE_URL=postgresql://user:password@host:port/database
DB_POOL_SIZE=10
DB_MAX_OVERFLOW=20OPENAI_API_KEY=sk-...
HUGGINGFACE_TOKEN=hf_...
MODEL_CACHE_DIR=./models/cacheSECRET_KEY=your-secret-key-32-chars-minimum
JWT_ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
ALLOWED_HOSTS=["*"] # Restrict in productionAI-powered content creation and social media management platform with mobile PWA support
Maya AI is an advanced AI-powered content optimization system designed for social media creators and businesses. It combines machine learning, automated content generation, and multi-platform publishing capabilities with a modern Progressive Web App (PWA) interface.
- Image Generation: Integration with Fooocus and AI models for high-quality visuals
- Smart Caption Generation: OpenAI GPT-powered captions optimized for each platform
- Content Enhancement: Automatic image optimization and text refinement
- Hashtag Intelligence: AI-generated relevant hashtags for maximum reach
- Mobile Installation: Install as native app on iOS/Android devices
- Offline Support: Content creation works without internet connection
- Touch Optimized: Mobile-first responsive design
- Push Notifications: Real-time content status updates
- Cross-Platform: Works on desktop, tablet, and mobile
- Instagram: Photos, Stories, Reels with optimal timing
- TikTok: Short-form videos with trending hashtags
- Twitter: Text and media posts with character optimization
- Fanvue: Creator-focused content distribution
- Snapchat: Engaging stories and snaps
- AI Safety Scoring: Automatic content appropriateness detection
- NSFW Detection: Advanced filtering for inappropriate content
- Telegram Review: Human oversight through bot integration
- Quality Assurance: Automated image and text quality checks
- Background Processing: Celery-powered async task processing
- Smart Queue Management: Priority-based content processing
- Real-time Analytics: Performance tracking and insights
- Auto-posting: Scheduled content distribution
- n8n Integration: Custom nodes for workflow automation
- Review Workflow: Human review via Telegram bot
- One-click Approval: Approve/reject content instantly
- Content Editing: Edit captions and regenerate content
- Status Notifications: Real-time updates and alerts
Manual Setup:
git clone https://github.com/stusseligmini/maya.git
cd maya
# Follow RENDER_DEPLOYMENT_GUIDE.md for complete setupAfter deployment, install Maya AI as a mobile app:
iPhone (iOS):
- Open Safari β
https://your-app.onrender.com/app - Tap Share (β‘β) β "Add to Home Screen"
- Maya AI installs as native iOS app! π
Android:
- Open Chrome β
https://your-app.onrender.com/app - Tap "Add to Home screen" banner
- Maya AI installs as Android app! π€
# Clone repository
git clone https://github.com/stusseligmini/maya.git
cd maya
# Install dependencies
pip install -r requirements.txt
# Start development server
python main.py
# Access application
# Web: http://localhost:8000
# Mobile PWA: http://localhost:8000/app
# API Docs: http://localhost:8000/docsβββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Maya API β β AI Service β β Worker Service β
β (FastAPI) βββββΊβ (Fooocus) βββββΊβ (Celery) β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β PostgreSQL β β Redis β β Telegram Bot β
β (Database) β β (Cache/Queue) β β (Review) β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
π maya/
βββ π docker/ # Container configuration
β βββ Dockerfile # Main app container
β βββ docker-compose.yml # Service orchestration
β βββ services/ # Individual service containers
β βββ ai-service/ # Fooocus & ML models
β βββ db-service/ # Database configuration
β βββ worker-service/ # Background job processing
βββ π config/ # Environment & settings
β βββ settings.py # Application configuration
β βββ secrets.py # API keys & secrets
β βββ dev.env # Development environment
β βββ prod.env # Production environment
βββ π database/ # Database layer
β βββ models.py # SQLAlchemy ORM models
β βββ connection.py # Database connectivity
β βββ migrations/ # Database schema changes
βββ π api/ # API endpoints
β βββ routes.py # Main API routes
β βββ auth.py # Authentication logic
β βββ clients/ # External API clients
β βββ openai_client.py # OpenAI integration
β βββ huggingface_client.py # Hugging Face models
β βββ runway_client.py # Video generation
βββ π queue/ # Background processing
β βββ worker.py # Celery worker setup
β βββ tasks.py # Background tasks
β βββ scheduler.py # Scheduled jobs
βββ π telegram/ # Telegram integration
β βββ bot_image_review.py # Image review bot
β βββ bot_video_review.py # Video review bot
β βββ callbacks/ # Bot callback handlers
βββ π moderation/ # Content safety
β βββ image_moderation.py # Image content checks
β βββ emotion_analysis.py # Text sentiment analysis
β βββ platform_filter.py # Platform-specific rules
βββ π processing/ # Content manipulation
β βββ caption_generator.py # AI caption creation
β βββ video_editor.py # Video processing
β βββ image_optimizer.py # Image optimization
β βββ scheduler.py # Publishing scheduler
βββ π publishing/ # Platform publishing
β βββ instagram_api.py # Instagram integration
β βββ tiktok_api.py # TikTok integration
β βββ twitter_api.py # Twitter integration
β βββ fanvue_upload.py # Fanvue integration
β βββ snapchat_upload.py # Snapchat integration
βββ π storage/ # File management
β βββ proton_upload.py # Proton Drive backup
β βββ backup_system.py # Automated backups
β βββ privacy_guard.py # Data protection
βββ π monitoring/ # System monitoring
β βββ health_checks.py # Service health monitoring
β βββ metrics.py # Performance metrics
β βββ alerts.py # Alert notifications
βββ π input/ # Content input directories
β βββ images_raw/ # AI-generated images
β βββ captions_raw/ # Generated captions
β βββ videos_raw/ # Generated videos
βββ π logs/ # Application logs
βββ π tests/ # Test suite
βββ π main.py # Application entry point
βββ π requirements.txt # Python dependencies
βββ π README.md # This file
- Docker & Docker Compose
- Python 3.11+
- PostgreSQL
- Redis
git clone <repository-url>
cd maya# Copy environment file
cp config/dev.env .env
# Edit configuration
nano .env# Start all services
cd docker
docker-compose up -d
# Check service status
docker-compose ps# Run database migrations
docker-compose exec maya-api python init_db.py- API Documentation: http://localhost:8080/docs
- Main Application: http://localhost:8080
- Celery Monitor: http://localhost:5555
- Health Check: http://localhost:8080/health
graph TD
A[Upload Content] --> B[Queue Processing]
B --> C[Content Moderation]
C --> D{Safe Content?}
D -->|Yes| E[AI Analysis]
D -->|No| F[Reject & Log]
E --> G[Caption Generation]
G --> H[Platform Optimization]
H --> I[Telegram Review]
I --> J{Approved?}
J -->|Yes| K[Schedule Publishing]
J -->|No| L[Edit/Regenerate]
K --> M[Publish to Platforms]
M --> N[Monitor Performance]
L --> G
# Core Settings
ENVIRONMENT=development
DEBUG=True
DATABASE_URL=postgresql://maya:maya_secret@postgres:5432/maya_db
REDIS_URL=redis://redis:6379/0
# AI Services
OPENAI_API_KEY=your-openai-key
HUGGINGFACE_API_KEY=your-huggingface-key
FOOOCUS_API_URL=http://ai-service:8080
# Social Media APIs
INSTAGRAM_ACCESS_TOKEN=your-instagram-token
TIKTOK_ACCESS_TOKEN=your-tiktok-token
TWITTER_API_KEY=your-twitter-key
# Telegram Bot
TELEGRAM_BOT_TOKEN=your-telegram-bot-token
TELEGRAM_CHAT_ID=your-telegram-chat-id
# Security
JWT_SECRET_KEY=your-secret-key
ENCRYPTION_KEY=your-encryption-key- Create Facebook Developer Account
- Create Instagram Business Account
- Generate access token via Graph API
- Add token to environment variables
- Register for TikTok for Developers
- Create application and get credentials
- Implement OAuth flow for user tokens
- Create Twitter Developer Account
- Generate API keys and tokens
- Configure OAuth 2.0 settings
curl -X POST "http://localhost:8080/api/content/upload"
-H "Authorization: Bearer YOUR_TOKEN"
-F "file=@image.jpg"
-F "metadata={"title":"Test Image","content_type":"image","target_platforms":["instagram","twitter"]}"curl "http://localhost:8080/api/queue/status"
-H "Authorization: Bearer YOUR_TOKEN"curl -X POST "http://localhost:8080/api/content/123/publish"
-H "Authorization: Bearer YOUR_TOKEN"
-H "Content-Type: application/json"
-d '{"platforms":["instagram","twitter"],"schedule_time":"2024-01-01T14:00:00"}'# System health
curl http://localhost:8080/health
# Service metrics
curl http://localhost:8080/metrics# Application logs
docker-compose logs -f maya-api
# Worker logs
docker-compose logs -f worker-service
# Database logs
docker-compose logs -f postgresVisit http://localhost:5555 for real-time worker monitoring
# Unit tests
docker-compose exec maya-api pytest tests/unit/
# Integration tests
docker-compose exec maya-api pytest tests/integration/
# End-to-end tests
docker-compose exec maya-api pytest tests/e2e/# Test content upload
python scripts/test_upload.py
# Test moderation
python scripts/test_moderation.py
# Test publishing
python scripts/test_publishing.pyAll API endpoints require JWT authentication except for health checks and token creation.
- JWT token-based authentication
- Role-based access control
- API key management for external services
- Encryption at rest and in transit
- GDPR compliance features
- Automatic data anonymization
- Secure API key storage
- Per-user request limits
- Platform-specific rate limiting
- Automatic backoff and retry logic
- Redis for session and API response caching
- Image thumbnail caching
- Model prediction caching
- Connection pooling
- Query optimization
- Automatic indexing
- Read replicas for scaling
- Async task processing
- Batch content processing
- Resource usage monitoring
- Auto-scaling workers
# Check database status
docker-compose ps postgres
# Reset database
docker-compose down
docker volume rm maya_postgres_data
docker-compose up -d postgres# Get access token
POST /auth/token
{
"username": "demo",
"password": "demo123"
}
# Use token in requests
Authorization: Bearer <token>docker-compose logs worker-service
docker-compose restart worker-service
docker-compose exec redis redis-cli ping
#### API Authentication Errors
```bash
# Process content for optimization
POST /content/process
{
"text": "Your content here",
"content_type": "text",
"target_platforms": ["twitter", "instagram"],
"analyze_with_ai": true
}
# Verify JWT secret
echo $JWT_SECRET_KEY
# Check token generation
python scripts/generate_token.py
- GitHub Issues: Technical problems and feature requests
- Documentation: Detailed guides and API reference
- Community Forum: Usage questions and best practices
- Fork the repository
- Create feature branch
- Install development dependencies
- Run tests before committing
- Submit pull request
- Follow PEP 8 Python style guide
- Write comprehensive tests
- Document all functions and classes
- Use type hints consistently
This project is licensed under the MIT License - see LICENSE file for details.
- Fooocus: AI image generation capabilities
- OpenAI: GPT models for content generation
- Hugging Face: ML model ecosystem
- FastAPI: High-performance web framework
- Celery: Distributed task processing
- PostgreSQL: Robust database system
Maya AI transforms your content creation workflow with intelligent automation. Get started today and experience the future of social media management!
Need Help? Check our documentation or open an issue.