Skip to content

yatinbhalla/Sentiment-Analyzer

Repository files navigation

Sentiment Analyzer

React TypeScript Vite Gemini Status

An AI-powered customer feedback intelligence tool that turns raw user feedback into structured product insight.

Sentiment Analyzer helps product managers, founders, and support teams move faster from "we have a pile of comments" to "we know what users feel, what hurts, and what to protect." The app uses Google Gemini to classify sentiment, summarize the strongest pain point, and extract the most useful positive quote from customer feedback.

Table of Contents

Product Snapshot

Area Details
Product type AI customer feedback analyzer
Primary user Product managers, founders, CX teams, research teams
Core job Convert unstructured feedback into actionable product signals
Input Free-form customer feedback text
Output Sentiment, key pain point, top positive quote
AI model Gemini 2.5 Flash through @google/genai
Frontend React, TypeScript, Vite, Tailwind CSS CDN

Why This Exists

Product teams often collect feedback faster than they can synthesize it. Reviews, support notes, call transcripts, user interviews, and survey responses can become a backlog of unstructured opinions.

This project compresses the first pass of qualitative analysis into a simple workflow:

  1. Paste feedback.
  2. Analyze the text with Gemini.
  3. Review a structured summary.
  4. Use the output to inform product decisions, roadmap conversations, or stakeholder updates.

For product manager and builder interviews, this project demonstrates the ability to identify a real workflow bottleneck, design a narrow AI-assisted solution, ship a working interface, and communicate product value clearly.

Core Features

  • Classifies sentiment as Positive, Neutral, or Negative so teams can quickly understand emotional tone.
  • Extracts the key pain point in one concise sentence to surface friction without reading every line manually.
  • Identifies a positive quote that can inform positioning, feature confidence, or customer proof points.
  • Returns structured JSON from Gemini using a response schema, reducing parsing ambiguity.
  • Handles loading, empty input, errors, and reset states so the prototype behaves like a usable product surface.
  • Presents report-ready output through a clean result card that can be used in research notes or product reviews.

Demo Flow

  1. A user pastes customer feedback into the text area.
  2. The app validates that the input is not empty.
  3. analyzeFeedback() sends the text to Gemini 2.5 Flash.
  4. Gemini returns a structured object with sentiment, painPoint, and positiveQuote.
  5. The UI renders the result in a visual card with sentiment-specific styling.

Tech Stack

Layer Technology Purpose
UI React 19 Builds the single-page product interface
Language TypeScript Adds type safety for app state and AI response shape
Build tool Vite 6 Runs the local dev server and production build
Styling Tailwind CSS CDN Provides fast utility-first styling
AI SDK @google/genai Calls Gemini from the frontend service layer
Model Gemini 2.5 Flash Performs sentiment and insight extraction

Project Layout

Sentiment-Analyzer/
|-- App.tsx                    # Main app shell, input workflow, loading/error/result state
|-- components/
|   `-- ResultCard.tsx          # Result presentation component
|-- services/
|   `-- geminiService.ts        # Gemini request, response schema, JSON parsing
|-- types.ts                    # Shared TypeScript enums and interfaces
|-- index.tsx                   # React app entry point
|-- index.html                  # HTML shell and Tailwind CDN setup
|-- vite.config.ts              # Vite config and Gemini env variable mapping
|-- package.json                # Scripts and dependencies
|-- metadata.json               # App metadata
`-- README.md                   # Product and technical documentation

Auth and Login Flow

Authentication is not currently implemented.

The current product is designed as a lightweight single-user analysis tool. A future production version could add:

  • Google or email login for saved analysis history.
  • Workspace-based access for product, support, and leadership teams.
  • Secure server-side API routing so Gemini keys are never exposed to the browser.

Roles and RBAC

Role-based access control is not currently implemented.

Potential future roles:

Role Possible permissions
Admin Manage workspace, billing, API settings, and team members
Product Manager Run analyses, save insights, tag themes, export reports
Viewer Read shared reports and summaries

Application State - AppContext

AppContext is not currently used.

State is intentionally local and simple inside App.tsx:

  • inputText stores the feedback entered by the user.
  • result stores the structured Gemini analysis.
  • isLoading controls the analyze button and loading UI.
  • error stores validation or API errors.

This is appropriate for the current single-page scope. If the app expands into saved projects, team workspaces, history, or multi-page flows, an AppContext or state library would become useful.

Pages

The application currently has one page:

  • Main Analyzer Page: Provides the full workflow for entering feedback, triggering analysis, clearing input, handling errors, and viewing results.

The app can grow into additional pages such as:

  • Analysis history
  • Saved customer themes
  • Workspace settings
  • Exportable insight reports
  • Batch upload review dashboard

Components

Component Responsibility
App.tsx Owns the product workflow, input state, API call, loading state, error state, and page layout
ResultCard.tsx Displays sentiment, key pain point, and top positive quote with visual styling

Canvas System

A canvas system is not currently implemented.

This project does not include drawing, diagramming, whiteboarding, or visual canvas interactions. If the product evolves toward research synthesis, a future canvas could map feedback into themes, opportunity areas, user segments, or roadmap bets.

NLP and AI Routing

The AI flow is centralized in services/geminiService.ts.

Current behavior:

  • Uses GoogleGenAI from @google/genai.
  • Reads the Gemini API key from GEMINI_API_KEY through Vite's env mapping.
  • Sends the user feedback to gemini-2.5-flash.
  • Requests a JSON response with a strict schema:
    • sentiment
    • painPoint
    • positiveQuote
  • Parses the model response into the shared AnalysisResult type.

This route is simple and effective for a prototype. For production, the AI call should move behind a backend API to protect secrets, enforce rate limits, log failures, and support model fallback.

Hooks and Utilities

No custom hooks are currently implemented.

Current utility-style logic lives in:

  • handleAnalyze() in App.tsx for validation, async execution, result updates, and error handling.
  • handleClear() in App.tsx for resetting input and output state.
  • getSentimentColor() in ResultCard.tsx for sentiment-specific styling.
  • getSentimentIcon() in ResultCard.tsx for sentiment-specific visual cues.

Known Limitations

  • Frontend API key exposure: The Gemini key is mapped into the client bundle. A production version should route model calls through a backend.
  • Single feedback input: The UI currently analyzes one pasted text block rather than a CSV or multi-review batch.
  • No persistence: Results are not saved after refresh.
  • No confidence score: The current schema does not request or display confidence.
  • No theme clustering yet: The README roadmap includes this as a natural next step, but the current implementation focuses on sentiment, pain point, and positive quote extraction.
  • No auth or RBAC: The app is currently a single-user prototype.
  • Limited evaluation harness: There are no automated tests or benchmark datasets for validating model output quality.

Getting Started

git clone https://github.com/yatinbhalla/Sentiment-Analyzer.git
cd Sentiment-Analyzer
npm install

Create a .env.local file:

GEMINI_API_KEY=your_gemini_api_key_here

Run the app:

npm run dev

Build for production:

npm run build

Roadmap

  • Add batch upload for CSV review analysis.
  • Add confidence scores and model reasoning summaries.
  • Add theme clustering across multiple feedback entries.
  • Add export to Markdown, CSV, or stakeholder-ready PDF.
  • Add saved projects and analysis history.
  • Add backend API routing for safer model calls.
  • Add evaluation examples to compare output quality across prompt iterations.

Collaboration

This project is intentionally small, focused, and easy to extend. I welcome collaboration from builders, product thinkers, designers, and AI engineers who want to improve how teams convert customer language into product decisions.

Useful contribution areas:

  • Improve prompt quality and evaluation examples.
  • Add batch analysis and export workflows.
  • Design a stronger insight dashboard.
  • Add auth, history, and team workspaces.
  • Harden the app for production deployment.

Open an issue, suggest a product direction, or fork the repo and build on it. Good product tools get better when the people using them help shape them.

Author

Yatin Bhalla · Product Manager & AI Builder

LinkedIn Gmail X

Releases

No releases published

Packages

 
 
 

Contributors