Skip to content

ayushnandi718-dev/ADPILOT-AI

Repository files navigation

Typing SVG






🧠 System Architecture

flowchart TB
    subgraph Frontend["🌐 Next.js 16 Frontend"]
        direction TB
        LP["🏠 Landing Page<br/>Pricing · FAQ · Testimonials"]
        AUTH["πŸ” Auth Pages<br/>Login Β· Register Β· Verify"]
        DASH["πŸ“Š Dashboard<br/>Metrics Β· Charts Β· KPIs"]
        CM["πŸ“’ Campaigns<br/>CRUD Β· Detail Β· Import"]
        AN["πŸ“ˆ Analytics<br/>Charts Β· Filters Β· Export"]
        CS["🎨 Creative Studio<br/>AI Copy · History"]
        CP["πŸ’¬ AI Copilot<br/>Chat Β· Models"]
        AT["⚑ Automation<br/>Rules · Triggers"]
        RP["πŸ“‘ Reports<br/>Generate Β· PDF"]
        INT["πŸ”— Integrations<br/>Platforms Β· Status"]
        ADM["πŸ›‘οΈ Admin Panel<br/>Users Β· Billing Β· Settings"]
    end

    subgraph API["βš™οΈ API Layer"]
        direction TB
        API_AUTH["πŸ”‘ Auth API<br/>JWT Β· bcrypt Β· Cookies"]
        API_CRM["πŸ“‹ Campaign API<br/>CRUD Β· Search Β· Import"]
        API_AI["πŸ€– AI API<br/>OpenRouter Β· Ollama Β· LM Studio"]
        API_AN["πŸ“Š Analytics API"]
        API_RP["πŸ“‘ Reports API<br/>jsPDF Generation"]
        API_AT["⚑ Automation API"]
        API_BL["πŸ’³ Billing API<br/>Plans Β· Transactions"]
        API_ADM["πŸ›‘οΈ Admin API<br/>Stats Β· Users Β· Updates"]
    end

    subgraph DB["πŸ—„οΈ Data Layer"]
        direction TB
        DB_PRISMA["Prisma 7 ORM"]
        DB_SQLITE["SQLite Database"]
        DB_MOCK["πŸ“¦ Mock Data Layer<br/>8 Campaigns Β· Users Β· Charts"]
    end

    Frontend --> API
    API --> DB
    DB --> DB_PRISMA --> DB_SQLITE
    DB_PRISMA -.-> DB_MOCK
    API_AI --> AI_PROVIDERS

    subgraph AI_PROVIDERS["🧠 AI Providers"]
        OR["OpenRouter<br/>GPT-4o-mini"]
        OL["Ollama<br/>Local"]
        LMS["LM Studio<br/>Local"]
    end

    style Frontend fill:#1a1a2e,stroke:#7C3AED,stroke-width:2px
    style API fill:#16213e,stroke:#00F5FF,stroke-width:2px
    style DB fill:#0f3460,stroke:#FF00E5,stroke-width:2px
    style AI_PROVIDERS fill:#1a1a2e,stroke:#7C3AED,stroke-width:1px
Loading
flowchart LR
    subgraph AUTH["πŸ” Auth Flow"]
        REG["Register"] --> VERIFY["Verify Email"]
        LOGIN["Login"] --> JWT["JWT Token<br/>httpOnly Cookie"]
        JWT --> API_ACCESS["API Access"]
    end

    subgraph DATA["πŸ“Š Data Flow"]
        UI["User Input"] --> MOCK["Mock Service"]
        MOCK --> RESP["Response"]
        MOCK -.-> DB_FUTURE["Prisma DB<br/>(Coming Soon)"]
    end

    subgraph PAYMENT["πŸ’³ Billing Flow"]
        PLAN["Select Plan"] --> TIER["Pricing Tier"]
        TIER --> CHECKOUT["Checkout"]
        CHECKOUT --> PAYMENT_GW["Payment Gateway<br/>(Stub)"]
        PAYMENT_GW --> SUCCESS["Success"]
    end

    style AUTH fill:#1a1a2e,stroke:#00F5FF
    style DATA fill:#1a1a2e,stroke:#7C3AED
    style PAYMENT fill:#1a1a2e,stroke:#FF00E5
Loading


✨ Features β€” What's Built

πŸ” Authentication & Security

Module Details
JWT Auth bcrypt password hashing, httpOnly cookie sessions
Email Verification Nodemailer-based verification flow
Role Management User / Admin roles with route guards
Session Management Auth context provider, protected API middleware

πŸ“Š Dashboard & Analytics

Module Details
πŸ“ˆ Main Dashboard 8 KPI cards (Spend, Revenue, ROAS, CPA, CTR, Conversions, Active Campaigns, Budget), area chart (7-day trends), bar chart (campaign comparison), top campaigns table
πŸ” Campaign List Search, platform/status badges, CRUD with plan limit enforcement
πŸ“‹ Campaign Detail Per-campaign metrics, area chart, info table
πŸ“Š Analytics Page Metric cards, area chart, pie chart (platform breakdown), bar chart (daily performance)

