# prabhatjain8/tpowebsite architecture

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

- Interactive diagram: https://gitdiagram.com/prabhatjain8/tpowebsite
- Repository: https://github.com/prabhatjain8/tpowebsite

## Overview

##### Project type and purpose
- This is a full-stack Training & Placement Office (TPO) web application.
- Frontend: Angular SPA providing login/registration, role-based UI (admin, student), company listings, upcoming/past drives, comments, enrollment.
- Backend: ASP.NET Core Web API (C#) with Entity Framework Core for data, Identity for auth, email service for verification/reset.

##### File structure
- TPOwebsiteFrontend/ – Angular CLI structure:
– src/app/Components/* – feature components (login, register, upcoming, past, admin, comment, password)
– src/app/*.service.ts – Angular services calling HTTP endpoints
- TPOwebsiteBackend/ – ASP.NET Core Web API:
– Controllers/*.cs – HTTP endpoints (LoginRegisterController, CompanyController, CommentController, UpcomingController)
– Models/* – EF Core DbContext, entity classes (Company, Upcoming, Student, Enroll, CompanyComment), repositories, email service interfaces/implementations, token models
– Migrations/* – EF Core migrations snapshot
– Program.cs & appsettings.json – DI registration, configuration (DB connection, email settings)
– launchSettings.json – local ASP.NET profile

##### README for additional insights
- Features: email-verified login/register, role-based access, comment & enroll flows, admin CRUD on companies/upcoming, password change & reset via email.

a. Main components
1. Angular Frontend (SPA)
2. ASP.NET Core Web API
3. SQL Database (via EF Core)
4. Email Service (SMTP provider)
5. Authentication/Authorization (ASP.NET Identity or JWT)
b. Relationships & interactions
- UserBrowser ↔ HTTP(S) ↔ Angular SPA
- Angular SPA ↔ HTTP API ↔ Controllers ↔ Services/Repositories ↔ EF Core ↔ Database
- Web API ↔ SMTP server (for email verification & password reset)
- Auth flow: API issues JWT or token, stored in frontend, used on subsequent calls.
c. Architectural patterns & principles
- Layered architecture: Presentation (Angular), API Controllers, Business Services/Repositories, Data Access (EF Core).
- Dependency Injection (registered in Program.cs).
- Repository pattern (ICompanyRepository, IUpcomingRepository, IEmailService).
- Modular frontend: Angular modules, component hierarchy, route guards (AuthGuard).
d. Technologies & frameworks
- Frontend: Angular, TypeScript, Angular Router, HTTPClient, Reactive Forms
- Backend: ASP.NET Core 6, Entity Framework Core, ASP.NET Identity, Dependency Injection
- Database: SQL Server (or configured RDBMS)
- Email: SMTP (configured via EmailSettings in appsettings.json)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External
    Browser["User Browser"]:::external

    %% Frontend
    subgraph "Angular SPA" 
        direction TB
        AuthGuard["AuthGuard"]:::frontend
        subgraph "Components"
            direction TB
            Login["LoginComponent"]:::frontend
            Register["RegisterComponent"]:::frontend
            Verify["VerifyComponent"]:::frontend
            ForgotPwd["ForgotPasswordComponent"]:::frontend
            ChangePwd["ChangePasswordComponent"]:::frontend
            ChangeForgotPwd["ChangeForgotPasswordComponent"]:::frontend
            Details["DetailsComponent"]:::frontend
            AddCompany["AddCompanyComponent"]:::frontend
            EditCompany["EditCompanyComponent"]:::frontend
            ListCompanyAdmin["ListCompanyComponent"]:::frontend
            UpcomingList["UpcomingListComponent"]:::frontend
            UpcomingAdd["UpcomingAddComponent"]:::frontend
            Description["DescriptionComponent"]:::frontend
            Eligibility["EligibilityComponent"]:::frontend
            EnrolledAdmin["EnrolledAdminComponent"]:::frontend
            EnrolledListA["EnrolledListAComponent"]:::frontend
            EnrolledStudent["EnrolledStudentComponent"]:::frontend
            Enrolled["EnrolledComponent"]:::frontend
            StudentUpcoming["StudentUpcomingComponent"]:::frontend
            PastList["PastListComponent"]:::frontend
            CommentsUI["CommentsComponent"]:::frontend
            ListCompanyStudents["ListCompanyStudentsComponent"]:::frontend
        end
        subgraph "Services"
            direction TB
            CommentSvc["CommentService"]:::frontend
            CompanySvc["CompanyService"]:::frontend
            UpcomingSvc["UpcomingService"]:::frontend
        end
    end

    Browser -->|"uses"| AuthGuard
    Browser -->|"interacts"| Login
    Browser --> Register
    Browser --> Verify
    Browser --> ForgotPwd
    Browser --> ChangePwd
    Browser --> ChangeForgotPwd
    Browser --> Details
    Browser --> UpcomingList
    Browser --> PastList
    Browser --> ListCompanyAdmin
    Browser --> ListCompanyStudents

    Login --> CommentSvc
    Register --> CompanySvc
    Details --> UpcomingSvc

    CommentSvc -->|HTTP| WebAPI
    CompanySvc -->|HTTP| WebAPI
    UpcomingSvc -->|HTTP| WebAPI

    %% Backend
    subgraph "ASP.NET Core Web API"
        direction TB
        subgraph "Controllers"
            direction TB
            LoginRegisterCtrl["LoginRegisterController"]:::backend
            CompanyCtrl["CompanyController"]:::backend
            UpcomingCtrl["UpcomingController"]:::backend
            CommentCtrl["CommentController"]:::backend
        end
        subgraph "Services & Repositories"
            direction TB
            AuthService["Authentication Service"]:::backend
            CompanyServiceBE["CompanyService"]:::backend
            UpcomingServiceBE["UpcomingService"]:::backend
            CommentServiceBE["CommentService"]:::backend
            EmailService["EmailService"]:::backend
            ICompanyRepo["ICompanyRepository"]:::backend
            CompanyRepo["CompanyRepository"]:::backend
            IUpcomingRepo["IUpcomingRepository"]:::backend
            UpcomingRepo["UpcomingRepository"]:::backend
        end
        subgraph "Data Access"
            direction TB
            AppDbContext["AppDbContext"]:::db
        end
        subgraph "External"
            SMTP["SMTP Server"]:::external
        end
    end

    WebAPI["Web API"]:::backend
    CompanyCtrl --> CompanyServiceBE
    UpcomingCtrl --> UpcomingServiceBE
    CommentCtrl --> CommentServiceBE
    LoginRegisterCtrl --> AuthService
    AuthService --> AppDbContext
    CompanyServiceBE --> ICompanyRepo
    ICompanyRepo --> CompanyRepo
    CompanyRepo --> AppDbContext
    UpcomingServiceBE --> IUpcomingRepo
    IUpcomingRepo --> UpcomingRepo
    UpcomingRepo --> AppDbContext
    CommentServiceBE --> AppDbContext
    LoginRegisterCtrl --> EmailService
    EmailService --> SMTP
    AppDbContext -->|reads/writes| SQLDB

    WebAPI --> LoginRegisterCtrl
    WebAPI --> CompanyCtrl
    WebAPI --> UpcomingCtrl
    WebAPI --> CommentCtrl

    %% Database
    SQLDB["SQL Database"]:::db

    %% Click Events
    click AuthGuard "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteFrontend/src/app/auth.guard.ts"
    click CommentSvc "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteFrontend/src/app/comment.service.ts"
    click CompanySvc "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteFrontend/src/app/company.service.ts"
    click UpcomingSvc "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteFrontend/src/app/upcoming.service.ts"
    click Login "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteFrontend/src/app/Components/login/login.component.ts"
    click Register "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteFrontend/src/app/Components/register/register.component.ts"
    click Verify "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteFrontend/src/app/Components/verify/verify.component.ts"
    click ForgotPwd "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteFrontend/src/app/Components/forgot/forgot.component.ts"
    click ChangePwd "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteFrontend/src/app/Components/change-password/change-password.component.ts"
    click ChangeForgotPwd "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteFrontend/src/app/Components/change-forgot-password/change-forgot-password.component.ts"
    click Details "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteFrontend/src/app/Components/details/details.component.ts"
    click AddCompany "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteFrontend/src/app/Components/Admin/add-company/add-company.component.ts"
    click EditCompany "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteFrontend/src/app/Components/Admin/edit-company/edit-company.component.ts"
    click ListCompanyAdmin "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteFrontend/src/app/Components/Admin/list-company/list-company.component.ts"
    click UpcomingList "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteFrontend/src/app/Components/Upcoming/upcoming-list/upcoming-list.component.ts"
    click UpcomingAdd "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteFrontend/src/app/Components/Upcoming/upcoming-add/upcoming-add.component.ts"
    click Description "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteFrontend/src/app/Components/Upcoming/description/description.component.ts"
    click Eligibility "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteFrontend/src/app/Components/Upcoming/eligibility/eligibility.component.ts"
    click EnrolledAdmin "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteFrontend/src/app/Components/Upcoming/enrolled-admin/enrolled-admin.component.ts"
    click EnrolledListA "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteFrontend/src/app/Components/Upcoming/enrolled-list-a/enrolled-list-a.component.ts"
    click EnrolledStudent "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteFrontend/src/app/Components/Upcoming/enrolled-student/enrolled-student.component.ts"
    click Enrolled "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteFrontend/src/app/Components/Upcoming/enrolled/enrolled.component.ts"
    click StudentUpcoming "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteFrontend/src/app/Components/Upcoming/student-upcoming/student-upcoming.component.ts"
    click PastList "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteFrontend/src/app/Components/Past/past-list/past-list.component.ts"
    click CommentsUI "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteFrontend/src/app/Components/Past/comments/comments.component.ts"
    click ListCompanyStudents "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteFrontend/src/app/Components/Student/list-company-students/list-company-students.component.ts"
    click LoginRegisterCtrl "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteBackend/Controllers/LoginRegisterController.cs"
    click CompanyCtrl "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteBackend/Controllers/CompanyController.cs"
    click UpcomingCtrl "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteBackend/Controllers/UpcomingController.cs"
    click CommentCtrl "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteBackend/Controllers/CommentController.cs"
    click AppDbContext "https://github.com/prabhatjain8/tpowebsite/blob/main/TPOwebsiteBackend/Models/AppDbContext.cs"

    %% Styles
    classDef frontend fill:#AED6F1,stroke:#3498DB,color:#1B4F72
    classDef backend fill:#ABEBC6,stroke:#27AE60,color:#145A32
    classDef db fill:#F9E79F,stroke:#F1C40F,color:#7D6608
    classDef external fill:#D7BDE2,stroke:#8E44AD,color:#4A235A
```
