A React + Vite starter template with AI Kit integration.
- React 18
- Vite for fast development
- TypeScript
- AI Kit React hooks
- Clean, modern UI
-
Install dependencies:
npm install
-
Create
.env:VITE_API_ENDPOINT=http://localhost:3001/api/chat
-
Start the backend (in another terminal):
cd server npm install npm start -
Start the frontend:
npm run dev
react-starter/
├── src/
│ ├── App.tsx # Main chat component
│ ├── App.css # Styles
│ └── main.tsx # Entry point
├── server/ # Backend API
│ └── index.ts # Express server with streaming
├── package.json
└── vite.config.ts
useAIStreamhook- Real-time streaming
- Error handling with retry
- Usage tracking
- Message history
- Typing indicators
The included Express server provides:
- Streaming chat endpoint
- CORS support
- Error handling
- Anthropic API integration
Edit .env:
VITE_API_ENDPOINT=https://your-api.com/chat
- Conversation persistence
- User authentication
- File uploads
- Multi-modal support