# karanbastola84/college-care architecture

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

- Interactive diagram: https://gitdiagram.com/karanbastola84/college-care
- Repository: https://github.com/karanbastola84/college-care

## Overview

##### Project type and purpose
- From the file tree and the minimal README title “college-care-system,” we see a Java-based web application structured around Java Servlets, JSPs, Filters, Services, DTOs, and DAOs, packaged with Maven.
- It follows an MVC-style monolithic architecture to handle user registration, login, profile management, admin dashboard, password reset, account deletion, etc., backed by a relational database (schema.sql).

##### File structure
- Top-level artifacts: pom.xml (Maven), mvnw scripts (build), README.md.
- src/main/java/com/example/collegecaresystem/controller → all HTTP endpoints (Servlets).
- src/main/java/com/example/collegecaresystem/filter → request filters (AuthenticationFilter, AuthorizationFilter).
- src/main/java/com/example/collegecaresystem/service → business-logic services (AuthService, UserService).
- src/main/java/com/example/collegecaresystem/dto → data transfer objects (UserDTO).
- src/main/java/com/example/collegecaresystem/utils → helper classes (DBConnectionUtil, PasswordHash).
- src/main/java/model → persistence layer (UserDAO, Contact, Report, User).
- src/main/resources/schema.sql → DB schema.
- src/main/webapp/WEB-INF/view → JSPs organized by admin vs. user views.
- Configuration: web.xml for servlet and filter mappings; static assets under assets/css.

