Ad Optimize AI is a backend-focused web application designed to help advertisers and marketers analyze their ad campaign data, generate actionable insights, and optimize strategies using advanced AI agents. Users can upload large CSV files containing ad performance data, which are then processed asynchronously. The system calculates key metrics, identifies top and bottom performers, and leverages LangChain-powered agents (integrated with LLMs) to generate human-readable insights and prioritized optimization recommendations. The frontend provides a minimal, user-friendly React interface for uploading files, tracking analysis progress, and viewing results.
- Clone the repository:
git clone <your-repo-url> cd ad-optimize-ai 
- Install backend dependencies:
cd src npm install
- Install frontend dependencies:
cd ../frontend npm install
- Set up environment variables:
- Copy env.exampleto.envand fill in required values (DB, LLM API keys, etc).
 
- Copy 
- Start the backend:
cd ../src npm start
- Start the frontend:
cd ../frontend npm run dev
- Access the app:
- Open http://localhost:5173 in your browser.
 
- Description: Upload a CSV file (up to 100MB). Returns a job ID for async processing.
- Request: multipart/form-datawithfilefield.
- Response:
{ "success": true, "data": { "jobId": "uuid", "filename": "...csv" } }
- Description: Get analysis results and job status by job ID. Supports polling.
- Response (processing):
{ "success": true, "data": { "status": "processing", "progress": 40, ... } }
- Response (completed):
{ "success": true, "data": { "status": "completed", "analysis": { ... } } }
- Response (failed):
{ "success": false, "error": "Analysis failed" }
- Description: Generate optimization tasks based on analysis.
- Request: { "priority": "high|medium|low", "focus_areas": ["sales", ...] }
- Response:
{ "success": true, "data": { "tasks": [ ... ] } }
- Multi-Agent System:
- DataAnalyzerAgent: Parses CSV, calculates metrics, detects patterns/anomalies.
- InsightGeneratorAgent: Uses LLM to generate human-readable insights and trends.
- TaskCreatorAgent: Produces prioritized, actionable optimization tasks and recommendations.
 
- Workflow:
- Backend triggers agents after file upload.
- DataAnalyzerAgent processes and summarizes data.
- InsightGeneratorAgent crafts insights using prompt engineering and LLM API.
- TaskCreatorAgent generates optimization strategies and action items.
- Results are stored and served to the frontend.
 
- Fallback: If LLM fails, the system displays available metrics and trends, with a notice.
- Better UI/UX: Enhance the frontend with richer visualizations, filtering, and more interactive dashboards.
- LLM Fallback: Integrate multiple LLM providers (OpenAI, Claude, Gemini, open source) and implement automatic fallback if one fails.
- Business Ideas: Add modules for budget forecasting, competitor analysis, and campaign simulation.
- User Management: Support multi-user accounts, roles, and team collaboration features.
- Automated Scheduling: Allow users to schedule recurring uploads and receive automated reports.
- API Rate Limiting & Security: Add advanced rate limiting, audit logs, and improved security for production.
- Customizable Agent Prompts: Let users fine-tune agent behavior and prompt templates for their business needs.
For any questions or contributions, please open an issue or contact the maintainers.