Skip to content

Dev-Soft-source/next_chatbot_proj

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chatbot

Chatbot is a Next.js + AI SDK starter for building chat applications with model routing, auth, and persistent storage.

Tech Stack

  • Next.js (App Router)
  • AI SDK
  • Auth.js
  • Drizzle ORM + Postgres
  • Vercel AI Gateway
  • Vercel Blob (optional)
  • Redis (optional)

Prerequisites

  • Node.js 20+
  • pnpm 10+

Install pnpm if needed:

npm install -g pnpm

Environment Variables

Copy .env.example to .env.local:

cp .env.example .env.local

On Windows PowerShell:

Copy-Item .env.example .env.local

Then replace all **** values in .env.local.

Required (local development)

  • AUTH_SECRET - session and auth encryption secret
  • AI_GATEWAY_API_KEY - required when running outside Vercel
  • POSTGRES_URL - required for DB operations and migrations

Optional (can run without these initially)

  • REDIS_URL - enables production rate limiting/resumable stream support
  • BLOB_READ_WRITE_TOKEN - required for blob/file storage features

Important: this project reads migrations from .env.local (lib/db/migrate.ts), so setting only .env is not enough for pnpm db:migrate.

Local Quickstart

pnpm install
pnpm db:migrate
pnpm dev

Open http://localhost:3000.

Common Commands

  • pnpm dev - run development server
  • pnpm build - run migrations and build production app
  • pnpm start - start production server
  • pnpm db:migrate - apply database migrations
  • pnpm db:studio - open Drizzle Studio
  • pnpm check - run lint/check tools
  • pnpm fix - auto-fix issues where possible

Model Providers

This app uses Vercel AI Gateway to route models defined in lib/ai/models.ts.

  • On Vercel: OIDC auth is handled automatically.
  • Locally/non-Vercel: you must set AI_GATEWAY_API_KEY.

You can also switch to direct providers via AI SDK if desired.

Deploy

Deploy on Vercel using the template:

Deploy with Vercel

Troubleshooting

POSTGRES_URL not defined, skipping migrations

Cause: pnpm db:migrate cannot find POSTGRES_URL in .env.local.

Fix:

  1. Ensure .env.local exists.
  2. Add POSTGRES_URL=... to .env.local.
  3. Re-run pnpm db:migrate.

AI Gateway authentication errors locally

Set AI_GATEWAY_API_KEY in .env.local and restart the dev server.

Security Notes

  • Never commit .env, .env.local, or real secrets.
  • Keep .env.example with placeholders only.

About

Chatbot is a Next.js + AI SDK starter for building chat apps. It uses Vercel AI Gateway for model routing, Auth.js for authentication, Drizzle ORM with Postgres for persistence, and optional Redis and Vercel Blob for rate limiting/resumable streams and file storage. Configure secrets via .env.local and run with pnpm install, pnpm db:migrate, and pn

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors