# Project Overview
Build an AI-powered SaaS platform for generating UGC-style social media advertisements (Meta, TikTok, etc.). The platform must be integrated into the existing `webconsulting.at/tools` architecture.
## Tech Stack & Architecture
- **Frontend**: Responsive design utilizing existing styles in `/tools`.
- **Backend**: Supabase (Auth, RLS, User Management, Database, Edge Functions).
- **Payments**: Subscription-based model (Stripe/Polar integration).
- **Configuration**: API keys stored in environment variables/Supabase secrets (never expose in frontend).
- **Integrations**:
- Scripting: OpenRouter (Opus 4.5).
- Image/Video Generation: Fal.ai (with Fal-token), Nano Banana Pro, and specialized video LLMs.
## Subscription Model
- No free plan: All users must hold a paid subscription.
- Transparency: Display specific credit costs per action to users for confirmation before execution.
## Page Structure
1. **Integration**: Access via the tools section and navigation dropdowns.
2. **Dashboard**: User metrics (remaining credits, video history, account status) and navigation to creation tools.
3. **Video Creation Workflow (MVP)**:
- **Step 1 (Scripting)**: Input product description, audience, and hooks. Generate script via AI; allow user to edit/regenerate.
- **Step 2 (Script Approval)**: User confirms text; proceed only after approval.
- **Step 3 (Influencer Generation)**: Upload custom image or AI-generate influencer (must be 9x16 portrait ratio).
- **Step 4 (Talking Head Video)**: Combine script + influencer image. Define voice characteristics (gender, tone, accent). Generate lip-sync video with built-in TTS (9x16 format).
## Technical Requirements
- **Schema**: `users`, `credits`, `videos`, `scripts` tables.
- **Security**: Strict RLS implementation; all logic handled via backend/Edge Functions.
- **UX**: Loading states, error feedback, multi-step progress indicators, and transparent credit consumption logging.
## Development Workflow
1. Create detailed implementation plan.
2. Extend `/tools` architecture to include new modules.
3. Implement/Reuse Supabase Auth and User Management.
4. Build and test video generation workflow (Steps 1-4).
5. Integrate payment gateway for mandatory subscription tiers.
6. Iterate based on performance and user feedback.