A real-time chat application that integrates with Anthropic's Claude AI, built with React Native (Expo) and Flask. This application provides a clean, intuitive interface for conversing with Claude AI while maintaining full conversation history.
- Real-time chat interface with Claude AI
- Full conversation history preservation
- Auto-scrolling message view
- Visual distinction between user and assistant messages
- Error handling and recovery
- Mobile-responsive design
- Support for long-form conversations
- React Native (Expo)
- React Hooks for state management
- Native components for UI elements
- Flask (Python)
- Anthropic API integration
- CORS support
- Environment-based configuration
Before you begin, ensure you have the following installed:
- Node.js (v14 or higher)
- Python (v3.8 or higher)
- Expo CLI
- pip (Python package manager)
- Clone the repository:
git clone https://github.com/yourusername/anthropic-web-replicate
2. Set up Python virtual environment:
```bash
cd backend
python -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Create a
.env
file in the backend directory:
ANTHROPIC_API_KEY=your_api_key_here
- Navigate to the frontend directory:
cd frontend
- Install dependencies:
npm install
- Activate the virtual environment (if not already activated):
cd backend
source venv/bin/activate # On Windows use: venv\Scripts\activate
- Start the Flask server:
python app/app.py
The backend server will start on http://127.0.0.1:5000
- In a new terminal, navigate to the frontend directory:
cd frontend
- Start the Expo development server:
npx expo start
- Choose your preferred platform:
- Press
w
for web - Press
i
for iOS simulator - Press
a
for Android emulator - Scan QR code with Expo Go app for physical device
- The application will open to a chat interface
- Type your message in the input field at the bottom
- Press "Send" or hit enter to send your message
- Claude AI will respond in real-time
- Scroll through the conversation history as needed
- The frontend uses React Native's
FlatList
for efficient message rendering - Messages are stored in state and persisted during the session
- The backend maintains conversation context for accurate responses
- Error handling is implemented on both frontend and backend
- The application supports long conversations with a 4096 token limit
The application includes comprehensive error handling:
- Network connectivity issues
- API failures
- Invalid responses
- User input validation
- 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 MIT License - see the LICENSE file for details
- Anthropic for providing the Claude AI API
- React Native and Expo teams
- Flask development team
This README provides:
- Clear project description
- Setup instructions
- Usage guidelines
- Technical details
- Contributing guidelines
- License information
- Contact details