Skip to content

macrivincenzo/AI-Brand-Track

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

279 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Brand Track

Monitor how AI models like ChatGPT, Claude, and Perplexity rank your brand. Track your AI brand visibility, analyze competitor rankings, and get actionable insights to improve your presence across AI platforms.

Get your SaaS running in minutes with authentication, billing, AI chat, and brand monitoring. Zero-config setup with Next.js 15, TypeScript, and PostgreSQL.

Next.js TypeScript Tailwind CSS PostgreSQL

Quick Start

Prerequisites

  • Node.js 18+ and npm
  • PostgreSQL database

One-Command Setup

# Clone the repository
git clone https://github.com/yourusername/ai-brand-track
cd ai-brand-track

# Copy environment variables
cp .env.example .env.local

Required API Keys (add to .env.local):

⚠️ Important: Without AI provider API keys, the brand monitoring feature will show 0% visibility. See SETUP.md for detailed setup instructions.

# Run the automated setup
npm run setup

The setup script will automatically:

  • Install all dependencies
  • Test database connection
  • Generate Better Auth tables
  • Apply database migrations
  • Configure Autumn billing (if API key provided)
  • Get you ready to develop

Start Development

npm run dev

Visit http://localhost:3000 to see your app!

Manual Setup (Step-by-Step)

If you prefer to run the setup commands individually or need more control over the configuration process:

1. Install Dependencies

npm install

2. Set Up Environment Variables

# Copy the example environment file
cp .env.example .env.local

# Edit .env.local with your favorite editor
nano .env.local  # or vim, code, etc.

3. Generate Authentication Secret

# Generate a secure secret for Better Auth
openssl rand -base64 32
# Copy the output to BETTER_AUTH_SECRET in .env.local

4. Initialize Database

# Push the database schema
npm run db:push

# Generate Better Auth tables
npx @better-auth/cli generate --config better-auth.config.ts

# Apply the generated migrations
npm run db:push

5. Configure Autumn Billing

# Run the Autumn setup script
npm run setup:autumn

6. Verify Setup

# Check database schema
npm run db:studio

# Test the development server
npm run dev

Common Setup Commands

# Database commands
npm run db:push          # Push schema to database
npm run db:studio        # Open Drizzle Studio GUI
npm run db:migrate       # Run database migrations

# Autumn billing commands
npm run setup:autumn     # Run Autumn setup script

# Development
npm run dev              # Start development server
npm run build            # Build for production
npm run start            # Start production server

# Utilities
npm run lint             # Run ESLint

Tech Stack

Category Technologies
Frontend Next.js 15.3, React 19, TypeScript 5.7
Styling Tailwind CSS v4, shadcn/ui, Lucide Icons
Web Scraping Firecrawl
Database PostgreSQL, Drizzle ORM
Authentication Better Auth
Payments Autumn (with Stripe integration)
AI Providers OpenAI, Anthropic, Google Gemini, Perplexity
Email Resend

Project Structure

fire-saas-geo-latest/
├── app/                    # Next.js app directory
│   ├── api/               # API routes
│   │   ├── auth/         # Better Auth endpoints
│   │   ├── autumn/       # Billing endpoints (handled by Autumn)
│   │   ├── brand-monitor/# Brand analysis APIs
│   │   └── chat/         # AI chat endpoints
│   ├── (auth)/           # Auth pages (login, register, reset)
│   ├── dashboard/        # User dashboard
│   ├── chat/             # AI chat interface
│   ├── brand-monitor/    # Brand monitoring tool
│   └── pricing/          # Subscription plans
├── components/            # React components
│   ├── ui/               # shadcn/ui components
│   ├── autumn/           # Billing components
│   └── brand-monitor/    # Brand monitor UI
├── lib/                   # Utility functions
│   ├── auth.ts           # Auth configuration
│   ├── db/               # Database schema & client
│   ├── providers/        # AI provider configs
│   └── api-wrapper.ts    # API middleware
├── config/                # Configuration files
├── public/                # Static assets
└── better-auth/           # Auth migrations

