A modern React application built with Vite, TypeScript, and shadcn/ui that provides a user interface for interacting with the Streaming Avatar backend.
-
Persona Management
- View and update persona details
- Configure persona settings
- Manage persona's technical and personality traits
-
HeyGen Integration
- Create and manage avatar streaming sessions
- Real-time avatar interaction
- WebRTC-based video streaming
- Text-to-speech capabilities
-
AI Chat Integration
- Interactive chat with persona-based responses
- Gemini AI-powered conversations
- Context-aware responses
-
UI Features
- Modern, responsive design
- Real-time video display
- Session management controls
- Background removal toggle
- Dark/Light mode support
- React 19 with TypeScript
- Vite for build tooling
- Tailwind CSS for styling
- shadcn/ui for components
- WebRTC for video streaming
- Express.js server
- HeyGen API for avatar streaming
- Gemini AI for chat responses
Before you begin, ensure you have:
- Node.js (v18 or higher)
- npm (v9 or higher)
- HeyGen API credentials
- Gemini AI API key
- Clone the repository:
git clone <your-repo-url>
cd react-avatar-app
- Install dependencies:
npm install
- Set up environment variables:
Create a
.env
file in the root directory with:
VITE_API_URL=http://localhost:3000
VITE_GEMINI_API_KEY=your_gemini_api_key_here
npm run dev
The application will be available at http://localhost:5173
npm run build
npm run preview
npm run dev
- Start the Vite development servernpm run build
- Build the application for productionnpm run preview
- Preview the production buildnpm run lint
- Run ESLintnpm run format
- Format code with Prettier
The application integrates with the following backend endpoints:
GET /persona
- Get current persona detailsPOST /persona
- Update persona detailsGET /persona/config
- Get persona configurationPOST /persona/update
- Update persona configuration
POST /persona/heygen/init
- Initialize HeyGen botPOST /persona/heygen/session/create
- Create streaming sessionPOST /persona/heygen/session/start
- Start streaming sessionPOST /persona/heygen/text
- Send text to avatarPOST /persona/heygen/ice
- Handle WebRTC ICE candidatePOST /persona/heygen/session/stop
- Stop streaming session
POST /openai
- Initialize chat botPOST /openai/complete
- Get chat response
react-avatar-app/
├── src/
│ ├── components/ # Reusable UI components
│ ├── pages/ # Page components
│ ├── services/ # API service functions
│ ├── utils/ # Utility functions
│ ├── hooks/ # Custom React hooks
│ ├── types/ # TypeScript type definitions
│ ├── styles/ # Global styles
│ └── App.tsx # Main application component
├── public/ # Static assets
└── package.json # Project dependencies
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the ISC License.
- Your Name - Initial work
- Thanks to all contributors who have helped shape this project