Skip to content

jiashengguo/zenstack-ai-chatbot

Repository files navigation

Image

ZenStack AI Chat Todo

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.

Features

  • User Signup/Signin - User authentication with NextAuth
  • AI Chat Todo Management - Chat assistant to manage todos safely

AI Chat Implementation

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

Technologies

  • Next.js - React framework
  • ZenStack - Full-stack toolkit with access control
  • NextAuth - Authentication for Next.js
  • AI SDK - AI integration for chat features

Getting Started

Installation

  1. Install dependencies

    npm install
  2. 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.

  3. Generate Prisma client and Zod schemas

    npm run generate
  4. Synchronize database schema

    npm run db:push
  5. 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
  6. Start the development server

    npm run dev

About

A full-stack AI chat Todo app built with Next.js, ZenStack, and Vercel AI SDK

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published