Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Wikedhart18/nextjs-ai-chatbot/llms.txt

Use this file to discover all available pages before exploring further.

This guide walks you through cloning the repository, configuring environment variables, running database migrations, and starting the development server.

Prerequisites

Before you begin, make sure you have the following:
  • Node.js v18 or later
  • pnpm package manager
  • A PostgreSQL database (e.g. local Postgres, Neon, or Supabase)
  • An OpenAI API key — used for the default gpt-4o chat model
  • A Fireworks AI API key — used for reasoning models
1

Clone the repository

git clone https://github.com/Wikedhart18/nextjs-ai-chatbot.git
cd nextjs-ai-chatbot
2

Install dependencies

pnpm install
3

Set up environment variables

Copy .env.example to .env.local and fill in your values:
cp .env.example .env.local
# Get your OpenAI API Key here for chat models: https://platform.openai.com/account/api-keys
OPENAI_API_KEY=your_openai_api_key

# Get your Fireworks AI API Key here for reasoning models: https://fireworks.ai/account/api-keys
FIREWORKS_API_KEY=your_fireworks_api_key

# Generate a random secret: https://generate-secret.vercel.app/32 or `openssl rand -base64 32`
AUTH_SECRET=your_auth_secret

# Instructions to create a Vercel Blob Store here: https://vercel.com/docs/storage/vercel-blob
BLOB_READ_WRITE_TOKEN=your_blob_read_write_token

# Instructions to create a database here: https://vercel.com/docs/storage/vercel-postgres/quickstart
POSTGRES_URL=your_postgres_connection_url
Never commit your .env.local file to version control. It contains secrets that grant access to your OpenAI account, database, and authentication provider.
BLOB_READ_WRITE_TOKEN and POSTGRES_URL are created automatically when you deploy to Vercel and add the Vercel Blob and Vercel Postgres storage integrations. For local development, create these resources manually and paste the connection values here.
4

Run database migrations

Drizzle reads POSTGRES_URL from .env.local and applies the schema defined in lib/db/schema.ts:
pnpm db:migrate
Migrations are also run automatically as part of pnpm build (tsx lib/db/migrate && next build), so you only need to run this command explicitly during local development.
5

Start the development server

pnpm dev
The app uses Next.js with Turbopack (next dev --turbo) for fast local rebuilds.
6

Open the app and create an account

Navigate to http://localhost:3000 in your browser.Register a new account, then start a conversation to verify everything is working.

Build docs developers (and LLMs) love