A powerful chatbot application built with modern web technologies, supporting multiple AI models and rich interactive features.
中文版 | English
Simple Chatbot is a full-featured AI chat application that allows users to converse with multiple AI models. The application supports models from various AI providers including OpenAI, Anthropic, Google AI, Mistral, Groq, and can also connect to locally run Ollama models.
- 🤖 Support for multiple AI models: Including GPT-4o, Claude 3.5/3.7, Gemini 1.5/2.0, Grok 3, Llama, and more
- 🔄 Real-time streaming responses: Providing immediate feedback through streaming
- 💬 Chat history: Save and manage all chat sessions
- 📊 Multi-model switching: Easily switch between different AI models during conversation
- 🔒 User authentication: Secure user authentication system integrated with Better Auth
- 🌐 Local model support: Connect to locally running Ollama models
- 📱 Responsive design: Adapts to various device screen sizes
- 🔍 Resumable session streams: Support for conversation flows with resumption capability
- Frontend Framework: Next.js 15
- UI Components: Shadcn + Tailwind CSS
- State Management: React Query
- Database: PostgreSQL + Drizzle ORM
- Authentication: Better Auth
- AI Integration: AI SDK (supporting multiple AI providers)
- API Routes: Hono
- Node.js 18+
- PostgreSQL database
- API key from at least one AI service provider (OpenAI, Anthropic, etc.)
- Create a PostgreSQL database and configure your environment variables
Create a .env file and set the following variables:
# Authentication secret (generate at the link below)
BETTER_AUTH_SECRET=""
# Database connection string
DATABASE_URL="postgresql://username:password@localhost:5432/chatbot_db"
# AI provider API keys (add as needed)
OPENAI_API_KEY=""
ANTHROPIC_API_KEY=""
GOOGLE_AI_API_KEY=""
MISTRAL_API_KEY=""
GROQ_API_KEY=""
# Optional: Ollama connection (local AI models)
OLLAMA_BASE_URL="http://localhost:11434"You can generate a BETTER_AUTH_SECRET here.
- Install dependencies
npm install
# or
yarn install
# or
pnpm install
# or
bun install- Generate schema and perform migrations
# Generate auth schema
npx @better-auth/cli generate
# Generate Drizzle schema
npx drizzle-kit generate
# Run database migrations
npx drizzle-kit migratenpm run dev
# or
yarn dev
# or
pnpm dev
# or
bun devOpen http://localhost:3000 with your browser to see the application.
The project provides the following database management commands:
# Generate database schema
npm run db:generate
# Execute database migrations
npm run db:migrateThe easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
- Push your code to a GitHub repository
- Import the repository in Vercel
- Configure environment variables
- Deploy
Check out the Next.js deployment documentation for more details.
Issues and pull requests are welcome!