AI Ad Generator Guide
A complete guide to AI Ad Generator — the AI-powered platform for creating stunning advertisements.
What is AI Ad Generator?
AI Ad Generator is a powerful AI-powered platform that helps you create professional, high-converting advertisements in seconds. Just describe your product or service, and our advanced AI generates compelling ad copy tailored to your needs.
Tech Stack
- Framework: Next.js App Router with TypeScript
- Auth: Better Auth (GitHub + Google OAuth, email/password)
- Database: PostgreSQL with Drizzle ORM
- Payments: Stripe (subscriptions, one-time purchases, credit packages)
- AI Model: bytedance/seedance-2-mini
- UI: Tailwind CSS + Radix UI + Lucide icons
- i18n: next-intl (English + Chinese)
- Email: Resend with React Email templates
- Content: Fumadocs for documentation, MDX for blog
Quick Start
Prerequisites
- Node.js 18+
- pnpm (recommended)
- PostgreSQL database
Installation
git clone https://github.com/zhangst23/ai-ad-generator.git
cd ai-ad-generator
pnpm installEnvironment Setup
Copy the example environment file and fill in your values:
cp env.example .env.localKey environment variables:
# Database
DATABASE_URL=postgresql://user:password@localhost:5432/ai-ad-generator
# Auth
BETTER_AUTH_SECRET=your-secret-key
GITHUB_CLIENT_ID=your-github-client-id
GITHUB_CLIENT_SECRET=your-github-client-secret
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
# AI
NEXT_PUBLIC_KIE_API_KEY=your-kie-api-key
NEXT_PUBLIC_KIE_MODEL=bytedance/seedance-2-mini
# Stripe
STRIPE_SECRET_KEY=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...
# Email
RESEND_API_KEY=re_...Database Setup
Generate and run migrations:
pnpm db:generate
pnpm db:migrateStart Development
pnpm devVisit http://localhost:3000 to see your app.
Project Structure
src/
├── app/ # Next.js App Router pages
│ ├── api/ # API routes (auth, webhooks, etc.)
│ └── [locale]/ # Localized pages
├── components/ # React components
├── config/ # App configuration
├── db/ # Database schema and connection
├── lib/ # Utilities and shared code
├── credits/ # Credit system logic
├── payment/ # Stripe integration
├── mail/ # Email templates
├── ai/ # AI provider configuration
└── i18n/ # Internationalization configKey Features
AI Ad Generation
AI Ad Generator uses the bytedance/seedance-2-mini model to:
- Generate catchy taglines and headlines
- Create compelling ad copy for any product
- Optimize content for different advertising platforms
- Generate multiple variations for A/B testing
Authentication
Uses Better Auth with:
- GitHub and Google OAuth
- Email/password credentials
- Account linking
- Session management with caching
Payments (Stripe)
Supports multiple payment models:
- Subscriptions: Monthly and yearly plans (Free, Pro)
- One-time purchases: Lifetime access, credit packages
- Credits: Usage-based billing with monthly refresh
Internationalization
Built-in support for multiple languages:
- As-needed prefix strategy (default locale omitted from URL)
- Translation files in
messages/en.jsonandmessages/zh.json - Localized email templates
Credit System
Flexible credit management:
- Monthly credit refresh for subscribers
- Registration bonus credits
- Credit packages (Basic, Standard, Premium)
- Usage tracking with transaction history
Generating Ads
- Navigate to the AI Ad Generator page
- Select the AI model (bytedance/seedance-2-mini)
- Describe your product or service
- Click generate to receive professional ad copy
- Use the generated content for your campaigns
Common Tasks
Adding a New Page
- Create a new file in
src/app/[locale]/(marketing)/ - Add the route to
src/routes.ts - Add navigation links in
src/config/navbar-config.tsx
Adding a New Language
- Add locale config in
src/config/website.tsx - Create translation file in
messages/{locale}.json - Update i18n routing in
src/i18n/routing.ts
Deploying to Production
pnpm buildThe app is ready for deployment on Vercel, Docker, or any Node.js hosting platform.
Learn More
- Configuration Guide — Customize the template for your needs
- API Reference — Explore available endpoints and actions
AI Ad Generator Docs