How naaimabk/feelya-sentiment-analysis-nlp-for-marketting works
Project Type & Purpose
• Full-stack web application (SaaS) combining:
– A React-based frontend (SPA)
– A FastAPI backend serving REST endpoints
– ML/NLP pipelines (sentiment analysis, recommendations)
– Data storage (PostgreSQL via SQLAlchemy)
– Data ingestion (web scraping)
File Structure
• Top-level:
– main.py: FastAPI app entrypoint
– api/routes.py: HTTP endpoint definitions
– models/: DB connection & Pydantic schemas
– services/: Business logic (scraper, preprocessor, sentiment_analyzer, recommender)
– scripts/: One-off scripts (e.g., populate_database)
– frontend/frontend-app/: React code (SPA served by Vite)
– Dockerfile & docker-compose.yml: Containerization
Pull Architecture Insights from README
• Four main stages: Collect → Preprocess → Analyze → Recommend
• Tech stack: FastAPI, SQLAlchemy, Transformers (PyTorch), React, PostgreSQL
• External integrations: Web scraping Jumia & Hmizate
A. Client Layer
– Web Browser (User)
– React SPA (frontend-app)
B. API Layer
– FastAPI Application (main.py + api/routes.py)
C. Business-Logic Layer (services/)
– Scraper Service (services/scraper.py)
– Preprocessor Service (services/preprocessor.py)
– Sentiment Analyzer Service (services/sentiment_analyzer.py)
– Recommender Service (services/recommender.py)
D. Data Layer
– PostgreSQL Database (models/database.py via SQLAlchemy)
– Local feelya.db (SQLite for dev)
– scripts/populate_database.py
E. External Systems
– E-commerce sites (Jumia, Hmizate) for scraping
– Optional: Redis or Message Queue (for async tasks—future)
1. User → React SPA
2. React SPA → FastAPI (HTTP /api/v1/…)
3. FastAPI → Services Modules
• Review ingestion → Scraper (scripts run periodically)
• On /analyze-sentiment → Preprocessor → Sentiment Analyzer
• On /recommendations → Recommender (collaborative + content + sentiment)
4. Services → Database (read/write via SQLAlchemy)
5. Scraper → External E-commerce sites → persists raw reviews to DB
6. FastAPI → optional: Async task queue for long-running ML jobs
Architectural Patterns
• Layered architecture (Presentation → API → Domain Services → Data)
• Clear separation of concerns:
– “api/” purely HTTP routing
– “services/” purely business logic
– “models/” purely data models & DB connectivity
• Micro-services style modules inside a monolith
• Containerized deployment (Docker + docker-compose)
Technologies & Frameworks
• Frontend: React, Vite, Tailwind CSS, ESLint
• Backend: FastAPI, Uvicorn
• ORM: SQLAlchemy, Pydantic
• ML: Transformers (CamemBERT, AraBERT), PyTorch, scikit-learn
• DB: PostgreSQL (prod), SQLite (dev)
• Orchestration: Docker, docker-compose