Manual Setup (if needed)

1. Configure Services & Database

Database

Create a PostgreSQL database at Supabase

  • Create a new project in Supabase
  • Go to Settings → Database
  • Copy the connection string (use "Transaction" mode) to DATABASE_URL in .env.local

Autumn Billing (Detailed Setup)

  1. Create Account

  2. Get API Key

    • Navigate to Settings → Developer
    • Click "Create API Key"
    • Copy the key to AUTUMN_SECRET_KEY in .env.local
  3. Add Stripe Integration

    • Go to Integrations → Stripe in Autumn dashboard
    • Add your Stripe secret key
    • Autumn handles all webhook configuration automatically
  4. Create Usage Feature

    • Go to Features → Create Feature
    • Name: Messages
    • ID: messages (must match exactly)
    • Type: Select Usage
    • Unit: message
    • Click "Create Feature"
  5. Create Free Product

    • Go to Products → Create Product
    • Name: Free
    • ID: Leave blank (auto-generated)
    • Price: $0/month
    • Features:
      • Add Messages feature
      • Set limit to 100
    • Click "Create Product"
  6. Create Pro Product

    • Go to Products → Create Product
    • Name: Pro
    • ID: pro (must match exactly)
    • Price: $20/month
    • Features:
      • Add Messages feature
      • Set limit to 0 (unlimited)
    • Click "Create Product"

Email

Sign up at resend.com

  • Verify domain → Copy API key to RESEND_API_KEY

Web Scraping & AI

Get your API keys from the following providers:

2. Initialize & Run

# Push database schema
npm run db:push

# Start development server
npm run dev

Visit http://localhost:3000

Environment Variables

# Database
DATABASE_URL=              # PostgreSQL connection string

# Authentication
BETTER_AUTH_SECRET=        # Generated with openssl
BETTER_AUTH_URL=           # Your app URL
NEXT_PUBLIC_APP_URL=       # Public app URL

# Billing
AUTUMN_SECRET_KEY=         # From Autumn dashboard

# Brand Monitor
FIRECRAWL_API_KEY=         # From Firecrawl

# Email
RESEND_API_KEY=            # From Resend
EMAIL_FROM=                # Your email address

# AI Providers (add what you need)
OPENAI_API_KEY=
ANTHROPIC_API_KEY=
PERPLEXITY_API_KEY=
GOOGLE_GENERATIVE_AI_API_KEY=

Available Scripts

npm run dev                  # Start development server
npm run build                # Build for production
npm run start                # Start production server
npm run db:push              # Push schema to database
npm run db:studio            # Open Drizzle Studio
npm run db:migrate           # Run migrations

Production Deployment

Deploy to Vercel

vercel --prod

Configure Production Environment

  1. Add all .env.local variables to Vercel
  2. Update NEXT_PUBLIC_APP_URL to your domain
  3. Set NODE_ENV=production

Run Migrations

npm run db:push

Troubleshooting

Authentication Error: "relation 'user' does not exist"

If you see this error, Better Auth tables haven't been created. Run:

# Generate Better Auth schema
npx @better-auth/cli generate --config better-auth.config.ts

# Push the schema to database
npm run db:push

Common Issues

  • Auth Issues: Ensure BETTER_AUTH_SECRET is set and matches between deploys
  • Database Errors: Run npm run db:push to sync schema
  • Billing Issues: Check Autumn products are created with correct IDs
  • Email Failures: Verify Resend domain and EMAIL_FROM address
  • Brand Monitor: Ensure FIRECRAWL_API_KEY is valid

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Resources

License

MIT License - see LICENSE file for details

About

AI brand visibility monitoring across ChatGPT, Claude, Perplexity & Gemini. GEO & AEO SaaS for brand tracking, competitor analysis, and AI search optimization. Built with Next.js, Firecrawl, auth, and billing.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 96.8%
  • CSS 1.7%
  • JavaScript 1.2%
  • HTML 0.3%