A modern, responsive AI chat interface built with React, TypeScript, and OpenAI
Features β’ Quick Start β’ Installation β’ Deployment β’ Contributing
| Status | Description |
|---|---|
| π’ Stable | Production ready |
| π’ Active | Regular updates |
| π’ Maintained | Bug fixes & features |
| π’ Documented | Comprehensive docs |
- β Core Features: Chat interface, API integration, error handling
- β UI/UX: Dark/light mode, responsive design, animations
- β Security: API key management, input validation
- β Performance: Optimized builds, lazy loading
- π Roadmap: See Issues for upcoming features
- Responsive Design: Works seamlessly on desktop, tablet, and mobile devices
- Dark/Light Mode: Toggle between beautiful dark and light themes
- Glass Morphism: Modern UI with backdrop blur effects and smooth animations
- Accessibility: Built with accessibility best practices in mind
- OpenAI Integration: Powered by GPT-4 for intelligent, contextual responses
- Smart Suggestions: Pre-built prompts for common use cases
- Context Awareness: Maintains conversation context throughout the chat
- Error Recovery: Intelligent retry mechanisms with fallback options
- User API Keys: Use your own OpenAI API key for personal use
- Server Fallback: Built-in server with default API key for easy setup
- Secure Storage: API keys stored securely in browser local storage
- Key Validation: Real-time API key testing and validation
- Fast Loading: Optimized bundle size and lazy loading
- Error Handling: Comprehensive error handling with user-friendly messages
- Retry Logic: Automatic retry mechanisms for failed requests
- Offline Support: Graceful degradation when offline
- TypeScript: Full type safety and excellent developer experience
- Modern Stack: React 18, Vite, Tailwind CSS, and more
- Hot Reload: Fast development with instant feedback
- ESLint & Prettier: Consistent code formatting and quality
Click to expand
β‘ Get up and running in under 5 minutes!
| Requirement | Version | Download |
|---|---|---|
| Node.js | β₯ 16.0.0 | Download |
| npm | Latest | Included with Node.js |
| OpenAI API Key | Any | Get Key |
# Clone, install, and start EchoAI
git clone https://github.com/droidbg/EchoAI.git && cd EchoAI && npm run setupNote: The
npm run setupscript will be added to automate the entire setup process.
git clone https://github.com/droidbg/EchoAI.git
cd EchoAI# Install client dependencies
cd client
npm install
# Install server dependencies
cd ../server
npm install# Copy environment templates
cp client/.env.example client/.env
cp server/.env.example server/.envEdit the environment files:
client/.env:
VITE_SERVER_URL=http://localhost:3080/server/.env:
OPENAI_API_KEY=sk-your-openai-api-key-here# Terminal 1: Start the server
cd server
npm start
# Terminal 2: Start the client
cd client
npm startVisit http://localhost:5173 to see EchoAI in action! π
This setup includes both the React frontend and Node.js backend:
# Clone and setup
git clone https://github.com/droidbg/EchoAI.git
cd EchoAI
# Install all dependencies
npm run install:all
# Configure environment
cp client/.env.example client/.env
cp server/.env.example server/.env
# Start both client and server
npm run devIf you prefer to use your own backend or API:
# Clone and setup client only
git clone https://github.com/droidbg/EchoAI.git
cd EchoAI/client
# Install dependencies
npm install
# Configure environment
cp .env.example .env
# Start client
npm startFor deploying just the backend:
# Clone and setup server only
git clone https://github.com/droidbg/EchoAI.git
cd EchoAI/server
# Install dependencies
npm install
# Configure environment
cp .env.example .env
# Start server
npm start| Variable | Description | Default | Required |
|---|---|---|---|
VITE_SERVER_URL |
Backend server URL | http://localhost:3080/ |
Yes |
VITE_DEBUG |
Enable debug mode | false |
No |
| Variable | Description | Default | Required |
|---|---|---|---|
OPENAI_API_KEY |
Your OpenAI API key | - | Yes |
PORT |
Server port | 3080 |
No |
NODE_ENV |
Environment mode | development |
No |
CLIENT_URL |
Client URL for CORS | - | No (production) |
-
Get an OpenAI API Key:
- Visit OpenAI Platform
- Create a new API key
- Copy the key (starts with
sk-orsk-proj-)
-
Add to EchoAI:
- Click the settings gear icon in the top-right corner
- Paste your API key in the "Your OpenAI API Key" field
- Click "Save Key"
- The system will test your key automatically
-
Add to Server Environment:
# In server/.env OPENAI_API_KEY=sk-your-openai-api-key-here -
Restart the Server:
cd server npm start
- Start a Conversation: Type your message in the input field
- Send Message: Press Enter or click the send button
- View Response: The AI response will appear in the chat
- Continue Chatting: Keep the conversation going naturally
EchoAI provides helpful suggestions to get you started:
- "Explain quantum computing" - Get explanations of complex topics
- "Write a creative story" - Generate creative content
- "Help with coding" - Get programming assistance
- "Plan a vacation" - Get travel planning help
When errors occur, EchoAI provides helpful options:
- Try Again: Retry the failed request
- Use Your API Key: Switch to your personal API key
- Clear Error: Dismiss the error and continue
Access settings by clicking the gear icon:
- API Key Management: Add, test, or remove your API key
- Theme Toggle: Switch between dark and light modes
- Key Status: See which API key is currently active
client/
βββ src/
β βββ components/ # React components
β β βββ AiChat.tsx # AI message display
β β βββ ChatBody.tsx # Main chat container
β β βββ ChatInput.tsx # Message input
β β βββ SettingsModal.tsx # Settings interface
β β βββ TypingIndicator.tsx # Loading animation
β β βββ UserChat.tsx # User message display
β βββ utils/ # Utility functions
β β βββ Api.ts # API communication
β β βββ ApiKeyManager.ts # API key management
β βββ App.tsx # Main application
β βββ main.tsx # Application entry point
βββ public/ # Static assets
βββ package.json # Dependencies and scripts
server/
βββ index.js # Main server file
βββ package.json # Dependencies and scripts
βββ vercel.json # Vercel deployment config
βββ .env.example # Environment template
- React 18 - Modern React with hooks and concurrent features
- TypeScript - Type-safe JavaScript development
- Vite - Fast build tool and development server
- Tailwind CSS - Utility-first CSS framework
- React Query - Data fetching and state management
- Auto Animate - Smooth animations
- Node.js - JavaScript runtime
- Express - Web application framework
- OpenAI SDK - Official OpenAI API client
- CORS - Cross-origin resource sharing
- dotenv - Environment variable management
GET /Response:
{
"status": "healthy",
"service": "EchoAI Server",
"version": "1.0.0",
"timestamp": "2024-12-19T10:30:00.000Z",
"environment": "development"
}POST /
Content-Type: application/json
{
"message": "Hello, how are you?"
}Response:
{
"message": "Hello! I'm doing well, thank you for asking. How can I help you today?",
"usage": {
"prompt_tokens": 10,
"completion_tokens": 20,
"total_tokens": 30
},
"model": "gpt-4o-mini"
}Error Responses:
| Status | Error | Description |
|---|---|---|
| 400 | Invalid request | Missing or invalid message |
| 401 | Invalid API key | OpenAI API key is invalid |
| 402 | Insufficient quota | OpenAI API quota exceeded |
| 429 | Rate limit exceeded | Too many requests |
| 500 | Internal server error | Server-side error |
interface Message {
sender: 'user' | 'ai';
message: string;
isError?: boolean;
errorId?: string;
}// Fetch AI response
fetchResponse(messages: Message[]): Promise<{ message: string }>
// API Key Management
ApiKeyManager.getApiKey(): string | null
ApiKeyManager.setApiKey(key: string): void
ApiKeyManager.clearApiKey(): void
ApiKeyManager.validateApiKeyFormat(key: string): { isValid: boolean; message: string }
ApiKeyManager.testApiKey(key: string): Promise<{ isValid: boolean; message: string }># Install Vercel CLI
npm i -g vercel
# Deploy client
cd client
vercel
# Follow the prompts to configure# Deploy server
cd server
vercel
# Add environment variables in Vercel dashboard
# OPENAI_API_KEY=your-key-here# Install Railway CLI
npm i -g @railway/cli
# Login and deploy
railway login
railway init
railway up# Dockerfile for server
FROM node:18-alpine
WORKDIR /app
COPY server/package*.json ./
RUN npm ci --only=production
COPY server/ .
EXPOSE 3080
CMD ["npm", "start"]# Install PM2
npm i -g pm2
# Start server with PM2
cd server
pm2 start index.js --name echoai-server
pm2 startup
pm2 save# Server
OPENAI_API_KEY=sk-your-production-key
NODE_ENV=production
PORT=3080
CLIENT_URL=https://your-client-domain.com
# Client
VITE_SERVER_URL=https://your-server-domain.comWe welcome contributions to EchoAI! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and test them
- Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
# Fork and clone
git clone https://github.com/droidbg/EchoAI.git
cd EchoAI
# Install dependencies
npm run install:all
# Start development servers
npm run dev- Use TypeScript for all new code
- Follow ESLint and Prettier configurations
- Add JSDoc comments for complex functions
- Write meaningful commit messages
- Test your changes thoroughly
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- OpenAI for providing the amazing GPT models
- React Team for the excellent framework
- Vercel for the deployment platform
- All Contributors who help make EchoAI better
- Documentation: GitHub Wiki
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Security: Security Policy
Made with β€οΈ by the EchoAI Contributors
β Star us on GitHub β’ π Report Bug β’ π‘ Request Feature





