Create a .env.local file in the root directory with the following variables:
# Database
DATABASE_URL="postgresql://username:password@localhost:5432/lead_magnet_db"
# Clerk Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key
CLERK_SECRET_KEY=your_clerk_secret_key
# OpenAI API
OPENAI_API_KEY=your_openai_api_key
# Next.js
NEXTAUTH_SECRET=your_nextauth_secret
NEXTAUTH_URL=http://localhost:3000- Install dependencies:
npm install- Set up the database:
npx prisma generate
npx prisma db push- Start the development server:
npm run devThis application uses OpenAI's GPT-4 to generate interactive calculators and forms from natural language prompts. Admins can describe what they want, and the AI will create a fully functional magnet with:
- Dynamic form fields (numbers, text, selects, checkboxes, sliders)
- Calculation logic
- Custom styling
- Lead capture functionality
- "Create a mortgage calculator with loan amount, interest rate, and term fields"
- "Build a BMI calculator that takes height and weight"
- "Make a ROI calculator for marketing campaigns"
- "Create a quiz to determine personality type"
/admin/create-magnet- AI magnet generator interface/magnet/[id]- Public magnet usage page/api/ai/generate-magnet- OpenAI integration/api/templates- Magnet management/api/leads- Lead capture and analytics