Skip to content

karthikrshet/auditforge-ai

Repository files navigation

AuditForge AI 🔍⚡

AI-powered website auditing platform. Analyze any website for SEO, Performance, Accessibility, Security, and AI Visibility — powered by Gemini AI.

AuditForge AI TypeScript MongoDB


✨ Features

  • SEO Analysis — 40+ SEO signals including title, meta, canonical, OG, sitemap, structured data
  • Performance Audit — Real Lighthouse/PageSpeed scores, Core Web Vitals (LCP, CLS, INP, FCP, TTFB)
  • Accessibility — WCAG checks, ARIA, contrast, form labels, semantic HTML
  • Security Scanner — HTTPS, CSP, HSTS, X-Frame-Options, OWASP-based checks
  • AI Visibility — llms.txt, AI crawlability, ChatGPT/Gemini/Claude readiness
  • Gemini AI Insights — Executive summaries, quick wins, 90-day improvement plans, roast mode
  • Shareable Reports — Public URLs like /audit/abc123
  • Competitor Comparison — Side-by-side website battle
  • Leaderboard — Top performing websites
  • Stripe Payments — Free/Pro/Agency/Enterprise plans
  • Auth.js v5 — Google & GitHub OAuth

🚀 Quick Start

1. Install dependencies

npm install

2. Configure environment variables

cp .env.example .env.local

Fill in all values in .env.local:

Variable Description
NEXTAUTH_SECRET Random secret (run openssl rand -base64 32)
NEXTAUTH_URL Your app URL (http://localhost:3000 for dev)
GOOGLE_CLIENT_ID From Google Cloud Console
GOOGLE_CLIENT_SECRET From Google Cloud Console
GITHUB_CLIENT_ID From GitHub Developer Settings
GITHUB_CLIENT_SECRET From GitHub Developer Settings
MONGODB_URI MongoDB Atlas connection string
GEMINI_API_KEY From Google AI Studio
PAGESPEED_API_KEY From Google Cloud Console (PageSpeed Insights API)
STRIPE_SECRET_KEY From Stripe Dashboard
STRIPE_PUBLISHABLE_KEY From Stripe Dashboard
STRIPE_WEBHOOK_SECRET From Stripe Webhooks section
STRIPE_PRO_PRICE_ID Stripe Price ID for Pro plan
STRIPE_AGENCY_PRICE_ID Stripe Price ID for Agency plan
NEXT_PUBLIC_APP_URL Your app URL

3. Run development server

npm run dev

Open http://localhost:3000


🛠 Tech Stack

Layer Technology
Framework Next.js 15 (App Router)
Language TypeScript
Styling Tailwind CSS + Framer Motion
Database MongoDB Atlas + Mongoose
Auth Auth.js v5 (Google + GitHub OAuth)
AI Google Gemini 2.0 Flash
Performance Google PageSpeed Insights API
Payments Stripe
Deployment Vercel

📁 Project Structure

src/
├── app/
│   ├── api/
│   │   ├── audit/          # Main audit endpoint
│   │   ├── compare/        # Competitor comparison
│   │   ├── leaderboard/    # Top websites
│   │   ├── stripe/         # Payments & webhooks
│   │   └── auth/           # NextAuth handlers
│   ├── audit/[id]/         # Public shareable audit page
│   ├── auth/               # Sign in / error pages
│   ├── dashboard/          # Protected dashboard
│   ├── admin/              # Admin panel
│   ├── compare/            # Competitor comparison UI
│   └── leaderboard/        # Public leaderboard
├── components/
│   ├── landing/            # Homepage sections
│   ├── dashboard/          # Dashboard UI
│   ├── audit/              # Audit display components
│   ├── auth/               # Auth components
│   └── ui/                 # Shared UI primitives
├── lib/
│   ├── audit-engine.ts     # Core analysis logic
│   └── db/                 # MongoDB connection
├── models/                 # Mongoose schemas
├── types/                  # TypeScript declarations
├── auth.ts                 # Auth.js config
└── middleware.ts            # Route protection

🔧 Setting Up OAuth

Google OAuth

  1. Go to Google Cloud Console
  2. Create a new project or select existing
  3. Enable "Google+ API"
  4. Go to Credentials → Create OAuth 2.0 Client ID
  5. Add authorized redirect URI: http://localhost:3000/api/auth/callback/google
  6. Copy Client ID and Secret to .env.local

GitHub OAuth

  1. Go to GitHub → Settings → Developer Settings → OAuth Apps
  2. Create new OAuth App
  3. Set Authorization callback URL: http://localhost:3000/api/auth/callback/github
  4. Copy Client ID and Secret

💳 Setting Up Stripe

  1. Create account at stripe.com
  2. Create two products: Pro ($29/mo) and Agency ($99/mo)
  3. Copy the Price IDs to .env.local
  4. For webhooks: stripe listen --forward-to localhost:3000/api/stripe/webhook

🚢 Deploying to Vercel

# Install Vercel CLI
npm i -g vercel

# Deploy
vercel --prod

Add all environment variables in Vercel dashboard under Project Settings → Environment Variables.

For Stripe webhooks in production, add your Vercel URL:

https://yourapp.vercel.app/api/stripe/webhook

🗄 MongoDB Setup

  1. Create free cluster at MongoDB Atlas
  2. Create database user
  3. Get connection string
  4. Add to MONGODB_URI in .env.local
  5. Whitelist IP: 0.0.0.0/0 for Vercel (or specific Vercel IPs)

🤖 Enabling Gemini AI

  1. Go to Google AI Studio
  2. Create API key
  3. Add to GEMINI_API_KEY

Without this key, AI insights will show placeholder text.


📊 Making a User Admin

In MongoDB Atlas, update a user document:

{ "$set": { "role": "admin" } }

Then access /admin panel.


🔒 Security Notes

  • All API routes check authentication
  • Rate limiting enforced per plan
  • Input URLs validated before processing
  • No sensitive data stored in audit results
  • MongoDB Atlas has built-in encryption at rest

📝 License

MIT License — build freely, deploy anywhere.


Built with ❤️ using Next.js 15, Gemini AI, and MongoDB Atlas

About

AI-powered website auditing platform. Analyze any website for SEO, Performance, Accessibility, Security, and AI Visibility — powered by Gemini AI.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors