# pankajtanwarbanna/placementmnit architecture

> Architecture diagram of the GitHub repository pankajtanwarbanna/placementmnit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pankajtanwarbanna/placementmnit
- Repository: https://github.com/pankajtanwarbanna/placementmnit

## Overview

##### Project type and purpose
- This is a full-stack MEAN (MongoDB, Express.js, AngularJS, Node.js) single-page application: an online placement & internship automation portal.
- The frontend is a client-side AngularJS app (HTML/CSS/JS under public/app and assets), and the backend is an Express/Node.js REST API (app/ directory) persisting data in MongoDB.

##### File structure
- Top-level server.js boots the Express app, serves static assets and mounts API routes from app/routes.
- app/
- routes/ – defines REST endpoints (e.g., auth.router.js, user.router.js, placement.router.js)
- controllers/ – business logic per endpoint
- services/ – helper modules (MongoDB connection, mailer, SMS, JWT handling, file upload via Multer, CSV/Excel export, templates, utilities)
- middlewares/ – Express middleware for authentication and JWT validation
- models/ – Mongoose schemas for entities (User, Company, Interview, Notification, etc.)
- public/
- app/ – AngularJS modules: controllers, services, directives, filters, routing config (routes.js), main entry (app.js)
- views/ – HTML templates organized by feature (authentication, company, placements, profile, management, etc.)

##### Extract additional insights from README
- The system uses JWT for stateless auth, environment variables for credentials (email, SMS API keys, secret).
- It integrates with an SMTP server and an SMS gateway.
- It supports file uploads (resumes, CSV exports) with Multer.

a. Main components
- Client Layer: Browser running AngularJS SPA
- API Layer: Express.js server (server.js + routes + middleware)
- Business Logic Layer: Controllers ➔ Services ➔ Utilities
- Data Layer: Mongoose models ➔ MongoDB database
- External Services: SMTP Email provider, SMS gateway
- File Store: local filesystem (via Multer) for uploads & exports

b. Relationships & interactions
1. Browser loads index.html and AngularJS app.js
2. Angular services initiate HTTP/HTTPS requests to REST endpoints on Express server
3. Express middleware (JWT, auth) intercepts requests, validates tokens
4. Route handlers delegate to controllers
5. Controllers call services (e.g., mailer, SMS, export, MongoDBService)
6. Services interact with Mongoose models to CRUD data in MongoDB
7. Services also call SMTP or SMS gateway APIs or write files to disk via Multer/Export service
8. Responses propagate back up: Service ➔ Controller ➔ Route ➔ Client

c. Architectural patterns & design principles
- Layered MVC-style separation (Routes → Controllers → Services → Models)
- Stateless JWT authentication (middleware pipeline)
- Single-Page Application (AngularJS) for dynamic client behavior
- RESTful API endpoints
- Modular design grouping by feature
- Environment-based config for secrets

d. Key technologies
- Frontend: AngularJS, HTML5, CSS3, Bootstrap
- Backend: Node.js, Express.js, Mongoose (MongoDB)
- Auth: JSON Web Tokens
- File handling: Multer
- Email: nodemailer (via mailer.service)
- SMS: custom sms.service calling SMS_BASE_URI
- Data export: CSV/Excel services

##### Detailed checklist
- API endpoints grouping (auth, user, placement, interview, etc.) in the routing layer
- Middleware chain (auth.middleware → jwt.middleware) ahead of controller invocation
- Mongoose models as the boundary to the MongoDB database
- Environment configuration feeding secrets into JWT and external-service connectors

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        Browser["Browser"]:::external
        AngularApp["AngularJS App"]:::frontend
        Controllers_C["Angular Controllers"]:::frontend
        Services_C["Angular Services"]:::frontend
        Directives["Angular Directives"]:::frontend
        Filters["Angular Filters"]:::frontend
        Routing["Routing Config (routes.js)"]:::frontend
        Views["Views/Templates"]:::frontend
        Assets["Static Assets"]:::frontend
    end

    Browser -->|"loads index.html & app.js"| AngularApp
    AngularApp --> Controllers_C
    AngularApp --> Services_C
    AngularApp --> Directives
    AngularApp --> Filters
    AngularApp --> Routing
    AngularApp --> Views
    AngularApp --> Assets
    AngularApp -->|"HTTP/HTTPS Requests"| ExpressAPI

    %% Backend Layer
    subgraph "Backend Layer"
        ExpressAPI["Express API (server.js)"]:::backend
        Routes["API Routes"]:::backend
        MiddlewareAuth["Authentication Middleware"]:::backend
        MiddlewareJWT["JWT Validation Middleware"]:::backend
        Controllers_B["Controllers"]:::backend
        subgraph "Services"
            Services_B["Service Modules"]:::backend
            MongoService["MongoDB Service"]:::backend
            EmailService["Email Service"]:::backend
            SMSService["SMS Gateway Service"]:::backend
            JWTService["JWT Handling Service"]:::backend
            MulterService["File Upload Service"]:::backend
            ExportService["Export Service"]:::backend
            TemplateService["Template Service"]:::backend
            UtilityService["Utility Service"]:::backend
        end
        subgraph "Models"
            Models["Mongoose Models"]:::backend
        end
        Config["Config Constants"]:::backend
    end

    ExpressAPI --> Routes
    Routes --> MiddlewareAuth
    MiddlewareAuth --> MiddlewareJWT
    MiddlewareJWT --> Controllers_B
    Controllers_B --> Services_B
    Services_B --> MongoService
    Services_B --> EmailService
    Services_B --> SMSService
    Services_B --> JWTService
    Services_B --> MulterService
    Services_B --> ExportService
    Services_B --> TemplateService
    Services_B --> UtilityService
    Services_B --> Models
    Controllers_B --> Config

    %% Data & External Systems
    MongoDB["MongoDB Database"]:::datastore
    FileStore["File Store (Multer/Exports)"]:::datastore
    SMTP["SMTP Email Provider"]:::external
    SMSGW["SMS Gateway"]:::external

    MongoService --> MongoDB
    Models --> MongoDB
    EmailService -->|"SMTP"| SMTP
    SMSService -->|"SMS API"| SMSGW
    MulterService --> FileStore
    ExportService --> FileStore

    %% Responses
    MongoDB -->|"data"| MongoService
    Services_B -->|"response"| Controllers_B
    Controllers_B -->|"response"| MiddlewareJWT
    MiddlewareJWT -->|"response"| MiddlewareAuth
    MiddlewareAuth -->|"response"| Routes
    Routes -->|"JSON Response"| ExpressAPI
    ExpressAPI -->|"HTTP Response"| AngularApp

    %% Click Events Frontend
    click AngularApp "https://github.com/pankajtanwarbanna/placementmnit/tree/master/public/app"
    click Controllers_C "https://github.com/pankajtanwarbanna/placementmnit/tree/master/public/app/controllers"
    click Services_C "https://github.com/pankajtanwarbanna/placementmnit/tree/master/public/app/services"
    click Directives "https://github.com/pankajtanwarbanna/placementmnit/tree/master/public/app/directives"
    click Filters "https://github.com/pankajtanwarbanna/placementmnit/tree/master/public/app/filters"
    click Routing "https://github.com/pankajtanwarbanna/placementmnit/blob/master/public/app/routes.js"
    click Views "https://github.com/pankajtanwarbanna/placementmnit/tree/master/public/app/views"
    click Assets "https://github.com/pankajtanwarbanna/placementmnit/tree/master/public/assets"

    %% Click Events Backend
    click ExpressAPI "https://github.com/pankajtanwarbanna/placementmnit/blob/master/server.js"
    click Routes "https://github.com/pankajtanwarbanna/placementmnit/tree/master/app/routes"
    click MiddlewareAuth "https://github.com/pankajtanwarbanna/placementmnit/blob/master/app/middlewares/auth.middleware.js"
    click MiddlewareJWT "https://github.com/pankajtanwarbanna/placementmnit/blob/master/app/middlewares/jwt.middleware.js"
    click Controllers_B "https://github.com/pankajtanwarbanna/placementmnit/tree/master/app/controllers"
    click Services_B "https://github.com/pankajtanwarbanna/placementmnit/tree/master/app/services"
    click MongoService "https://github.com/pankajtanwarbanna/placementmnit/blob/master/app/services/mongodb.service.js"
    click EmailService "https://github.com/pankajtanwarbanna/placementmnit/blob/master/app/services/mailer.service.js"
    click SMSService "https://github.com/pankajtanwarbanna/placementmnit/blob/master/app/services/sms.service.js"
    click JWTService "https://github.com/pankajtanwarbanna/placementmnit/blob/master/app/services/jwt.service.js"
    click MulterService "https://github.com/pankajtanwarbanna/placementmnit/blob/master/app/services/multer.service.js"
    click ExportService "https://github.com/pankajtanwarbanna/placementmnit/blob/master/app/services/export.service.js"
    click TemplateService "https://github.com/pankajtanwarbanna/placementmnit/blob/master/app/services/template.service.js"
    click UtilityService "https://github.com/pankajtanwarbanna/placementmnit/blob/master/app/services/utility.service.js"
    click Models "https://github.com/pankajtanwarbanna/placementmnit/tree/master/app/models"
    click Config "https://github.com/pankajtanwarbanna/placementmnit/blob/master/app/config/constant.js"

    %% Click Events Models Schemas
    click Config "https://github.com/pankajtanwarbanna/placementmnit/blob/master/app/config/constant.js"
    click Models "https://github.com/pankajtanwarbanna/placementmnit/tree/master/app/models"
    click Models "https://github.com/pankajtanwarbanna/placementmnit/blob/master/app/models/user.model.js"
    click Models "https://github.com/pankajtanwarbanna/placementmnit/blob/master/app/models/company.model.js"
    click Models "https://github.com/pankajtanwarbanna/placementmnit/blob/master/app/models/interview.model.js"
    click Models "https://github.com/pankajtanwarbanna/placementmnit/blob/master/app/models/placements.model.js"
    click Models "https://github.com/pankajtanwarbanna/placementmnit/blob/master/app/models/notification.model.js"

    %% Styles
    classDef frontend fill:#d4f8d4,stroke:#2d8f2d,color:#000
    classDef backend fill:#d4e4f8,stroke:#2d4a8f,color:#000
    classDef datastore fill:#faf1c0,stroke:#c4a000,color:#000
    classDef external fill:#e0e0e0,stroke:#888,color:#000
```
