A modern, privacy-first AI chat application with enterprise-grade security
VTChat is a production-ready, privacy-focused AI chat application delivering cutting-edge AI capabilities through a sophisticated dual-tier subscription system. Built with modern web technologies and a privacy-first architecture, VTChat offers advanced AI reasoning, document processing, web search integration, and comprehensive multi-AI provider support.
- Reasoning Mode (VT+ exclusive): Complete AI SDK reasoning tokens support with transparent thinking process
- 9 Free AI Models: Gemini 2.0/2.5 Flash series + OpenRouter models (DeepSeek V3, DeepSeek R1, Qwen3 14B)
- Multi-AI Provider Support: OpenAI, Anthropic, Google, Fireworks, Together AI, and xAI integration
- Document Processing (VT+ exclusive): Upload and analyze PDF, DOC, DOCX, TXT, MD files (up to 10MB)
- Structured Output Extraction (VT+ exclusive): AI-powered JSON data extraction from documents
- Web Search Integration (VT+ exclusive): Grounding capabilities with real-time information
- Mathematical Calculator: Advanced functions including trigonometry, logarithms, and arithmetic
- Local-First Storage: All chat data stored in browser's IndexedDB via Dexie.js
- Zero Server Storage: Conversations never leave the user's device
- Multi-User Isolation: Complete data separation on shared devices
- Enterprise-Grade Security: Secure authentication with Better Auth
- Advanced Application Security: Arcjet protection with rate limiting, bot detection, email validation, and WAF
- VT_BASE (Free): 9 AI models, calculator, basic chat, local privacy
- VT_PLUS ($10/month): All free features + reasoning mode, dark theme, web search, document upload, structured extraction
- Seamless Management: Creem.io integration with customer portal
- Shadcn UI Design System: Consistent, accessible interface
- Dark Mode (VT+ exclusive): Premium theming experience
- Responsive Design: Optimized for desktop and mobile
- 87% Performance Improvement: Faster compilation and load times
VTChat utilizes a Turborepo-managed monorepo structure:
vtchat/
βββ apps/
β βββ web/ # Next.js 14 web application (App Router)
βββ packages/
β βββ actions/ # Server actions (e.g., feedback)
β βββ ai/ # AI models, providers, tools, workflow logic
β βββ common/ # Shared React components, hooks, context, store
β βββ orchestrator/ # Workflow engine and task management
β βββ shared/ # Shared types, constants, configs, utils, logger
β βββ tailwind-config/ # Shared Tailwind CSS configuration
β βββ typescript-config/# Shared TypeScript configurations
β βββ ui/ # Base UI components (from Shadcn UI)
βββ docs/ # Documentation and guides
βββ memory-bank/ # Project context and evolution tracking
βββ scripts/ # Utility scripts (e.g., data sync)
- Framework: Next.js 14 (App Router) with TypeScript
- Styling: Tailwind CSS + Shadcn UI design system
- State Management: Zustand + React Query
- Animations: Framer Motion
- Icons: Lucide React
- Database: Neon PostgreSQL with Drizzle ORM
- Authentication: Better Auth (modern session management)
- Application Security: Arcjet protection (rate limiting, bot detection, attack prevention)
- Payment Processing: Creem.io integration
- Local Storage: IndexedDB via Dexie.js
- Deployment: Fly.io (production-ready)
- Runtime: Bun (package manager + JavaScript runtime)
- Monorepo: Turborepo with optimized caching
- Testing: Vitest with Testing Library
- Linting: oxlint (faster than ESLint)
- Type Checking: TypeScript with strict configuration
- AI Providers: OpenAI, Anthropic, Google, Fireworks, Together AI, xAI
- AI SDK: Vercel AI SDK with reasoning tokens support
- Document Processing: Multi-format file analysis
- Web Search: Real-time grounding capabilities
- Bun (JavaScript runtime and package manager) - v1.1.19 or higher
- Node.js (for some Turborepo operations, though Bun is primary)
- Git for version control
-
Clone the repository:
git clone https://github.com/vinhnx/vtchat.git cd vtchat
-
Install dependencies:
bun install
-
Set up environment variables:
cp apps/web/.env.example apps/web/.env.local
Configure the following required variables in
apps/web/.env.local
:Essential Services:
DATABASE_URL
- Neon PostgreSQL connection stringBETTER_AUTH_SECRET
- Authentication secret keyBETTER_AUTH_URL
- Authentication URL (http://localhost:3000 for development)
AI Provider Keys (choose one or more):
OPENAI_API_KEY
- OpenAI API accessANTHROPIC_API_KEY
- Anthropic Claude API accessGOOGLE_API_KEY
- Google Gemini API access
Payment & Subscription:
CREEM_WEBHOOK_SECRET
- Creem.io webhook validationCREEM_API_KEY
- Creem.io API accessCREEM_PRODUCT_ID
- VT Plus subscription product ID
Security:
ARCJET_KEY
- Application security and rate limitingNEXT_PUBLIC_BASE_URL
- Application base URL
-
Set up the database:
cd apps/web bun run generate # Generate database schema
-
Start the development server:
bun dev
-
Open the application: Navigate to
http://localhost:3000
in your browser.
# Development
bun dev # Start development server with Turbopack
bun build # Build for production
bun start # Start production server
bun test # Run tests
bun test:coverage # Run tests with coverage
# Code Quality
bun lint # Lint with oxlint
bun format # Format code with Prettier
bun format:check # Check code formatting
# Database
cd apps/web
bun run generate # Generate Drizzle schema
The application requires several environment variables for full functionality. Refer to apps/web/.env.example
for the complete list. Key configurations include:
- Database: Neon PostgreSQL for user data and subscriptions
- Authentication: Better Auth for secure session management
- AI Providers: Support for multiple AI APIs
- Payment: Creem.io for subscription management
- Security: Arcjet for application protection
VTChat implements a dual-tier system:
- VT_BASE: Free tier with access to 9 AI models
- VT_PLUS: Premium tier ($10/month) with advanced features
VTChat is production-ready and deployed on Fly.io:
- URL: https://vtchat.io.vn
- Infrastructure: Fly.io with 2-region setup (Singapore primary, Virginia secondary)
- Performance: 87% faster compilation, optimized bundle size
- Security: Enterprise-grade security with Arcjet protection
- Monitoring: Comprehensive error tracking and performance monitoring
- Memory: 1GB RAM per instance
- CPU: 1 shared CPU
- Regions: Asia-Pacific (primary), USA East (secondary)
- Health Checks: HTTP and TCP monitoring
- Auto-scaling: Suspend/resume based on traffic
- Production Deployment Checklist: Comprehensive pre-deployment verification
- Production Monitoring Setup: Error tracking, performance monitoring, and alerting
- Final Release Notes: Complete feature summary and achievements
- Final Project Report: Comprehensive technical and business analysis
- AGENT.md: Development guidelines and conventions
- Security Guide: Comprehensive Arcjet application security implementation
- Subscription System: Plan management, caching, and Creem.io integration
- Customer Portal: User subscription management interface
The /memory-bank
directory contains contextual documents tracking project evolution, feature implementations, and development insights for continuous improvement.
VTChat implements comprehensive security measures:
- Privacy-First: All conversations stored locally in IndexedDB
- Authentication: Better Auth with secure session management
- Application Security: Arcjet protection against bots, DDoS, and attacks
- Rate Limiting: Prevents abuse with intelligent rate limiting
- Data Protection: No server-side storage of sensitive chat data
- Secure Communication: HTTPS enforced, secure headers implemented
VTChat includes comprehensive testing:
# Run all tests
bun test
# Run tests with UI
bun test:ui
# Run tests with coverage
bun test:coverage
# Run specific test suites
bun test app/tests/rate-limit-simple.test.ts
Testing framework: Vitest with Testing Library for React components.
We welcome contributions! Please follow these guidelines:
- Fork the repository and create a feature branch
- Follow the coding standards defined in AGENT.md
- Write tests for new features
- Update documentation as needed
- Submit a pull request with a clear description
- Use TypeScript with strict configuration
- Follow the existing code style and patterns
- Ensure all tests pass before submitting
- Update AGENT.md with any significant changes
This project is licensed under the MIT License. See the LICENSE file for details.
- Zero TypeScript Errors: Complete type safety across the codebase
- 87% Performance Improvement: Optimized compilation and runtime
- Production-Ready: Deployed and running in production environment
- Security Hardened: Comprehensive protection against common threats
- Privacy-First: Industry-leading approach to user data protection
- Mobile app development (React Native)
- Additional AI provider integrations
- Advanced collaboration features
- Enhanced document processing capabilities
- API access for developers
Visit VTChat | View Documentation | Report Issues
Built with β€οΈ by the VTChat team