How ishu077/foundation works
Project Type and Purpose
• This is a full-stack web application (“AI-Powered Text Summarization Application”) that provides users with an interface to submit long text, generates concise summaries via Google Gemini AI, caches results in Redis, and stores history in MongoDB.
File Structure Analysis
• Top-level split:
• /backend – Node.js/Express server.
• /frontend – React/Vite client.
• Backend folders:
• config (Redis client),
• controllers (auth.js, summary.js),
• middlewares (JWT auth, rateLimiter),
• helper (summariser.js wraps Gemini AI),
• models (MongoDB schemas: user, article, summary),
• routes (user, summary),
• utils (cache utilities for Redis).
• Frontend folders:
• src/components (UI atoms/molecules),
• src/pages (Login, Signup, History),
• App.jsx and Dashboard.jsx for routing and main UI.
• Key config files: package.json, .env, vite.config.js, tailwind.config.js, Redis config.
README Insights
• Tech Stack clearly lists React, Vite, Express, MongoDB (Mongoose), Redis, Google Gemini AI, JWT, bcrypt, Helmet, CORS, rate-limiting.
• Caching strategy and rate limiting details.
Main Components & Interactions
a. Components:
• React Frontend (Browser)
• Express Backend (monolithic API server)
• MongoDB Database
• Redis Cache & Rate Limiter
• Google Gemini AI (external service)
b. Data Flow & Relationships:
1. User interacts with React UI → browser issues HTTP requests to Express.
2. At Express entry (server.js): CORS & Helmet apply.
3. Requests pass through rateLimiter middleware (uses Redis).
4. Authenticated routes use auth middleware (JWT).
5. Controller logic:
• SummaryController → checks Redis cache via utils/cache.
– If cache MISS: calls summariser helper → Google Gemini → stores result in Redis.
– If cache HIT: returns cached summary.
• CRUD operations read/write to MongoDB via Mongoose models.
6. Responses return to React, which updates UI.
c. Architectural Patterns & Principles:
• Layered MVC-style architecture on backend: routes → middlewares → controllers → models/util.
• Single monolith backend (no microservices).
• Caching layer (Redis) abstracted via utilities.
• External integration as a separate “service” (Gemini AI).
• Stateless front-end; state managed client-side.
d. Key Technologies:
• Frontend: React, Vite, Tailwind CSS, React Router, Google OAuth.
• Backend: Node.js, Express, Mongoose, Redis client, Google Generative AI SDK, JWT, bcrypt, Helmet, CORS.