# aryan-2511/placement_portal_nie architecture

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

- Interactive diagram: https://gitdiagram.com/aryan-2511/placement_portal_nie
- Repository: https://github.com/aryan-2511/placement_portal_nie

## Overview

##### Project Overview
- The portal consists of a frontend (React with Vite, Tailwind CSS, and supporting tools like ESLint) and a backend (written in Go).
- The backend handles business logic related to student applications, authentication, notifications, scheduling, and administrative functions.
- There is an implied database layer (the backend/db folder contains connection logic) and integration with external services (email and notifications utilities).

##### Main Components
a. Frontend:
- User Interface: includes pages for students and administrators.
- Components: React components for layout (NavBar, Sidebar, MainLayout), shared components (forms, tables, stat cards), and feature-specific components (applications, authentication, dashboard graphs, events, opportunities).
- Routing and Context: Route components like PrivateRoute, StudentRoutes, CoordinatorRoutes; global state management using UserContext and DarkModeContext.
- Services Integration: API service modules such as apiAuth, apiApplications, etc.

b. Backend:
- Controllers: A variety of handlers (e.g., authentication, student details, placements, events, scheduling) that map to API endpoints.
- Models: Data structures for core entities such as user, admin, applications, opportunities, placed students, etc.
- Database Connection: Code within the db folder managing connectivity (likely to an SQL or NoSQL database).
- Utilities: Helpers for tasks including JWT handling, email sending, password hashing, CORS, and token validation.
- Executable: Main entry point (main.go) and built binary (Placement_NIE.exe).

c. Supporting Components:
- External Services: Email notification services (send_email, sendBulkEmail in utils) indicate integration with an external email service.
- Middleware / Security: Authentication middleware and token validation logic (jwt.go, validateToken.go, authMiddleware.go).

##### Relationships and Interactions
- Users interact with the frontend (web browser) to view dashboards, apply for opportunities, etc.
- The frontend calls REST API endpoints on the backend for authentication, CRUD operations on opportunities, applications, scheduling, etc.
- The backend middleware handles authentication and authorization before directing requests to the appropriate controller.
- Backend controllers interact with the database through the connection module to persist or retrieve data.
- Utility functions facilitate processes such as email notifications and hashing passwords, linking to external services and ensuring secure data transactions.

##### Architectural Patterns / Design Principles
- Separation of Concerns: Clear division of responsibilities between frontend UI components, API controllers, data models, and utility functions.
- MVC-like Structure: The backend follows a pattern where controllers manage business logic, models represent data structures, and utilities provide cross-cutting support.
- Modular and Extensible Design: Both frontend and backend directories are organized into modules that allow for scalability and ease of maintenance.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Title
    Title["Placement_Portal_NIE"]:::title

    %% User
    User["User (Web Browser)"]:::user

    %% Frontend Subgraph
    subgraph "Frontend (React/Vite, Tailwind CSS)"
        UI_Layout["UI Layout Components"]:::frontend
        Shared_UI["Shared UI Components"]:::frontend
        Feature_Applications["Applications"]:::frontend
        Feature_Authentication["Authentication"]:::frontend
        Feature_Dashboard["Dashboard"]:::frontend
        Feature_Events["Events"]:::frontend
        Feature_Opportunities["Opportunities"]:::frontend
        Routing["Routing (PrivateRoute, StudentRoutes, CoordinatorRoutes)"]:::frontend
        Global_State["Global State (UserContext, DarkModeContext)"]:::frontend
        APIServices["API Services Integration"]:::frontend

        UI_Layout --> Shared_UI
        Shared_UI --> Feature_Applications
        Feature_Applications --> Feature_Authentication
        Feature_Authentication --> Feature_Dashboard
        Feature_Dashboard --> Feature_Events
        Feature_Events --> Feature_Opportunities
        Feature_Opportunities --> Routing
        Routing --> Global_State
        Global_State --> APIServices
    end

    %% Backend Subgraph
    subgraph "Backend (Go)"
        Main_Entry["Main Entry (main.go)"]:::backend
        Controllers["Backend Controllers"]:::backend
        Models["Backend Models"]:::backend
        Utilities["Backend Utilities & Middleware"]:::backend
        Database["Database Connection"]:::backend
        Executable["Executable Binary (Placement_NIE.exe)"]:::backend
        External_Email["External Email Service"]:::external

        Main_Entry --> Controllers
        APIServices --- Controllers
        Controllers --> Models
        Controllers --> Utilities
        Controllers --> Database
        Utilities --> External_Email
        Controllers --> Executable
    end

    %% Connection from User to Frontend
    User --> UI_Layout

    %% Style Definitions
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef backend fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef external fill:#FFD580,stroke:#000,stroke-width:2px;
    classDef user fill:#FFB6C1,stroke:#000,stroke-width:2px;
    classDef title fill:#D3D3D3,stroke:#000,stroke-width:2px, font-size:16px, font-weight:bold;

    %% Click Events for Frontend Components
    click UI_Layout "https://github.com/aryan-2511/placement_portal_nie/tree/main/frontend/src/components/layout"
    click Shared_UI "https://github.com/aryan-2511/placement_portal_nie/tree/main/frontend/src/components/shared"
    click Feature_Applications "https://github.com/aryan-2511/placement_portal_nie/tree/main/frontend/src/features/applications"
    click Feature_Authentication "https://github.com/aryan-2511/placement_portal_nie/tree/main/frontend/src/features/authentication"
    click Feature_Dashboard "https://github.com/aryan-2511/placement_portal_nie/tree/main/frontend/src/features/dashboard"
    click Feature_Events "https://github.com/aryan-2511/placement_portal_nie/tree/main/frontend/src/features/events"
    click Feature_Opportunities "https://github.com/aryan-2511/placement_portal_nie/tree/main/frontend/src/features/opportunities"
    click Routing "https://github.com/aryan-2511/placement_portal_nie/tree/main/frontend/src/routes"
    click Global_State "https://github.com/aryan-2511/placement_portal_nie/tree/main/frontend/src/context"
    click APIServices "https://github.com/aryan-2511/placement_portal_nie/tree/main/frontend/src/services"

    %% Click Events for Backend Components
    click Main_Entry "https://github.com/aryan-2511/placement_portal_nie/blob/main/backend/main.go"
    click Controllers "https://github.com/aryan-2511/placement_portal_nie/tree/main/backend/controllers"
    click Models "https://github.com/aryan-2511/placement_portal_nie/tree/main/backend/models"
    click Database "https://github.com/aryan-2511/placement_portal_nie/blob/main/backend/db/connection.go"
    click Utilities "https://github.com/aryan-2511/placement_portal_nie/tree/main/backend/utils"
    click Executable "https://github.com/aryan-2511/placement_portal_nie/blob/main/backend/Placement_NIE.exe"
```
