A PHP-based university portal for faculty and students to create groups, host events, manage threads, and chat in real time. This project is created as submission to Full Stack Programming course final project. The project mainly observe our backend framework we make.
- UniversityHub
UniversityHub is a REST API backend that supports a university social platform. Users (students and lecturers) can:
- Register and log in to their accounts
- Create and join groups (public or private)
- Start discussion threads within groups
- Chat inside threads
- Create and view events tied to groups
- Upload profile pictures and event posters
- Language: PHP (no framework)
- Database: MySQL / MariaDB
- Architecture: MVC — Controllers, Services, Repositories, Models
- Session Management: PHP native sessions
- File Storage: Local filesystem (
APP/DATABASE/)
├── APP/
│ ├── API/ # Route entry points per resource
│ │ ├── AUTH/
│ │ ├── ACCOUNT/
│ │ ├── GROUP/
│ │ ├── MEMBER/
│ │ ├── EVENT/
│ │ ├── THREAD/
│ │ ├── CHAT/
│ │ ├── JOIN/
│ │ ├── IMAGE/
│ │ ├── MAHASISWA/
│ │ └── DOSEN/
│ ├── CONTROLLERS/ # Request handling & validation
│ ├── SERVICE/ # Business logic
│ ├── REPOSITORY/ # Database queries
│ ├── MODELS/ # Data models
│ ├── MIDDLEWARE/ # Auth middleware
│ ├── CORE/ # DB connection & media storage
│ ├── DATABASE/ # Uploaded file storage
│ ├── config.php # App-wide constants
│ ├── route.php # URL router
│ ├── boot.php # Session bootstrapper
│ └── index.php # App entry point
├── DOCUMENTATION/
│ └── DDL.sql # Database schema
├── TESTING/ # Dev/test utilities
├── .env # Environment variables (gitignored)
└── index.php # Root redirect to login
| Table | Description |
|---|---|
mahasiswa |
Student profiles (NRP, name, gender, birth date, year) |
dosen |
Lecturer profiles (NPK, name) |
akun |
User accounts (username, password hash, role flags) |
grup |
Groups created by users (public or private, with a join code) |
member_grup |
Group membership pivot table |
thread |
Discussion threads within a group |
chat |
Messages within a thread |
event |
Events associated with a group |
All routes are prefixed by /universityhub/APP/.
| Method | Action |
|---|---|
POST |
Login with username + password |
DELETE |
Logout current session |
GET |
Get currently logged-in account |
| Method | Action |
|---|---|
POST |
Create a new account (Mahasiswa or Dosen) |
PUT |
Update account info or change password |
DELETE |
Delete account by NRP (student) or NPK (lecturer) |
| Method | Action |
|---|---|
GET |
Search students by keyword with pagination (limit, offset, keyword) |
| Method | Action |
|---|---|
GET |
Search lecturers by keyword with pagination (limit, offset, keyword) |
| Method | Action |
|---|---|
POST |
Create a group (nama, deskripsi, jenis) |
GET |
Get group by ID, by logged-in user (mine=true), or search by name |
PUT |
Update group details |
DELETE |
Delete a group |
| Method | Action |
|---|---|
POST |
Add a member to a group (idgrup, username) |
GET |
Get all members of a group (idgrup) |
DELETE |
Remove a member from a group |
| Method | Action |
|---|---|
POST |
Join a private group using a join code (idgrup, username, kode) |
| Method | Action |
|---|---|
POST |
Create an event with optional poster upload |
GET |
Get events for a group (idgrup) with keyword/pagination |
PUT |
Update event details |
DELETE |
Delete an event by ID |
| Method | Action |
|---|---|
POST |
Create a thread in a group (idgrup, username) |
GET |
Get threads by group ID or by thread ID |
PUT |
Update thread status |
DELETE |
Close a thread |
| Method | Action |
|---|---|
POST |
Send a message (idthread, username, isi) |
GET |
Get all messages in a thread (idthread) |
PUT |
Edit a message |
DELETE |
Delete a message |
| Method | Action |
|---|---|
POST |
Upload a profile picture or event poster |
PUT |
Rename an existing image |
Authentication is session-based using PHP $_SESSION. The middleware class AuthMiddleware handles session reads/writes.
There are three roles defined in config.php:
| Role | Description |
|---|---|
MAHASISWA |
Student — can join groups, post threads and chats, attend events |
DOSEN |
Lecturer — same capabilities as Mahasiswa |
ADMIN |
Administrator — manages accounts and platform content |
Private groups require a join code (6 random uppercase letters) for members to join.
-
Clone the repository
git clone <repo-url> cd universityhub
-
Create the database
Import the schema from
DOCUMENTATION/DDL.sqlinto your MySQL/MariaDB instance:mysql -u root -p < DOCUMENTATION/DDL.sql -
Configure environment
Create a
.envfile in the root (see Configuration below). -
Serve with a local server
Place the project in your web server's root (e.g. XAMPP's
htdocs/universityhub) and start Apache + MySQL. -
Verify
Visit
http://localhost/universityhub/— you should be redirected to the login page.
Create a .env file in the project root:
DATABASE_ADDRESS=localhost
DATABASE_USERNAME=root
DATABASE_PASSWORD=
DATABASE_NAME=fullstackKey constants defined in APP/config.php:
| Constant | Value | Description |
|---|---|---|
ACCOUNT_ROLE |
[MAHASISWA, DOSEN, ADMIN] |
Valid user roles |
GROUP_TYPES |
[Privat, Publik] |
Group visibility options |
ALLOWED_PICTURE_EXTENSION |
[jpg, jpeg, png, webp] |
Valid image uploads |
MAX_IMAGE_SIZE |
2MB |
Max upload file size |
CODE_LENGTH |
6 |
Group join code length |