🧠 AI Capabilities

Module Details
πŸ€– AI Copilot Chat interface with conversation history, model selector (GPT-4, GPT-3.5, Claude 3), suggested prompts, markdown rendering
🎨 Creative Studio AI ad copy generator for Google / Meta / TikTok / Taboola β€” 6 creative types (headline, text, description, CTA, email, landing page) with history
πŸ“‘ CSV Analysis Upload CSV β†’ column mapping β†’ AI generates executive summary, wasted spend analysis, opportunities, budget recommendations
πŸ”Œ Provider System Pluggable: OpenRouter (default), Ollama (local), LM Studio (local), Custom

⚑ Automation & Reports

Module Details
βš™οΈ Automation Rules 5 trigger types (ROAS threshold, budget exceeded, CPA spike, CTR drop, schedule) Γ— 5 action types (notify, pause campaign, adjust budget, generate report, send email)
πŸ“‘ Report Generator 4 templates (Weekly, Monthly, Campaign Summary, Performance Breakdown), PDF download via jsPDF, status tracking
πŸ”” Smart Notifications Filterable (Success, Warning, Error, Recommendations), mark-as-read

πŸ’Ό Business & Admin

Module Details
πŸͺ Landing Page Hero, feature highlights, testimonial carousel, FAQ accordion, footer
πŸ’³ Pricing 5 tiers: Free, Starter ($9), Professional ($29), Business ($79), Enterprise ($199)
πŸ›’ Checkout Multi-step: country β†’ currency β†’ payment method β†’ processing β†’ success
πŸ›‘οΈ Admin Panel Dashboard (user count, revenue, subs), User management, Settings, Changelog, Billing (MRR, ARR, Churn, ARPU, LTV, transactions, subscriptions, coupons)
βš™οΈ Settings Profile, Workspace, Password, Notifications, Danger Zone tabs

πŸ”— Integrations

Platform Status
Google Ads πŸ”Œ Connection UI + card
Meta Ads πŸ”Œ Connection UI + card
TikTok Ads πŸ”Œ Connection UI + card
Taboola πŸ”Œ Connection UI + card
HubSpot πŸ”Œ Connection UI + card
Salesforce πŸ”Œ Connection UI + card
Shopify πŸ”Œ Connection UI + card
Slack πŸ”Œ Connection UI + card

🧩 Additional Features

Feature Description
🌐 Global Search Cmd+K modal searching campaigns, reports, messages
🎯 Onboarding Tour Multi-step interactive tour covering all dashboard features
πŸ“± Responsive Sidebar Collapsible navigation with admin link
πŸ—„οΈ Database Schema 19 Prisma models: User, Workspace, Campaign, Creative, Insight, Recommendation, Conversation, Message, Automation, Report, Integration, Notification, Settings, AuditLog, SiteSettings, UpdateLog, BillingPlan, Subscription, Transaction, Invoice, Refund, Coupon
πŸ“¦ Mock Data 8 campaigns across Google / Meta / TikTok / Taboola, mock automations, analytics, conversations, recommendations


🌐 System Status

MODULE STATUS UPTIME LOAD
🟒 AI Core ONLINE 99.99% 12%
🟣 Analytics Engine ACTIVE 99.97% 34%
πŸ”΅ Campaign Controller RUNNING 99.95% 28%
🟒 Automation Nexus ENABLED 99.99% 8%
πŸ”· Database Cluster CONNECTED 99.99% 22%
⚑ Intelligence Feed REAL-TIME 99.98% 16%



πŸ›  Tech Stack

hover over icons for a closer look ✦ premium stack for premium results


Category Technologies
Framework Next.js 16, React 19, TypeScript 5
Styling Tailwind CSS 4, Framer Motion, CVA, Lucide Icons
Database Prisma 7, SQLite, Better-SQLite3
Auth JWT (bcryptjs + httpOnly cookies), Nodemailer
Charts Recharts, date-fns
State Zustand (persisted), TanStack React Query 5
AI OpenRouter (GPT-4o-mini), Ollama, LM Studio
PDF jsPDF
Validation Zod 4
Deployment Vercel


πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • npm 9+

Installation

# Clone the repository
git clone https://github.com/ayushnandi718-dev/adpilot-ai.git
cd adpilot-ai

# Install dependencies
npm install

# Set up environment variables
cp .env.example .env
# Fill in your JWT secret and email credentials

# Initialize the database
npx prisma generate
npx prisma db push

# Seed admin user (optional)
npm run create-admin

# Start the development server
npm run dev

Open http://localhost:3000 β€” your command center awaits.



πŸ” Environment Variables

Variable Description Required
DATABASE_URL Database connection string βœ…
JWT_SECRET JWT signing secret βœ…
SMTP_HOST Email server host ◻️
SMTP_PORT Email server port ◻️
SMTP_USER Email server user ◻️
SMTP_PASS Email server password ◻️
OPENROUTER_API_KEY OpenRouter API key ◻️
DEFAULT_AI_PROVIDER Default AI provider ◻️
ADMIN_EMAIL Predefined admin login email ◻️
ADMIN_PASSWORD Predefined admin login password ◻️