##### README
- The README only gives the project name; no extra architecture hints. We rely on conventions and file-layout patterns.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Entity
    Browser["Student/Admin User"]:::external

    %% Web Tier
    subgraph "Web Tier"
        direction TB
        subgraph "Filter Layer"
            direction TB
            AuthFilter["AuthenticationFilter"]:::web
            AuthzFilter["AuthorizationFilter"]:::web
        end
        subgraph "Controllers (Servlets)"
            direction TB
            HelloServlet["HelloServlet"]:::web
            LoginServlet["LoginServlet"]:::web
            RegisterServlet["RegisterServlet"]:::web
            LogoutServlet["LogoutServlet"]:::web
            ResetPasswordServlet["ResetPasswordServlet"]:::web
            UpdateProfileServlet["UpdateProfileServlet"]:::web
            UserProfileServlet["UserProfileServlet"]:::web
            UserDashboardServlet["UserDashboardServlet"]:::web
            AdminDashboardServlet["AdminDashboardServlet"]:::web
            DeleteAccountServlet["DeleteAccountServlet"]:::web
        end
    end

    %% Business Tier
    subgraph "Business Tier"
        direction TB
        AuthService["AuthService"]:::business
        UserService["UserService"]:::business
        UserDTO["UserDTO"]:::dto
    end

    %% Util Layer
    subgraph "Utility Classes"
        direction TB
        DBConnUtil["DBConnectionUtil"]:::util
        PasswordHash["PasswordHash"]:::util
    end

    %% Data Tier
    subgraph "Persistence Layer"
        direction TB
        UserDAO["UserDAO"]:::data
        UserEntity["User"]:::data
        ContactEntity["Contact"]:::data
        ReportEntity["Report"]:::data
    end

    %% Views
    subgraph "JSP Views"
        direction TB
        indexJSP["index.jsp"]:::view
        loginJSP["login.jsp"]:::view
        registerJSP["register.jsp"]:::view
        resetPasswordJSP["resetpassword.jsp"]:::view
        deleteAccountJSP["deleteaccount.jsp"]:::view
        editProfileJSP["editprofile.jsp"]:::view
        userProfileJSP["userprofile.jsp"]:::view
        userDashboardJSP["user/dashboard.jsp"]:::view
        adminDashboardJSP["admin/dashboard.jsp"]:::view
    end

    %% Database
    Database["Relational Database"]:::db

    %% Connections
    Browser -->|HTTP Request| AuthFilter
    AuthFilter -->|pass| AuthzFilter
    AuthzFilter -->|dispatch| HelloServlet
    AuthzFilter --> LoginServlet
    AuthzFilter --> RegisterServlet
    AuthzFilter --> LogoutServlet
    AuthzFilter --> ResetPasswordServlet
    AuthzFilter --> UpdateProfileServlet
    AuthzFilter --> UserProfileServlet
    AuthzFilter --> UserDashboardServlet
    AuthzFilter --> AdminDashboardServlet
    AuthzFilter --> DeleteAccountServlet

    HelloServlet -->|calls| AuthService
    LoginServlet -->|calls| AuthService
    RegisterServlet -->|calls| UserService
    LogoutServlet -->|calls| AuthService
    ResetPasswordServlet -->|calls| AuthService
    UpdateProfileServlet -->|calls| UserService
    UserProfileServlet -->|calls| UserService
    UserDashboardServlet -->|calls| UserService
    AdminDashboardServlet -->|calls| UserService
    DeleteAccountServlet -->|calls| UserService

    AuthService -->|uses| DBConnUtil
    AuthService -->|uses| PasswordHash
    AuthService -->|uses| UserDAO
    UserService -->|uses| DBConnUtil
    UserService -->|uses| UserDAO
    UserDAO -->|manages| UserEntity
    UserDAO -->|manages| ContactEntity
    UserDAO -->|manages| ReportEntity
    UserDAO -->|JDBC| Database
    DBConnUtil -->|connects| Database

    HelloServlet -->|renders| indexJSP
    LoginServlet -->|renders| loginJSP
    RegisterServlet -->|renders| registerJSP
    ResetPasswordServlet -->|renders| resetPasswordJSP
    DeleteAccountServlet -->|renders| deleteAccountJSP
    UpdateProfileServlet -->|renders| editProfileJSP
    UserProfileServlet -->|renders| userProfileJSP
    UserDashboardServlet -->|renders| userDashboardJSP
    AdminDashboardServlet -->|renders| adminDashboardJSP

    indexJSP -->|HTML Response| Browser
    loginJSP --> Browser
    registerJSP --> Browser
    resetPasswordJSP --> Browser
    deleteAccountJSP --> Browser
    editProfileJSP --> Browser
    userProfileJSP --> Browser
    userDashboardJSP --> Browser
    adminDashboardJSP --> Browser

    %% Click Events
    click AuthFilter "https://github.com/karanbastola84/college-care/blob/main/src/main/java/com/example/collegecaresystem/filter/AuthenticationFilter.java"
    click AuthzFilter "https://github.com/karanbastola84/college-care/blob/main/src/main/java/com/example/collegecaresystem/filter/AuthorizationFilter.java"
    click HelloServlet "https://github.com/karanbastola84/college-care/blob/main/src/main/java/com/example/collegecaresystem/HelloServlet.java"
    click LoginServlet "https://github.com/karanbastola84/college-care/blob/main/src/main/java/com/example/collegecaresystem/controller/LoginServlet.java"
    click RegisterServlet "https://github.com/karanbastola84/college-care/blob/main/src/main/java/com/example/collegecaresystem/controller/RegisterServlet.java"
    click LogoutServlet "https://github.com/karanbastola84/college-care/blob/main/src/main/java/com/example/collegecaresystem/controller/LogoutServlet.java"
    click ResetPasswordServlet "https://github.com/karanbastola84/college-care/blob/main/src/main/java/com/example/collegecaresystem/controller/ResetPasswordServlet.java"
    click UpdateProfileServlet "https://github.com/karanbastola84/college-care/blob/main/src/main/java/com/example/collegecaresystem/controller/UpdateProfileServlet.java"
    click UserProfileServlet "https://github.com/karanbastola84/college-care/blob/main/src/main/java/com/example/collegecaresystem/controller/UserProfileServlet.java"
    click UserDashboardServlet "https://github.com/karanbastola84/college-care/blob/main/src/main/java/com/example/collegecaresystem/controller/UserDashboardServlet.java"
    click AdminDashboardServlet "https://github.com/karanbastola84/college-care/blob/main/src/main/java/com/example/collegecaresystem/controller/AdminDashboardServlet.java"
    click DeleteAccountServlet "https://github.com/karanbastola84/college-care/blob/main/src/main/java/com/example/collegecaresystem/controller/DeleteAccountServlet.java"
    click AuthService "https://github.com/karanbastola84/college-care/blob/main/src/main/java/com/example/collegecaresystem/service/AuthService.java"
    click UserService "https://github.com/karanbastola84/college-care/blob/main/src/main/java/com/example/collegecaresystem/service/UserService.java"
    click UserDTO "https://github.com/karanbastola84/college-care/blob/main/src/main/java/com/example/collegecaresystem/dto/UserDTO.java"
    click DBConnUtil "https://github.com/karanbastola84/college-care/blob/main/src/main/java/com/example/collegecaresystem/utils/DBConnectionUtil.java"
    click PasswordHash "https://github.com/karanbastola84/college-care/blob/main/src/main/java/com/example/collegecaresystem/utils/PasswordHash.java"
    click UserDAO "https://github.com/karanbastola84/college-care/blob/main/src/main/java/model/UserDAO.java"
    click UserEntity "https://github.com/karanbastola84/college-care/blob/main/src/main/java/model/User.java"
    click ContactEntity "https://github.com/karanbastola84/college-care/blob/main/src/main/java/model/Contact.java"
    click ReportEntity "https://github.com/karanbastola84/college-care/blob/main/src/main/java/model/Report.java"
    click indexJSP "https://github.com/karanbastola84/college-care/blob/main/src/main/webapp/index.jsp"
    click loginJSP "https://github.com/karanbastola84/college-care/blob/main/src/main/webapp/WEB-INF/view/login.jsp"
    click registerJSP "https://github.com/karanbastola84/college-care/blob/main/src/main/webapp/WEB-INF/view/register.jsp"
    click resetPasswordJSP "https://github.com/karanbastola84/college-care/blob/main/src/main/webapp/WEB-INF/view/resetpassword.jsp"
    click deleteAccountJSP "https://github.com/karanbastola84/college-care/blob/main/src/main/webapp/WEB-INF/view/deleteaccount.jsp"
    click editProfileJSP "https://github.com/karanbastola84/college-care/blob/main/src/main/webapp/WEB-INF/view/editprofile.jsp"
    click userProfileJSP "https://github.com/karanbastola84/college-care/blob/main/src/main/webapp/WEB-INF/view/userprofile.jsp"
    click userDashboardJSP "https://github.com/karanbastola84/college-care/blob/main/src/main/webapp/WEB-INF/view/user/dashboard.jsp"
    click adminDashboardJSP "https://github.com/karanbastola84/college-care/blob/main/src/main/webapp/WEB-INF/view/admin/dashboard.jsp"

    %% Styles
    classDef external fill:#dddddd,stroke:#888888,color:#333333
    classDef web fill:#bbdefb,stroke:#1e88e5,color:#0d47a1
    classDef business fill:#c8e6c9,stroke:#43a047,color:#1b5e20
    classDef data fill:#ffe0b2,stroke:#fb8c00,color:#e65100
    classDef util fill:#fff9c4,stroke:#fbc02d,color:#f57f17
    classDef dto fill:#e1bee7,stroke:#8e24aa,color:#4a148c
    classDef view fill:#d1c4e9,stroke:#5e35b1,color:#311b92
    classDef db fill:#b2dfdb,stroke:#00897b,color:#004d40
```
