Live Demo recording:
DEMO:
Screen.Recording.2025-09-05.at.5.56.34.PM.mov
This is a modern, full-stack AI-powered chat application featuring:
- Real-time chat (Stream Chat)
- AI writing assistant (OpenAI)
- Live web search (Tavily API)
- Beautiful, responsive UI (React, Tailwind CSS)
The app helps with content creation, research, and collaboration.
- Real-time chat using GetStream.io
- AI writing assistant powered by OpenAI GPT-4
- Live web search via Tavily API
- Modern React UI with dark/light theme
- Categorized writing prompts
- Dynamic AI agent management
- Secure JWT authentication
- Mobile-first, responsive design
- Node.js/Express server
- Stream Chat integration
- OpenAI API for AI responses
- Tavily API for web search
- Agent management system
- React (TypeScript)
- Stream Chat React components
- Tailwind CSS and shadcn/ui
- Vite for development/build
- Node.js 20+
- npm or yarn
- GetStream.io account
- OpenAI API account
- Tavily API account
git clone <your-repository-url>
cd AI-agent-chat-appNavigate to the backend directory:
cd nodejs-ai-assistantInstall dependencies:
npm installCreate environment file by copying the example:
cp .env.example .envConfigure your .env file with the following keys:
# GetStream credentials - Get these from https://getstream.io/dashboard
STREAM_API_KEY=your_stream_api_key_here
STREAM_API_SECRET=your_stream_api_secret_here
# OpenAI API key - Get from https://platform.openai.com/api-keys
OPENAI_API_KEY=your_openai_api_key_here
# Tavily API key - Get from https://tavily.com
TAVILY_API_KEY=your_tavily_api_key_hereNavigate to the frontend directory:
cd ../react-stream-ai-assistantInstall dependencies:
npm installCreate environment file:
cp .env.example .envConfigure your .env file:
# Stream Chat Configuration
VITE_STREAM_API_KEY=your_stream_api_key_here
# Backend URL
VITE_BACKEND_URL=http://localhost:3000- Sign up at GetStream.io
- Create a new Chat application
- Copy your API Key and API Secret from the dashboard
- Use the same API Key in both backend and frontend
.envfiles
- Sign up at OpenAI Platform
- Navigate to API Keys section
- Create a new API key
- Add it to your backend
.envfile
- Sign up at Tavily
- Get your API key from the dashboard
- Add it to your backend
.envfile
cd nodejs-ai-assistant
npm run devThe backend will run on http://localhost:3000
cd react-stream-ai-assistant
npm run devThe frontend will run on http://localhost:8080
GetStream.io is a cloud-based API service that provides real-time chat functionality. Here's how it integrates with our app:
- Stream Chat Client: Handles all chat operations and real-time updates
- Channels: Individual chat rooms where messages are exchanged
- Users: Authenticated participants in the chat
- Messages: Text, files, reactions, and custom data
- Tokens: JWT-based authentication for secure access
graph TD
A[Frontend React App] --> B[Stream Chat React Components]
B --> C[Stream Chat API]
C --> D[Backend Node.js Server]
D --> E[OpenAI API]
D --> F[Tavily Web Search]
D --> G[AI Agent Management]
- Real-time Messaging: Instant message delivery and updates
- User Presence: Online/offline status indicators
- Channel Management: Create, join, and manage chat channels
- Message Threading: Support for threaded conversations
- File Uploads: Share images and documents
- Custom Fields: Extended message and user data
- Webhooks: Server-side event handling
The application features a flexible AI agent management system:
- Creation: AI agents are created per channel when requested
- Initialization: OpenAI assistant setup with web search capabilities
- Message Handling: Processes user messages and generates responses
- Web Search: Automatically searches the web for current information
- Cleanup: Automatic disposal after inactivity
- Content Writing: Various writing tasks from business to creative
- Web Research: Live search for current information and facts
- Context Awareness: Maintains conversation context
- Customizable Prompts: Specialized writing assistance
The frontend uses modern UI components built with:
- Radix UI: Accessible component primitives
- Tailwind CSS: Utility-first CSS framework
- shadcn/ui: Beautiful, customizable components
- Lucide React: Modern icon library
- Dark Mode Support: System preference detection
GET /- Health check and server statusPOST /start-ai-agent- Initialize AI agent for a channelPOST /stop-ai-agent- Stop and cleanup AI agentGET /agent-status- Check AI agent statusPOST /token- Generate user authentication tokens
- JWT Authentication: Secure token-based authentication
- Environment Variables: Sensitive data protection
- CORS Configuration: Cross-origin request security
- Token Expiration: Automatic token refresh system
- Input Validation: Server-side validation for all requests
- Set environment variables on your hosting platform
- Run
npm run startfor production - Ensure PORT is configured (defaults to 3000)
- Run
npm run buildto create production build - Deploy the
distfolder to your static hosting service - Configure environment variables for production
cd nodejs-ai-assistant
npm run dev # Starts with nodemon for auto-reloadcd react-stream-ai-assistant
npm run dev # Starts Vite dev server# Backend
cd nodejs-ai-assistant
npm run start
# Frontend
cd react-stream-ai-assistant
npm run build- Node.js - Runtime environment
- Express - Web framework
- Stream Chat - Real-time messaging
- OpenAI - AI language model
- Axios - HTTP client
- CORS - Cross-origin resource sharing
- TypeScript - Type safety
- React - UI library
- TypeScript - Type safety
- Vite - Build tool
- Stream Chat React - Chat UI components
- Tailwind CSS - Styling
- Radix UI - Accessible components
- React Hook Form - Form handling
- React Router - Navigation
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- ✅ Commercial use - You can use this project for commercial purposes
- ✅ Modification - You can modify the source code
- ✅ Distribution - You can distribute the original or modified code
- ✅ Private use - You can use this project privately
- ❗ License and copyright notice - Include the license and copyright notice in copies
- ❌ Liability - The authors are not liable for any damages
- ❌ Warranty - No warranty is provided
For support and questions:
- Check the GetStream.io Documentation
- Review OpenAI API Documentation
- Create an issue in this repository
Built by Rishabh Mishra....