A full-stack, authenticated chat application built with Nuxt 4. Users sign in with GitHub, organize conversations into projects, and generate or stream responses from OpenAI.
Live demo: nuxt-chat-psi.vercel.app
- GitHub OAuth sign-in with server-side sessions
- Per-user chat and project management
- OpenAI-powered response generation and streaming
- PostgreSQL persistence through Prisma
- Standard Nuxt directories for UI, authentication, and chat concerns
- Vercel-ready production configuration
- Nuxt 4, Vue 3, and TypeScript
- Nuxt UI
- Prisma with PostgreSQL
- nuxt-auth-utils and GitHub OAuth
- AI SDK with OpenAI
- pnpm
- Node.js 20.19 or later (Node.js 22 LTS recommended)
- pnpm 10.28.0
- A PostgreSQL database
- A GitHub OAuth App
- An OpenAI API key
Enable Corepack before installing dependencies if pnpm is not already available:
corepack enable
corepack prepare pnpm@10.28.0 --activateInstall dependencies. The postinstall script generates the Prisma Client and prepares Nuxt types automatically.
pnpm installCreate a .env file in the project root:
# PostgreSQL / Supabase
# Runtime URL. For Vercel or another serverless host, use the Supavisor
# transaction-pooler URL (port 6543) and append ?pgbouncer=true.
DATABASE_URL="postgresql://USER:PASSWORD@HOST:5432/DATABASE?schema=public"
# Prisma CLI URL. Use Supabase's direct URL, or its session-pooler URL (port 5432)
# when the direct endpoint is unavailable from your network.
DIRECT_URL="postgresql://USER:PASSWORD@HOST:5432/DATABASE?schema=public"
# nuxt-auth-utils session encryption; use a long, random value (32+ characters)
NUXT_SESSION_PASSWORD="replace-with-a-long-random-secret"
# GitHub OAuth App credentials
NUXT_OAUTH_GITHUB_CLIENT_ID=""
NUXT_OAUTH_GITHUB_CLIENT_SECRET=""
# OpenAI
NUXT_OPENAI_API_KEY=""Create and apply the database schema:
pnpm prisma migrate devStart the development server:
pnpm devThe app is available at http://localhost:3000. Set the GitHub OAuth App callback URL to:
http://localhost:3000/auth/github
| Command | Purpose |
|---|---|
pnpm dev |
Start the development server. |
pnpm build |
Create a production build. |
pnpm preview |
Run the production build locally. |
pnpm generate |
Generate a static site. |
pnpm lint |
Run ESLint. |
pnpm lint:fix |
Run ESLint and apply safe fixes. |
pnpm typecheck |
Run Nuxt and TypeScript type checks. |
pnpm prisma migrate dev |
Create and apply a development migration. |
pnpm prisma generate |
Regenerate the Prisma Client. |
Run the same quality checks expected before deployment with:
pnpm lint && pnpm typecheck && pnpm build-
Import the repository into Vercel.
-
Set the project Node.js version to Node.js 20.19 or later.
-
Add the environment variables listed above for the appropriate environments. Use your production callback URL for
NUXT_OAUTH_GITHUB_CLIENT_ID/NUXT_OAUTH_GITHUB_CLIENT_SECRET, and registerhttps://YOUR_DOMAIN/auth/githubin the GitHub OAuth App. -
Configure a PostgreSQL database and set
DATABASE_URLandDIRECT_URL. With Supabase, use the Transaction pooler URL (port6543, with?pgbouncer=true) forDATABASE_URL, and a Direct or Session pooler URL (port5432) forDIRECT_URL. -
Connect the Vercel KV integration required by the production Nitro storage configuration.
-
In Settings → Build and Deployment, override the Build Command with:
pnpm lint && pnpm typecheck && pnpm build
This makes Vercel fail a Preview or Production deployment when linting, type checking, or the build fails.
app/ # Pages, layouts, components, composables, and styles
server/ # APIs, repositories, services, routes, and utilities
shared/ # Shared TypeScript types
prisma/ # Prisma schema and migrations
public/ # Static assets
Update prisma/schema.prisma, then create a migration:
pnpm prisma migrate dev --name describe-your-changeCommit the generated migration under prisma/migrations/. In production, apply committed migrations through your deployment workflow with pnpm prisma migrate deploy.
No license has been specified for this repository.