Note: This is a simplified version of the AWS Solutions Library Guidance for Secure Chat UI for Amazon Bedrock Agents. This version removes the complexity of AWS Amplify and Cognito authentication in favor of a simple bearer token approach.
A simplified React-based chat interface for Amazon Bedrock that uses:
- Bearer Token Authentication instead of AWS Cognito
- Direct Backend API instead of AWS SDK calls
- Simple Environment Variables for configuration
- No AWS Amplify Dependencies
- Node.js (v18 or higher)
- AWS Bedrock access with a bearer token
-
Clone the repository:
git clone https://github.com/Ferneyman/bedrock-simple-chat-ui.git cd bedrock-simple-chat-ui -
Install dependencies:
npm install
-
Configure your environment:
cp .env.example .env # Edit .env and add your AWS Bearer Token -
Add your bearer token to
.env:AWS_BEARER_TOKEN_BEDROCK=your_actual_bearer_token_here
-
Start the application:
./run.sh
-
Access the application:
- Frontend: http://localhost:8087
- Backend: http://localhost:8088
├── src/
│ ├── App.jsx # Main app component (simplified)
│ ├── ChatComponent.jsx # Chat interface (uses backend API)
│ ├── ConfigComponent.jsx # Simple configuration
│ └── js/
│ └── useSpeechToText.jsx
├── backend/
│ └── server.mjs # Simple Node.js backend
├── .env # Environment variables (not in git)
├── .env.example # Environment template
└── run.sh # Start both servers
The application uses a simple .env file for configuration:
# AWS Bedrock Configuration
AWS_BEARER_TOKEN_BEDROCK=your_bearer_token_here
# Backend Server Configuration
BACKEND_PORT=8088
FRONTEND_ORIGIN=http://localhost:8087
# Bedrock Model Configuration
BEDROCK_REGION=ap-southeast-2
BEDROCK_MODEL_ID=anthropic.claude-sonnet-4-5-20250929-v1:0./run.sh- Start both frontend and backend serversnpm run dev- Start frontend only (port 8087)npm run backend- Start backend only (port 8088)npm start- Start both servers using concurrently
- Frontend (React + Vite) runs on port 8087
- Backend (Node.js) runs on port 8088 and handles Bedrock API calls
- Authentication is handled via bearer token in the backend
- Chat Interface sends HTTP requests to the backend API
- Bearer token is stored in
.envfile (not committed to git) - Backend handles all AWS API calls
- Frontend only communicates with your backend
- No AWS credentials exposed to the browser
| Original AWS Version | This Simplified Version |
|---|---|
| AWS Amplify hosting | Local development server |
| AWS Cognito authentication | Bearer token authentication |
| AWS SDK in frontend | Backend API calls |
| Complex configuration | Simple .env file |
| Multiple AWS services | Just Bedrock API |
This is a simplified version for personal use. For the full AWS Solutions Library version with enterprise features, see the original repository.
This project is based on the AWS Solutions Library guidance. Please refer to the original repository for licensing information.
- Original AWS Repository: https://github.com/aws-solutions-library-samples/guidance-for-a-secure-chat-user-interface-for-amazon-bedrock
- AWS Bedrock Documentation: https://docs.aws.amazon.com/bedrock/