https://github.com/ashram15/synopspy
SynopSpy is a full stack web application that help users understand and assess complex documents.
https://github.com/ashram15/synopspy
auth0-jwt auth0-react cross-origin-resource-sharing docker full-stack-development gemeni-api legal-risk-analysis mongodb mongodb-database natural-language-processing nosql-database react restful-api vitejs-react
Last synced: about 1 month ago
JSON representation
SynopSpy is a full stack web application that help users understand and assess complex documents.
- Host: GitHub
- URL: https://github.com/ashram15/synopspy
- Owner: ashram15
- Created: 2025-07-20T03:22:25.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2026-04-09T18:00:54.000Z (2 months ago)
- Last Synced: 2026-04-09T20:05:43.457Z (2 months ago)
- Topics: auth0-jwt, auth0-react, cross-origin-resource-sharing, docker, full-stack-development, gemeni-api, legal-risk-analysis, mongodb, mongodb-database, natural-language-processing, nosql-database, react, restful-api, vitejs-react
- Language: JavaScript
- Homepage: https://synopspy.onrender.com
- Size: 9.83 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SynopSpy
### AI-Powered Document Analyzer & Risk Assessor










### [Click Here to Launch Live App]: https://synopspy.onrender.com
*(Note: App is deployed on Render Free Tier. Please allow ~60-120 seconds for the server to spin up on first load.)*

SynopSpy is a full stack web application that help users understand and assess complex
documents. Some examples of documents SynopSpy helps analyze are legal fine print, court documents, or terms and conditions. SynopSpy uses NLP(Natural Language Processing) to summarize and analyze these documents, flag risky language, and assign a document safety rating.
## System Architecture
```mermaid
graph TD
subgraph Client ["Frontend (Client Side)"]
User[User] -->|Uploads Document| UI[React + Vite App]
UI -->|JWT Auth Token| Auth0[Auth0 Service]
end
subgraph Server ["Backend (Server Side)"]
UI -->|HTTPS POST /upload| API[FastAPI Entry Point]
subgraph Core ["Core Logic"]
API -->|Validate Token| Sec[Security Service]
API -->|Route Request| Router[Upload Router]
end
subgraph Services ["Service Layer"]
Router -->|Stream Data| FileSvc[File Parsing Service]
FileSvc -->|Extracted Text| AISvc[Gemini AI Service]
AISvc -->|JSON Schema| LLM[Google Gemini API]
end
Router -->|Save Metadata| DB[(MongoDB)]
end
```
## Key Features
- AI-Powered Summarization and Risk Analysis: Leverages Google's Gemini API to perform complex NLP tasks, including large document summarization and content risk analysis. Detects complex legal language and highlights sections in the document that require increased oversight.
- Dynamic Safety Rating: processes AI output and generates a 1-5 safety score, providing users with a quick understanding of document risk.
- User Authentication: Integrates a secure login using Auth0 to ensure that document uploads are tied to individual users.
- Upload History: Stores and retrieves a user's previous document analysis using MongoDB, allowing for easy comparison and review.
- Analysis Download FunctionAuthenticated users can download their document analysis.
## Process
- Developed a RESTful API with FastAPI, connected to a React frontend via JavaScript.
- User authentication handled via Auth0
- Uploaded documents are processed using PyMuPDF and python-docx, analyzed with Google Gemini API.
- MongoDB stores user-specific upload history
## Technologies
* Backend: FastAPI, Python
* Frontend: React, Javascript
* Database: MongoDB | NoSQL storage for user upload history and analysis
* Security: Auth0 | Secure user session management
* Deployment: Render (PaaS) | Automated build and deployment pipeline
* API-Communication: Custom built RESTful API handles all data exchanges between frontend and backend. CORS is used to allow cross-origin requests.
* File Processing: PyMuPDF, python-docx Libraries
* AI-Model: Google Gemini
* Container: Docker, backend containerized on docker.
## How to Run Locally:
- To run the program, run both the React frontend and the FastAPI backend code simultaneously.
1. Clone the Repo
```git clone [https://github.com/ashram15/synopspy.git](https://github.com/ashram15/synopspy.git)```
2. First navigate to the project root
```cd synopspy-project```
3. Start the frontend
```cd frontend ```
```npm install ```
```npm run dev```
4. Start the backend on localhost:8000:
```cd backend```
- Create and activate venv
```python -m venv .venv```
```source .venv/bin/activate```
- Install Requirements
```pip install -r requirements.txt```
- Run Backend:
```uvicorn app:app --reload```
5. Access the App
- Go to browser and access frontend through localhost:5173
The Frontend should now be running on localhost:5173 and the backend on localhost:8000
## Testing & Quality Assurance
To ensure system reliability, the backend includes a unit testing suite built with **Pytest** and **FastAPI TestClient**.
**Current Test Coverage:**
* API Health Checks
* Environment Configuration
* Route Availability
**How to run tests:**
```bash
# 1. Navigate to backend
cd backend
# 2. Run the test suite
pytest
# Expected Output:
# tests/test_app.py . [100%]
# 1 passed in 0.xx seconds
```
## Key Design Decisions
- Why Fast API
- Chosen for its asynchronous capabilities and high performance when handling multiple file uploads concurrently
- Minimal boilerplate code compared to Flask/Django for REST APIs
- Why Mongo DB
* JSON-like format integrates seamlessly with React/JS frontend
* Scales well for user-specific document queries
* Flexible schema allows for easy iteration on stored document metadata
- Why Gemini
* Free tier with generous quote limits
* Multi-modal capabilities (Synopspy may extend to analyzing image/pdf analysis in future)
* Lower latency
## Future Improvements
* **Email Notifications:** sending alerts when high-risk documents are detected
* **Collaborative Features:** sharing document analyses with friends, lawyers, or team members
* **Export Options:** Enable PDF/CSV export of analysis results
* **Custom Risk Categories:** allow users to define custom risk keywords/phrases for Synopspy to flag.
* **Mobile Responsiveness:** optimize UI for mobile devices