RxChat is a next-generation AI chatbot built with Next.js 15, featuring MCP (Model Context Protocol) router integration, advanced code execution, and artifact generation capabilities.
Features · Technology Stack · AI Capabilities · Installation · Development · Deployment
- Next.js 15 with App Router and React Server Components
- TypeScript for type-safe development
- Tailwind CSS + shadcn/ui for modern UI components
- SWR for efficient data fetching and caching
- Drizzle ORM with PostgreSQL for robust data persistence
- MCP Router Integration - Model Context Protocol for enhanced tool connectivity
- Multi-Provider Support - OpenAI, Anthropic, Google Gemini, OpenRouter, xAI, and more
- Streaming Conversations - Real-time chat with AI models
- Function Calling - AI can use tools like weather, document creation, and search
- Code Execution - Run Python code with matplotlib support directly in chat
- Monaco Editor - Full-featured code editor with TypeScript IntelliSense
- Syntax Highlighting - Support for multiple programming languages
- Code Formatting - Automatic code formatting with Cmd+S
- Axios LSP Support - Enhanced autocompletion for HTTP requests
- Code Artifacts - Create, edit, and execute code snippets
- Text Documents - Rich text editing and collaboration
- Image Generation - AI-powered image creation and editing
- Spreadsheets - Data manipulation and visualization
- Version Control - Track changes and revert to previous versions
- NextAuth.js - Secure authentication system
- Passkey Support - Modern passwordless authentication
- Role-based Access - Admin, premium, regular, and free user tiers
- User Scoped Data - Isolated user data and permissions
- Prompt Templates - Create and manage reusable AI prompts
- Chat History - Persistent conversation storage
- Document Search - Full-text search across user documents
- Usage Analytics - Track model usage and costs
- Export/Import - Data portability features
- Next.js 15 - React framework with App Router
- React 19 - Latest React with concurrent features
- TypeScript - Type-safe JavaScript development
- Tailwind CSS - Utility-first CSS framework
- shadcn/ui - Modern React components
- Framer Motion - Smooth animations and transitions
- Drizzle ORM - Type-safe database toolkit
- PostgreSQL - Robust relational database
- NextAuth.js - Authentication solution
- Redis - Caching and session storage
- Vercel Blob - File storage solution
- AI SDK - Unified interface for LLM providers
- MCP Router - Model Context Protocol integration
- Monaco Editor - Advanced code editing
- Python Execution - vm2 for secure code execution
- Multiple LLM Providers - OpenAI, Anthropic, Google, etc.
- pnpm - Fast, disk space efficient package manager
- ESLint + Biome - Code linting and formatting
- Jest - Unit testing framework
- Playwright - End-to-end testing
- TypeScript - Static type checking
- OpenAI - GPT-4, GPT-3.5, DALL-E
- Anthropic - Claude models
- Google - Gemini 2.5 Flash (default)
- xAI - Grok models
- OpenRouter - Access to 100+ models
- Azure OpenAI - Enterprise AI services
RxChat features advanced MCP (Model Context Protocol) integration that allows AI models to:
- Connect to external tools and services
- Execute code safely in sandboxed environments
- Access real-time data sources
- Interact with databases and APIs
- Perform complex multi-step tasks
- Weather Information - Get current weather data
- Document Creation - Generate and edit documents
- Search Documents - Find information across user documents
- Code Execution - Run Python scripts with matplotlib support
- Suggestion Engine - AI-powered content improvements
- Node.js 18+
- pnpm (recommended) or npm/yarn
- PostgreSQL database
- Redis instance (optional, for caching)
Copy the environment variables from .env.example and configure them:
cp .env.example .env.localRequired environment variables:
# Generate a random secret: https://generate-secret.vercel.app/32 or `openssl rand -base64 32`
AUTH_SECRET=
# The following keys below are automatically created and
# added to your environment when you deploy on vercel
OPENROUTER_API_KEY=
POSTGRES_URL=
REDIS_URL=
MCP_ROUTER_SERVER_URL=https://router.mcprouter.app/sse
MCP_ROUTER_SERVER_API_KEY=
AZURE_RESOURCE_NAME=
AZURE_API_KEY=
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_S3_BUCKET_NAME=rxchat
AWS_S3_ENDPOINT=
AWS_S3_CUSTOM_DOMAIN=
MARKITDOWN_ADMIN_API_KEY=
UPSTASH_VECTOR_REST_URL=
UPSTASH_VECTOR_REST_TOKEN=- Install dependencies:
pnpm install- Start PostgreSQL (using Docker):
docker compose up -d- Run database migrations:
pnpm db:migrate- Start the development server:
pnpm devThe application will be available at http://localhost:3000.
# Development
pnpm dev # Start development server with Turbo
pnpm build # Build for production
pnpm start # Start production server
# Database
pnpm db:generate # Generate migration files
pnpm db:migrate # Run migrations
pnpm db:studio # Open Drizzle Studio
pnpm db:push # Push schema changes
# Code Quality
pnpm lint # Run ESLint and Biome
pnpm lint:fix # Fix linting issues
pnpm format # Format code with Biome
# Testing
pnpm test # Run Playwright E2E tests
pnpm test:unit # Run Jest unit tests
pnpm test:unit:watch # Run unit tests in watch mode├── app/ # Next.js app directory
│ ├── (auth)/ # Authentication pages
│ ├── (chat)/ # Chat interface
│ └── api/ # API routes
├── components/ # React components
│ ├── ui/ # Base UI components
│ └── input/ # Input-related components
├── lib/ # Shared utilities
│ ├── ai/ # AI provider configurations
│ ├── db/ # Database schema and queries
│ └── utils.ts # Utility functions
├── artifacts/ # Artifact type definitions
├── hooks/ # Custom React hooks
└── tests/ # Playwright tests
The application uses Drizzle ORM with PostgreSQL. Key tables include:
- Users - User accounts with roles and provider access
- Chats - Conversation threads with visibility settings
- Messages - Chat messages with parts and attachments
- Documents - Generated artifacts (text, code, images, sheets)
- Prompts - User-created prompt templates
- Suggestions - AI-generated content improvements
-
Fork this repository to your GitHub account
-
Deploy to Vercel:
- Connect your GitHub repository to Vercel
- Configure environment variables in Vercel dashboard
- Deploy automatically on every push
-
Configure integrations:
- Set up PostgreSQL database (Neon, Supabase, or Vercel Postgres)
- Configure blob storage (Vercel Blob)
- Set up Redis for caching (Upstash)
- Build the application:
pnpm build- Start the production server:
pnpm start- Sign up or log in to your account
- Start a new conversation
- Select your preferred AI model
- Type your message and press Enter
Users have multiple roles and can have different permissions to different models and providers:
- Admin - Full access to all models and system management
- Premium - Access to premium models and advanced features
- Regular - Standard model access with usage limits
- Free - Basic model access with restricted usage
We also support passkey login for secure, passwordless authentication that provides a modern and convenient login experience.
- Ask the AI to write Python code
- The AI will create a code artifact
- Click the "Run" button to execute the code
- View output including matplotlib plots
- Request document creation from the AI
- AI generates documents in various formats:
- Text documents with rich formatting
- Code files with syntax highlighting
- Spreadsheets with data
- Images generated by AI
- Click the prompt button in the input area
- Create new templates or select existing ones
- Templates can include TypeScript code for dynamic prompts
- Share templates with other users (if permitted)
- Available MCP tools are shown in the tools dropdown
- AI can automatically use tools based on conversation context
- Tools include weather data, search, document management, etc.
POST /api/chat- Send messages and receive AI responsesGET /api/chat- Retrieve chat historyDELETE /api/chat- Delete chat conversations
GET /api/document- Retrieve documents by IDPOST /api/document- Create or update documentsDELETE /api/document- Delete documents
GET /api/user- Get current user informationPATCH /api/user- Update user preferences
GET /api/prompts- Get user prompt templatesPOST /api/prompts- Create new prompt templatesPATCH /api/prompts- Update existing templatesDELETE /api/prompts- Delete prompt templates
pnpm test:unit # Run all unit tests
pnpm test:unit:watch # Run tests in watch mode
pnpm test:unit:coverage # Generate coverage reportpnpm test # Run Playwright E2E testsTest files are located in:
components/**/*.spec.tsx- Component unit teststests/- Playwright E2E tests
- Fork the repository
- Create a feature branch:
git checkout -b feature/new-feature - Make your changes and add tests
- Run the test suite:
pnpm test:unit && pnpm test - Commit your changes:
git commit -m 'Add new feature' - Push to the branch:
git push origin feature/new-feature - Submit a pull request
- Use TypeScript for all new code
- Follow the existing code style (enforced by Biome)
- Write unit tests for new components
- Update documentation as needed
- Test changes with multiple AI providers
This project is licensed under the RxChat Non-Commercial License. See the LICENSE file for details.
Key License Terms:
- ✅ Free for personal and educational use
- ✅ Modification and redistribution allowed with attribution
- ❌ Commercial use prohibited
- 📝 Original source must be credited
For commercial licensing inquiries, please contact us through GitHub Issues.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: See component READMEs in
components/directories
- Built with Next.js and Vercel AI SDK
- UI components from shadcn/ui
- Code editing powered by Monaco Editor
- Database toolkit by Drizzle ORM