πŸ“¦ Deployment

β–² Vercel

  1. Push to GitHub
  2. Import project in Vercel
  3. Add environment variables
  4. Deploy ✨

βš™οΈ Manual

npm run build
npm start


πŸ“ Project Structure

src/
β”œβ”€β”€ app/              # Next.js App Router pages & API routes
β”‚   β”œβ”€β”€ api/         # 30+ REST API endpoints
β”‚   β”œβ”€β”€ auth/        # Login, Register, Verify pages
β”‚   β”œβ”€β”€ dashboard/   # Dashboard, Campaigns, Analytics, etc.
β”‚   └── layout.tsx   # Root layout with providers
β”œβ”€β”€ components/       # Reusable UI components
β”‚   β”œβ”€β”€ ui/          # Base primitives (button, card, modal, etc.)
β”‚   β”œβ”€β”€ layout/      # Sidebar, Header, Shell
β”‚   └── shared/      # Cross-feature shared components
β”œβ”€β”€ features/        # Feature-specific components & logic
β”œβ”€β”€ hooks/           # Custom React hooks
β”œβ”€β”€ services/        # Business logic (campaign, AI, etc.)
β”œβ”€β”€ repositories/    # Data access layer (Prisma + mock fallback)
β”œβ”€β”€ store/           # Zustand stores (campaign-store)
β”œβ”€β”€ providers/       # React context providers (Auth, Query)
β”œβ”€β”€ lib/             # Utilities, constants, types
β”œβ”€β”€ mock/            # Development mock data
└── generated/       # Prisma client output


πŸ—ΊοΈ API Routes

Category Endpoints
πŸ”‘ Auth POST login, POST register, POST logout, GET me, GET verify-email, POST send-verification
πŸ“’ Campaigns GET all, GET/:id, DELETE/:id, GET search, POST import, POST analyze
πŸ€– AI POST /api/ai (completions), POST /api/copilot (chat)
πŸ“Š Analytics GET /api/analytics
πŸ“ˆ Dashboard GET /api/dashboard
⚑ Automations GET, POST /api/automations
πŸ“‘ Reports GET, POST /api/reports
πŸ’‘ Recommendations GET /api/recommendations
πŸ”” Notifications GET /api/notifications
βš™οΈ Settings GET, PUT /api/settings
πŸ” Search GET /api/search
πŸ’³ Billing POST /api/billing/create-payment
πŸ›‘οΈ Admin GET stats, Users CRUD, Settings CRUD, Updates CRUD, Billing management






🀝 Open for Contributions

We're actively looking for contributors! Here's how you can help:

πŸš€ Ways to Contribute

Area Ideas
🧠 AI Features More ad copy generators, A/B test predictions, sentiment analysis
πŸ”Œ Integrations Real Google/Meta/TikTok API connectors (instead of stubs)
πŸ’³ Payments Wire up Stripe, PayPal, Razorpay webhooks
πŸ“Š Analytics Export to CSV/PDF, custom date ranges, real-time dashboards
⚑ Automation Background job runner, Slack/email notifications
🎨 UI/UX Dark mode variants, mobile polish, animations
πŸ› Bug Fixes Check the Issues tab
πŸ“– Docs Improve API docs, add usage examples

πŸ“‹ Getting Started

# Fork & clone
git clone https://github.com/your-username/adpilot-ai.git
cd adpilot-ai

# Install
npm install

# Create branch
git checkout -b feature/your-feature-name

# Make changes & commit
git commit -m "feat: add your feature description"

# Push & open a PR
git push origin feature/your-feature-name

βœ… Guidelines

  • Keep PRs focused β€” one feature/fix per PR
  • Follow existing code style (TypeScript, Tailwind, no comments)
  • Test your changes with npm run lint and npx tsc --noEmit
  • Update the README if your change affects usage
  • Be kind and constructive in code reviews

All skill levels welcome. If you're new to open source, we're here to help you through your first PR! πŸš€


🏷️ Tags

ai-marketing nextjs react typescript prisma sqlite tailwind-css jwt-auth saas marketing-intelligence ad-copy-generator campaign-management analytics-dashboard openrouter framer-motion zustand react-query recharts

Click the 🏷️ Topics button at the top of the repo to add these tags on GitHub.



━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

⚑ SYSTEM ONLINE β€’ 🧠 AI CORE ACTIVE β€’ 🌐 NEURAL LINK ESTABLISHED ⚑

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

crafted with 🩷 β€” where data meets design

made by AYUSH NANDI β€” ayushnandi718@gmail.com

About

? AI-powered marketing intelligence platform - analyze, optimize, and dominate ad campaigns with AI copy generation, analytics, automation, and billing. Built with Next.js 16, React 19, TypeScript, Prisma, Tailwind CSS.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages