Skip to content

JoxNeis/UniversityHub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UniversityHub

PHP MySQL Apache MVC University Project Made with Love

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.

Table of Contents

Overview

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

Tech Stack

  • Language: PHP (no framework)
  • Database: MySQL / MariaDB
  • Architecture: MVC — Controllers, Services, Repositories, Models
  • Session Management: PHP native sessions
  • File Storage: Local filesystem (APP/DATABASE/)

Project Structure

├── 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

Database Schema

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

API Endpoints

All routes are prefixed by /universityhub/APP/.

Auth — /AUTH

Method Action
POST Login with username + password
DELETE Logout current session
GET Get currently logged-in account

Account — /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)

Mahasiswa — /MAHASISWA

Method Action
GET Search students by keyword with pagination (limit, offset, keyword)

Dosen — /DOSEN

Method Action
GET Search lecturers by keyword with pagination (limit, offset, keyword)

Group — /GROUP

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

Member — /MEMBER

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

Join — /JOIN

Method Action
POST Join a private group using a join code (idgrup, username, kode)

Event — /EVENT

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

Thread — /THREAD

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

Chat — /CHAT

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

Image — /IMAGE

Method Action
POST Upload a profile picture or event poster
PUT Rename an existing image

Authentication & Roles

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.

Setup & Installation

  1. Clone the repository

    git clone <repo-url>
    cd universityhub
  2. Create the database

    Import the schema from DOCUMENTATION/DDL.sql into your MySQL/MariaDB instance:

    mysql -u root -p < DOCUMENTATION/DDL.sql
  3. Configure environment

    Create a .env file in the root (see Configuration below).

  4. Serve with a local server

    Place the project in your web server's root (e.g. XAMPP's htdocs/universityhub) and start Apache + MySQL.

  5. Verify

    Visit http://localhost/universityhub/ — you should be redirected to the login page.

Configuration

Create a .env file in the project root:

DATABASE_ADDRESS=localhost
DATABASE_USERNAME=root
DATABASE_PASSWORD=
DATABASE_NAME=fullstack

Key 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

About

A student and faculty portal

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors