A full-stack AI chat Todo app built with Next.js, ZenStack, and Vercel AI SDK. The app demonstrates how to easily add AI-chat feature for the application with minimal code using ZenStack's powerful data modeling and access control.
- User Signup/Signin - User authentication with NextAuth
- AI Chat Todo Management - Chat assistant to manage todos safely
This project showcases how to quickly build AI chat functionality with minimal code:
- Schema-Driven Development: The
schema.zmodel
defines your data models and permissions - Generated CRUD Operations: The
@core/zod
plugin automatically generates Zod schemas for input arguments of authorized CRUD operations - Streamlined Development: Connect AI models to your data with minimal boilerplate
- Next.js - React framework
- ZenStack - Full-stack toolkit with access control
- NextAuth - Authentication for Next.js
- AI SDK - AI integration for chat features
-
Install dependencies
npm install
-
Configure environment variables Rename
.env.example
to.env
and replace your OpenAI Key with:OPENAI_API_KEY="write-your-openai-api-key-here"
If you want to use a different LLM provider rather than OpenAI, You can easily change it in the
src/app/api/chat/route.ts
follow the AI SDK Providers Doc. -
Generate Prisma client and Zod schemas
npm run generate
-
Synchronize database schema
npm run db:push
-
Seed the database It create 3 users with todos. The password for all users is
123456
.- Alex (Backend Dev): alex@zenstack.dev - Taylor (FrontEnd Dev): taylor@zenstack.dev - Morgan (Product Lead): morgan@zenstack.dev
npm run db:seed
-
Start the development server
npm run dev