How azizul-islam-efath/ai-paper-summarizer works
Purpose and Entry Points
Paper Generator is a full-stack research workspace: authenticated users organize projects, upload academic PDFs, obtain AI-derived structured summaries and cross-paper analysis, then generate formatted paper drafts. The client starts at frontend/src/main.jsx and routes through frontend/src/App.jsx; the API process starts at backend/src/server.js.
Client Application
React 19/Vite provides public authentication pages and protected research-workspace views. Layouts and route guards separate anonymous and authenticated flows; page modules cover upload, project/paper detail, summaries, and generated drafts.
• frontend/src/routes/PrivateRoute.jsx
• frontend/src/layouts/DashboardLayout.jsx
• frontend/src/pages/ProjectDetail.jsx
The browser calls backend endpoints through domain-specific service modules, while authentication/session state is held in React context.
• frontend/src/services/api.js
• frontend/src/services/paperService.js
• frontend/src/context/AuthContext.jsx
HTTP API and Control Boundary
Express routes map resource domains—auth, projects, papers, summaries, generated papers, and administration—to controllers. Middleware establishes the API boundary: JWT authentication, request validation/rate limits, multipart upload handling, and centralized failures.
• backend/src/routes/paperRoutes.js
• backend/src/routes/summaryRoutes.js
• backend/src/controllers/projectController.js
• backend/src/middleware/auth.js
• backend/src/middleware/upload.js
Persistent Research Model
Prisma is the persistence boundary over MySQL. It stores user/account state and the research workspace’s projects, paper records, summaries, and generated output, allowing asynchronous-looking processing results to be retrieved by frontend resource views.
• backend/prisma/schema.prisma
• backend/src/config/prisma.js
• backend/src/controllers/generatedPaperController.js
Cloud MySQL is documented as Aiven-hosted in deployment; local development uses DATABASE_URL.
PDF Ingestion Pipeline
A paper upload enters through multipart middleware, is retained in the backend upload storage area, parsed to text, and then controlled by the paper endpoints/controllers. This separates binary-file handling and PDF extraction from AI and persistence concerns.
• backend/src/routes/paperRoutes.js
• backend/src/services/pdfParserService.js
• backend/uploads/.gitkeep
AI Synthesis Pipeline
Gemini is isolated behind an AI client and focused services. Extracted PDF text feeds metadata extraction and structured summarization; multiple project papers can feed prompt templates and paper generation for comparison/gap analysis and publication-style drafts.
• backend/src/services/AI/geminiClient.js
• backend/src/services/AI/MetadataExtractor.js
• backend/src/services/AI/Summarizer.js
• backend/src/services/AI/PaperGenerator.js
• backend/src/services/AI/PromptTemplates.js
Identity, Notifications, and Deployment
Authentication uses JWTs with refresh-token configuration and supports password-reset delivery through Gmail SMTP. Runtime configuration validates secrets and external connection settings. The frontend is intended for Vercel SPA deployment, while the Node/Express service is deployed via Render; Gemini and Aiven MySQL remain external dependencies.
• backend/src/controllers/authController.js
• backend/src/services/emailService.js
• backend/src/config/env.js
• render.yaml
• frontend/vercel.json
Main entry points: paperRoutes.js Resource routes & controllers · Summarizer.js AI synthesis services · server.js API server · main.jsx Client entry & routes
Components 18
React Client
- Client entry & routes · Starts the SPA and selects public or protected views.
frontend/src/main.jsx - Research workspace · Project, paper, summary, upload, and draft views.
frontend/src/pages/ProjectDetail.jsx - Auth session state
frontend/src/context/AuthContext.jsx - API service modules
frontend/src/services/api.js
Express API
- API server · HTTP entry point and resource API boundary.
backend/src/server.js - Resource routes & controllers · Handles auth, projects, papers, summaries, drafts, and administration.
backend/src/routes/paperRoutes.js - Security & upload middleware · JWT protection, validation, rate limits, multipart handling, and failures.
backend/src/middleware/auth.js
Document & AI Processing
- Uploaded PDFs · Backend-managed retained upload files.
backend/uploads/.gitkeep - PDF text extraction
backend/src/services/pdfParserService.js - AI synthesis services · Extracts metadata, summarizes papers, compares project sources, and generates drafts.
backend/src/services/AI/Summarizer.js - Generation prompts
backend/src/services/AI/PromptTemplates.js
Persistence & External Services
- Prisma data access
backend/src/config/prisma.js - Research workspace data · Users, projects, papers, summaries, and generated papers.
backend/prisma/schema.prisma - Gemini
backend/src/services/AI/geminiClient.js - Gmail SMTP · Delivers password-reset messages.
backend/src/services/emailService.js - Runtime configuration · Validates secrets and external connection settings.
backend/src/config/env.js
Connections 21
- Client entry & routes → Research workspace: renders protected views
- Client entry & routes → Auth session state: provides session
- Research workspace → API service modules: requests resources
- Auth session state → API service modules: attaches session
- API service modules → API server: HTTPS API calls
- API server → Security & upload middleware: applies boundary controls
- Security & upload middleware → Resource routes & controllers: passes validated requests
- Resource routes & controllers → Uploaded PDFs: stores uploads
- Resource routes & controllers → PDF text extraction: parses uploaded papers
- Uploaded PDFs → PDF text extraction: PDF input
- PDF text extraction → AI synthesis services: extracted text
- Resource routes & controllers → AI synthesis services: requests summaries and drafts
- AI synthesis services → Generation prompts: uses prompts
- AI synthesis services → Gemini: AI inference
- Resource routes & controllers → Prisma data access: reads and writes workspace
- AI synthesis services → Prisma data access: persists processing results
- Prisma data access → Research workspace data: database access
- Resource routes & controllers → Gmail SMTP: password resets
- Runtime configuration → API server: configures runtime
- Vercel → Client entry & routes: deploys
- Render → API server: deploys