How chiraggulati098/aura-email-service works
Project Type and Purpose
• Aura is a backend email‑management microservice/API built on Flask.
• It integrates with Gmail for sending/syncing emails, uses MongoDB for persistence, and leverages Google’s Gemini AI for summarization and reply generation.
File Structure
• Top‑level entrypoint: app.py (Flask app, CORS, MongoDB init, route registration).
• routes/ holds two API groups:
• email_routes.py (email CRUD, sync, pagination)
• ai_routes.py (summarize, reply generation)
• utils/ contains integration and processing modules:
• gmail_api.py, google_apis.py (Gmail/Google API wrappers)
• gemini_api.py (AI integration)
• email_utils.py, spam_utils.py, phishing_utils.py (business logic)
• models/ stores persisted ML artifacts (vectorizer, spam/phishing models).
• requirements.txt and .env (config, credentials).
Extract Key Insights from the README
• Core components: Flask app, MongoDB, Gmail API, Gemini AI.
• API endpoints grouped into Email Management and AI Features.
• Security: CORS, env‑based config, user isolation.
• Performance: pagination, indexing, background sync, caching.
• Clients (Web/Mobile UI, Postman, Cron jobs)
• Flask API Service (app.py)
• Email Routes
• AI Routes
• Utility Modules
• External Services
• Gmail API
• Gemini AI Service
• Data Store
• MongoDB
• ML Models (vectorizer, spam/phishing)
• Clients → Flask Service (HTTP REST calls)
• Flask Service → Gmail API (send, sync, delete)
• Gmail API → Flask Service → MongoDB (sync results)
• Flask Service → MongoDB (fetch, store, paginate)
• Flask Service → Gemini AI (summarize, reply) → Flask Service → Clients
• Flask Service → Utility Modules → ML Models (spam/phishing classification)
c. Architectural Patterns & Principles:
• Layered architecture: Presentation (REST), Business (routes + utils), Data (MongoDB)
• Separation of concerns: Routes drive endpoints; utils encapsulate external integrations and logic; models folder holds pre‑trained artifacts.
• Scalability considerations: stateless Flask service; background synchronization; pagination; indexing.
d. Key Technologies & Frameworks:
• Flask + Flask‑CORS + Flask‑PyMongo
• Google API Client (Gmail)
• Gemini API Client
• MongoDB (with compound indexes)
• Python‑dotenv for config