How vanshpatel024/fake-news-detector works
Project type and purpose
• This is a full-stack web application called “Fake News Detector.”
• The user interacts via a React/Vite frontend. The frontend calls a FastAPI backend, which loads a serialized ML model (Tfidf + LogisticRegression) to predict whether a submitted URL or text is “fake news.”
File structure
• Top-level directories:
• backend/ – contains the FastAPI service and model code
• client/ – contains the React/Vite application
• backend/app/
• main.py – defines API routes (POST endpoints for URL or text submission)
• main_model.pkl – the pre-trained ML model artifact
• model/fetcher.py – logic to fetch and sanitize HTML/text from a URL
• model/predictor.py – wraps the ML model, performs feature extraction (Tfidf) and inference
• requirements.txt – Python dependencies for FastAPI, scikit-learn, etc.
• client/src/
• Components/ – React UI elements (Header, Footer, cards, notifications)
• Pages/Home.jsx – the main page with input form and result display
• Utils/Api.js – encapsulates HTTP calls to FastAPI endpoints
• StyleSheets/ – CSS modules per component
• main.jsx / index.html – Vite entrypoints
• Deployment config:
• client/vite.config.js – build settings for Vite
• .gitignore files in both subprojects
README for additional insights
• Frontend deployed on Vercel, backend on Render.
• No persistent database; the primary state is the loaded ML model.
• Two user flows: “Analyze by URL” and “Analyze by Text.”