Docs
AI Starter Kit
Getting Started

AI Starter Kit

A starter kit for building AI applications using Next.js (opens in a new tab), Vercel AI SDK (opens in a new tab), Drizzle ORM (opens in a new tab), and PostgreSQL.

Getting Started

We are using npm as our package manager.

To use Yarn or any other package manager, delete the package-lock.json file and run the below commands using the package manager of your choice.

  1. Install dependencies
npm install
  1. Rename .env.example to .env and set the environment variables
.env
DATABASE_URL="postgresql://..."
 
OPENAI_API_KEY=
 
# Auth ------
AUTH_SECRET=
NEXTAUTH_URL=
 
AUTH_GOOGLE_ID=
AUTH_GOOGLE_SECRET=
 
AUTH_GITHUB_ID=
AUTH_GITHUB_SECRET=
 
NEXT_PUBLIC_DEMO_AUTH_EMAIL=
NEXT_PUBLIC_DEMO_AUTH_PASSWORD=
 
# SMTP -------
EMAIL_SERVER_HOST=
EMAIL_SERVER_PORT=
EMAIL_SERVER_USER=
EMAIL_SERVER_PASSWORD=
EMAIL_FROM=
 
# Stripe -----
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=
STRIPE_SECRET_KEY=
STRIPE_PRODUCT_ID=
STRIPE_WEBHOOK_SECRET=
 
NEXT_PUBLIC_PLUS_MONTHLY_PRICE_ID=
NEXT_PUBLIC_PLUS_YEARLY_PRICE_ID=
NEXT_PUBLIC_PRO_MONTHLY_PRICE_ID=
NEXT_PUBLIC_PRO_YEARLY_PRICE_ID=
  1. Migrate the database
npm run db:generate # Generate the migrations
npm run db:migrate # Apply migrations to the database

Alternatively, you can use the following command to directly apply changes to the database.

npm run db:push
  1. Running locally

Install (opens in a new tab) and log in to your Stripe account:

stripe login

Now run the Next.js development server:

npm run dev

Open http://localhost:3000 (opens in a new tab) in your browser to see the app in action.

You can listen for Stripe webhooks locally through their CLI to handle subscription change events:

stripe listen --forward-to localhost:3000/api/webhooks/stripe

Features