Prerequisites
Before installing PolyChat-AI, ensure you have the following installed on your system:Node.js
Version 18 or higherDownload from nodejs.org
Package Manager
npm or yarnIncluded with Node.js installation
Git
Latest versionDownload from git-scm.com
OpenRouter API Key
Free tier availableSign up at openrouter.ai
Verify Prerequisites
Check that you have the required versions installed:Installation Steps
Install Dependencies
Install all required npm packages:This will install the following key dependencies:
| Package | Version | Purpose |
|---|---|---|
| react | ^19.1.0 | UI framework |
| typescript | ~5.8.3 | Type safety |
| vite | ^7.0.4 | Build tool |
| tailwindcss | ^4.1.11 | Styling |
| zustand | ^5.0.7 | State management |
| @xenova/transformers | ^2.17.1 | Local embeddings for RAG |
The installation may take a few minutes depending on your internet connection. The @xenova/transformers package is particularly large as it includes ML models.
Open in Browser
Navigate to the local development URL:The PolyChat-AI application will load and display an onboarding modal on first launch.
Configure API Key
On first launch, you’ll need to configure your OpenRouter API key:
-
Get your API key from OpenRouter.ai:
- Sign up for a free account
- Navigate to the Keys section
- Click Create Key
- Copy your API key
- Enter the key in the onboarding modal that appears
- Verify the connection by selecting a model and sending a test message
- Open Settings (
Ctrl/Cmd + K) - Navigate to the API tab
- Enter your new API key
Project Structure
Understand the organization of the PolyChat-AI codebase:Key Files
- src/services/openRouter.ts: OpenRouter API integration for chat and image generation
- src/services/ragService.ts: Local embeddings using @xenova/transformers
- src/components/Chat/ChatInputModern.tsx: Main chat input component
- src/components/Chat/MessageBubbleModern.tsx: Message display component
- vite.config.ts: Vite configuration
vite.config.ts
Available Scripts
PolyChat-AI includes several npm scripts for development and production:| Command | Description |
|---|---|
npm run dev | Start development server with HMR |
npm run build | TypeScript type check + production build |
npm run preview | Preview the production build locally |
npm run lint | Check code quality with ESLint |
npm run format | Format code with Prettier |
Development Workflow
Configuration
Environment Variables
PolyChat-AI doesn’t require environment variables for local development. All configuration is done through the UI and stored in localStorage. However, if you’re deploying to production, you may want to pre-configure certain settings. Create a.env file in the root directory:
.env
Customizing Vite Configuration
To customize the build process, editvite.config.ts:
vite.config.ts
Troubleshooting
Common Installation Issues
Port 5173 already in use
Port 5173 already in use
If port 5173 is already occupied:
- Stop the process using port 5173
- Or change the port in
vite.config.ts:
npm install fails
npm install fails
If
npm install fails:- Clear npm cache:
npm cache clean --force - Delete
node_modulesandpackage-lock.json - Run
npm installagain - If still failing, try using Node.js LTS version
TypeScript errors on build
TypeScript errors on build
If you encounter TypeScript errors:
- Check that you’re using TypeScript ~5.8.3
- Delete
node_modulesand reinstall - Run
npx tsc --noEmitto see detailed errors
Slow initial load
Slow initial load
The first load may be slow due to:
- @xenova/transformers downloading ML models
- Vite optimizing dependencies
More Troubleshooting Help
View the complete troubleshooting guide for more solutions
Next Steps
Now that you have PolyChat-AI running locally:Quick Start Guide
Learn how to use PolyChat-AI effectively
Core Features
Explore all available features
Configuration
Customize PolyChat-AI to your preferences
Contributing
Learn how to contribute to the project
Deployment
Ready to deploy your own instance of PolyChat-AI?Deploy to Vercel (Recommended)
The easiest way to deploy PolyChat-AI is with Vercel:- Click the button above
- Connect your GitHub account
- Configure your project
- Deploy automatically
Build for Production
To build manually:dist/ directory that can be deployed to any static hosting service:
- Vercel
- Netlify
- GitHub Pages
- Cloudflare Pages
- AWS S3 + CloudFront