A React-based web application that performs real-time sentiment analysis on text input using AWS Comprehend. This application provides immediate feedback on the emotional tone of text with visual indicators and detailed sentiment breakdowns.
- Real-time sentiment analysis using AWS Comprehend
- Visual sentiment indicators (emojis and colors)
- Sorted display of analyzed texts from most positive to most negative
- Detailed sentiment breakdown (Positive, Negative, Neutral, Mixed percentages)
- Responsive design with Tailwind CSS
- Complete test coverage
Before you begin, ensure you have:
- Node.js (v16 or higher)
- npm (v7 or higher)
- AWS Account with Comprehend access
- AWS credentials with appropriate permissions
- Clone the repository:
git clone <repository-url>
cd sentiment-analysis-dashboard
- Install dependencies:
npm install
- Create a
.env
file in the root directory:
VITE_AWS_REGION=your-aws-region
VITE_AWS_ACCESS_KEY_ID=your-access-key
VITE_AWS_SECRET_ACCESS_KEY=your-secret-key
- Ensure your AWS account has access to Amazon Comprehend
- Create an IAM user with the following policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "comprehend:DetectSentiment",
"Resource": "*"
}
]
}
Start the development server:
npm run dev
Run tests:
npm test
Run tests with coverage:
npm run test:coverage
Build for production:
npm run build
├── src/
│ ├── App.tsx # Main application component
│ ├── App.test.tsx # Test suite
│ └── setupTests.ts # Test configuration
├── .env # Environment variables
├── .env.example # Example environment variables
├── tsconfig.json # TypeScript configuration
├── vitest.config.ts # Vitest configuration
└── package.json # Project dependencies and scripts
The project uses Vitest for testing with:
- React Testing Library for component testing
- Complete test coverage for the sentiment sorting algorithm
- Mocked AWS services for reliable testing
Variable | Description |
---|---|
VITE_AWS_REGION | Your AWS region (e.g., us-east-1) |
VITE_AWS_ACCESS_KEY_ID | Your AWS access key ID |
VITE_AWS_SECRET_ACCESS_KEY | Your AWS secret access key |
- React 18 with TypeScript
- Vite for build tooling