Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

██╗   ██╗███╗   ██╗██╗      ██████╗  ██████╗ ████████╗██╗ ██████╗███████╗
██║   ██║████╗  ██║██║      ██╔══██╗██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
██║   ██║██╔██╗ ██║██║█████╗██████╔╝██║   ██║   ██║   ██║██║     ███████╗
██║   ██║██║╚██╗██║██║╚════╝██╔══██╗██║   ██║   ██║   ██║██║     ╚════██║
╚██████╔╝██║ ╚████║██║      ██████╔╝╚██████╔╝   ██║   ██║╚██████╗███████║
 ╚═════╝ ╚═╝  ╚═══╝╚═╝      ╚═════╝  ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝

Java Maven MySQL HikariCP License

A console-based university management system built in Java. Supports three roles (admin, professor, student), course enrollment, grading, notifications, messaging, a rule-based chatbot, and data export.


Features

Area What it does
Auth PBKDF2+salt password hashing, role-based login
Users Create, edit, delete, search users across all roles
Courses Add courses, assign professors, search by code or name
Enrollment Students enroll in courses; duplicate enrollment blocked at DB level
Grading Professors submit grades per enrollment (A–F with +/−)
Notifications Send to one user or broadcast to all; mark read, delete
Messaging Send a subject+body message to any user
Chatbot Rule-based assistant — enroll by code, view grades, grade distribution, professor lookup
Export Dump users/courses/enrollments to a timestamped .txt file under ~/university_exports/
Connection pool HikariCP with prepared-statement cache

Prerequisites

You need three things installed before you build:

Option A — XAMPP (recommended for local dev)

  1. Download XAMPP from apachefriends.org
  2. Install and open the XAMPP Control Panel
  3. Click Start next to MySQL
  4. Open phpMyAdmin (button in the panel) and create a database:
CREATE DATABASE university;

Default XAMPP credentials: user root, no password. That matches the defaults in config.properties — nothing to change.

Option B — Standalone MySQL

Install MySQL, then:

CREATE DATABASE university;

Update src/main/resources/config.properties with your credentials (see Configuration below).


Setup

1. Clone / download

git clone https://github.com/your-username/university-management.git
cd university-management

2. Configure the database

Edit src/main/resources/config.properties:

db.url=jdbc:mysql://localhost:3306/university
db.user=root
db.password=          # leave blank for XAMPP default, or fill yours in
db.pool.size=10

You can also set environment variables instead if you prefer not to touch the file:

DB_URL      DB_USER     DB_PASSWORD

3. Build

mvn compile

Tables are created automatically on first run — no need to run the .sql file manually.


Running

Direct run (development)

mvn exec:java

Fat jar (portable, share with anyone)

mvn package
java -jar target/university-management-1.0-SNAPSHOT-jar-with-dependencies.jar

The fat jar bundles MySQL connector and HikariCP, so the only requirement on the target machine is JDK 17+ and a running MySQL instance.


Default login

Username Password Role
admin admin123 Administrator

The admin account is seeded automatically if no admin exists in the database. Change the password after first login via Manage Users → Edit User.


Project structure

src/main/java/com/university/
├── Main.java
├── config/         Database connection (HikariCP) + table initializer
├── model/          Plain POJOs: User, Course, Enrollment, Notification, Message
├── dao/            All SQL lives here, prepared statements only
├── service/        Business logic layer
├── security/       PBKDF2 password hashing, input validation
├── ui/             Console menus per role + shared helpers
├── util/           File exporter, logger wrapper
└── datastructures/ Custom ArrayList, LinkedList, Queue, Stack (coursework)

Chatbot commands

The chatbot accepts natural-language-ish input. Type help inside it for the full list.

enroll me in CS101
show my grades
my courses
show grade distribution for CS101
what courses does Smith teach
list students with grades below C in CS101
assign Dr Smith to course CS101    (admin only)
help
exit

Export

Exports land in ~/university_exports/<role>/ as timestamped .txt files. Available for all three roles; students only see their own enrollment data.


Tech stack

What Why
Java 17 LTS, records and sealed classes available if needed later
Maven Standard build tool, reproducible builds
MySQL 8 FK constraints, ENUM type, ON DELETE CASCADE all handled at the DB layer
HikariCP 5 Fastest JDBC pool available; prepared-statement cache baked in
PBKDF2WithHmacSHA256 JDK stdlib crypto, no extra dependency needed

What I learnt building this

  • Layered architecture in practice. Splitting one large file into dao / service / ui layers made each piece individually testable and easy to read. The DAO layer being the single place all SQL lives meant fixing a query fixed it everywhere.

  • Connection pooling matters even locally. Swapping raw DriverManager.getConnection() for HikariCP removed per-query connection overhead and made the app noticeably snappier during bulk operations like "send to all users."

  • Push constraints to the database. Duplicate enrollment prevention started as an if (exists) return false check in Java. The UNIQUE KEY unique_enrollment constraint in the schema means the database enforces it even if the application code has a bug or two concurrent requests slip through.

  • PBKDF2 over MD5/SHA. Storing a simple SHA-256 hash is breakable with a rainbow table in seconds. PBKDF2 with a random salt and 65536 iterations makes offline brute-force attacks genuinely expensive, and the entire thing is in the JDK standard library.

  • Custom data structures vs stdlib. Writing MyArrayList, MyLinkedList, MyQueue, and MyStack from scratch was useful for understanding what those structures are doing under the hood. In production code you would always use java.util — the JDK implementations are battle-tested and handle edge cases that hand-rolled versions typically miss.

  • Config over hardcoding. Putting DB credentials in config.properties with environment variable overrides means the same jar can be pointed at a dev, staging, or production database without a recompile.

  • Reading before writing. Every bug I chased came from touching a function without first tracing all its callers. The fix was always smaller and in a more central place than the symptom suggested.


License

MIT

About

A Java-based console university management system with role-based access for administrators, professors, and students. Features course management, enrollment, grading, notifications, messaging, a rule-based chatbot, data export, secure PBKDF2 authentication, and MySQL persistence with a layered DAO/service architecture.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages