The app is deployed live:
| Part | URL |
|---|---|
| Frontend (Netlify) | https://sentiment-sage42984.netlify.app |
| Frontend (Vercel) | https://sentiment-sage42984.vercel.app |
| Backend API (Render) | https://sentimentsage.onrender.com/api |
The frontend on Netlify/Vercel automatically talks to the backend on Render. No extra setup needed for visitors β everything works out of the box.
- Multi-Platform Analysis: Analyze text, CSV files, Twitter accounts, and YouTube comments
- Advanced AI Models: Powered by OpenAI GPT and Hugging Face transformers
- Real-time Processing: Get instant sentiment analysis results
- Interactive Visualizations: Beautiful charts and graphs for data insights
- User Authentication: Secure signup, login, and profile management
- History Tracking: Save and revisit your previous analyses
- Export Capabilities: Export results as PDF reports
- Python 3.8+
- Node.js 16+
- MongoDB Community Edition
- npm or yarn
- Clone the repository
git clone <repository-url>
cd SentimentSa- Backend Setup
cd backend
python -m venv venv
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
# source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
# Edit .env with your configuration- Frontend Setup
cd frontend
npm install
cp .env.example .env
# Edit .env with your configuration- Start MongoDB service
- Start Backend:
cd backend python app.py - Start Frontend:
cd frontend npm run dev
On Windows:
- PowerShell:
.\start-dev.ps1 - Command Prompt:
start-dev.bat
- Frontend: http://localhost:3000
- Backend API: http://localhost:8080/api
- Health Check: http://localhost:8080/api/ping
See README-DEV.md for detailed development setup and troubleshooting.
SentimentSage/
βββ backend/ # Flask API server (deployed on Render)
β βββ models/ # Database models
β βββ routes/ # API routes
β βββ utils/ # Utility functions
β βββ middleware/ # Custom middleware
β βββ config.py # Configuration
β βββ requirements.txt # Python dependencies
β βββ render.yaml # Render deployment config
βββ frontend/ # React frontend (deployed on Netlify/Vercel)
β βββ src/ # Source code
β β βββ components/ # Reusable components
β β βββ pages/ # Page components
β β βββ hooks/ # Custom hooks
β β βββ utils/ # Utility functions
β βββ public/ # Static assets
β βββ netlify.toml # Netlify deployment config
β βββ vercel.json # Vercel deployment config
βββ data/ # Local database storage
βββ db/ # MongoDB data files
FLASK_CONFIG: development/productionMONGODB_URI: MongoDB connection stringSECRET_KEY: Flask secret keyJWT_SECRET_KEY: JWT secret key- API keys for external services (optional)
VITE_API_BASE_URL: Backend API URL
A fully documented master copy of every variable lives in .env at the project root (it is git-ignored, so it never gets committed). The backend reads backend/.env and the frontend reads frontend/.env β copy the relevant values into each.
| File | Who reads it | Content |
|---|---|---|
backend/.env |
Flask backend (backend/db/mongo_client.py) |
MongoDB, JWT, API keys, AI, email, CORS |
frontend/.env |
Vite frontend at build time | VITE_API_BASE_URL |
.env (root) |
Reference copy only | Everything, fully explained |
| Variable | Required? | Where to get it |
|---|---|---|
SECRET_KEY / JWT_SECRET_KEY |
Yes | Any long random string: python -c "import secrets; print(secrets.token_hex(32))" |
MONGODB_URI |
Yes | Local: mongodb://localhost:27017/sage_sentiment. Cloud: MongoDB Atlas β create free cluster β Connect β Connect your application β copy string (replace <username>:<password>) |
YOUTUBE_API_KEY |
No | Google Cloud Console β create project β Enable APIs & Services β enable YouTube Data API v3 β Credentials β Create Credentials β API key |
OPENAI_API_KEY |
No | OpenAI Platform β API keys β Create new secret key (needs paid account/credits for live calls) |
HUGGINGFACE_API_KEY |
No | Hugging Face β Settings β Access Tokens β New token |
TWITTER_* keys |
No | X Developer Platform β create a Project + App β copy API Key/Secret and Access Token/Secret (note: X requires paid tiers) |
SMTP_USERNAME |
No* | Your Gmail address |
SMTP_PASSWORD |
No* | Gmail App Password (not your login password): myaccount.google.com β Security β enable 2-Step Verification β App passwords β choose Mail/Other β copy 16-char code |
CORS_ORIGINS |
Yes | Comma-separated list of every frontend URL (e.g. http://localhost:5173,https://sentiment-sage42984.netlify.app,https://sentiment-sage42984.vercel.app) |
* Only needed if
USE_MOCK_EMAIL=False. While developing, keepUSE_MOCK_EMAIL=Trueand emails are logged instead of sent.
- Copy the root
.envtobackend/.env:cp .env backend/.env(Windows:copy .env backend\.env) - Edit
backend/.envand fill in the values from the table above. - Create
frontend/.envwithVITE_API_BASE_URL=http://localhost:8080/api. - Never commit
.envfiles β they are already ignored via.gitignore.
The app is split into two parts, deployed separately:
- Deploy the
backend/folder usingrender.yaml(already configured). - Set these env vars in Render:
MONGODB_URI,SECRET_KEY,JWT_SECRET_KEY,CORS_ORIGINS(your frontend URLs), plus API keys (YOUTUBE_API_KEY,OPENAI_API_KEY, etc.). - Render auto-redeploys on every push to
main.
- Connect the repo, set Base directory =
frontend, Build command =npm run build, Publish directory =dist. - Set the env var
VITE_API_BASE_URL=https://your-backend.onrender.com/api(this is how the site finds the backend). - Netlify uses
netlify.toml; Vercel usesvercel.json. Both are included β you can deploy to either.
Frontend (Netlify) β VITE_API_BASE_URL β Backend (Render) β MongoDB + AI APIs.
The backend allows requests only from the URLs in CORS_ORIGINS.
POST /api/auth/signup- User registrationPOST /api/auth/login- User loginPOST /api/auth/logout- User logoutGET /api/auth/me- Get current user
POST /api/analyze/text- Analyze text sentimentPOST /api/analyze/csv- Analyze CSV filePOST /api/analyze/twitter- Analyze Twitter accountPOST /api/analyze/youtube- Analyze YouTube video
GET /api/profile- Get user profilePUT /api/profile- Update user profileGET /api/profile/analyses- Get user's saved analyses
The platform provides interactive charts including:
- Sentiment distribution pie charts
- Time-series sentiment trends
- Word clouds of frequently used terms
- Comparative analysis between datasets
- JWT-based authentication
- Password hashing with bcrypt
- CORS protection
- Input validation and sanitization
- Rate limiting (coming soon)
- 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.
- Backend: Python, Flask, MongoDB, JWT
- Frontend: React, TypeScript, Vite, Tailwind CSS, shadcn/ui
- AI: OpenAI GPT, Hugging Face
- Hosting: Render (backend), Netlify / Vercel (frontend)
- OpenAI for GPT models
- Hugging Face for transformer models
- MongoDB for database solutions
- All contributors to this project
For support, please open an issue on GitHub or contact the development team.
