An end-to-end Full-Stack application that scans Facebook comments and uses a Deep Learning backend to perform real-time sentiment analysis. Featuring a high-performance React dashboard with live-updating charts and a notification system.
- Live Scanning: Analyze Facebook post comments via a custom scanning tool.
- AI Backend: FastAPI server integrated with a trained TensorFlow/Keras model.
- Dynamic Analytics: Interactive Bar and Doughnut charts powered by Chart.js.
- Date Filtering: Historical sentiment trends with custom date range selection.
- Real-time Notifications: Instant feedback on community health and scan status.
- Containerized: Built with Docker for one-click deployment.
sentiment-analysis/
├── backend/ # FastAPI & AI Logic
│ ├── app/ # Application code
│ ├── Dockerfile # Production container setup
│ └── requirements.txt # Python dependencies
├── frontend/ # React Dashboard
│ ├── src/ # Components & Hooks
│ └── package.json # NPM dependencies
└── .env # Secret keys & DB URLs
## Installation & Setup
### 1. Backend Setup (FastAPI)
Navigate to the backend directory and set up a virtual environment:
```bash
cd backend
python -m venv venv
# Activate the virtual environment
# On Linux/macOS:
source venv/bin/activate
# On Windows:
venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
Create a file named .env in the backend/ root directory and add the following configuration:
DATABASE_URL=postgresql+asyncpg://user:password@localhost:5432/sentiment
SECRET_KEY=your_secret_key_here
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=60Start the development server with hot-reload enabled. This will automatically restart the server whenever you save changes to your code:
python -m uvicorn app.main:app --reloadNavigate to the frontend directory to install dependencies and launch the development server:
cd frontend
# Install all required npm packages
npm install
# Start the React development server
npm startSince we are using Docker for the backend, Render will build the container automatically using our Dockerfile.
- Runtime: Select Docker from the runtime dropdown.
- Instance Type: Select at least the Starter (2GB RAM) instance.
Important: TensorFlow requires significant memory to load models; using the Free Tier (512MB) will likely result in an
Out of Memory (OOM)error. - Environment Variables: Navigate to the Environment tab in the Render Dashboard and manually add your
.envkeys:DATABASE_URLSECRET_KEYALGORITHMACCESS_TOKEN_EXPIRE_MINUTES
Deploy the React dashboard as a high-performance static site.
- Build Command:
npm run build - Publish Directory:
build - Environment Variables: If your API URL is different in production, add
REACT_APP_API_URLto point to your Render Backend URL.
Note: Ensure your Backend is deployed first so you can provide the correct API URL to your Frontend during its build process.