How sushant777/mailplatform works
Project type and purpose
• This is a full-stack, containerized web application called Email Manager.
• Purpose: allow users to sign up/sign in, connect multiple email accounts (Gmail, Outlook via OAuth2), view and sync messages in a unified inbox.
File structure
Top-level:
• backend/ – Node.js + Express app
– app.js (Express server entry)
– config/db.js (Elasticsearch or other DB connection)
– controllers/ (MVC controllers: auth.js, email.js, user.js)
– models/ (ORM or data-model classes)
– routes/ (Express routers per feature)
– middleware/auth.js (JWT auth guard)
– service/ (business logic for EmailService, GmailService, OutlookService)
– Dockerfile, package.json
• frontend/ – Static single-page HTML + CSS + JS
– HTML pages for login, signup, callbacks, inbox, compose, profile, users
– css/styles.css
– Dockerfile
• docker-compose.yml – defines frontend, backend (and possibly Elasticsearch) containers
• README.md, Notes.txt, .gitignore
README for additional insights
• Tech stack: Node.js, Express, OAuth2, Gmail API, Microsoft Graph API, Elasticsearch (for storage/indexing).
• Deployment: Docker Compose with environment variables (.env in backend) for DB, JWT secret, OAuth credentials.
• Workflow: frontend served at http://localhost:8080; backend API at http://localhost:3005.
a. Main components
1. Client Web Browser (UI)
2. Frontend Container (serves static assets, JS)
3. Backend Container (Node.js/Express API)
4. Database (Elasticsearch or primary datastore)
5. External Services: Gmail API, Microsoft Graph API (Outlook)
6. (Optional) Docker network or orchestration layer
b. Relationships & interactions
• Browser → Frontend (HTTP request for HTML/CSS/JS)
• Frontend JS → Backend API (HTTP/REST, AJAX)
• Backend API → Database (read/write user data, emails metadata)
• Backend Service Layer → External Email APIs (OAuth2 token exchange, fetch/send emails)
• Database ←→ Backend models (persistence)
c. Architectural patterns & principles
• MVC / Layered architecture in backend (controllers → service → models)
• Separation of concerns: UI vs API vs data store
• Containerization for isolation and reproducible deployment
• OAuth2 integration for third-party APIs
d. Key technologies & frameworks
• Node.js, Express
• Elasticsearch (or other DB)
• OAuth2, Gmail API, Microsoft Graph API
• Docker, Docker Compose
• Static HTML/JS frontend