Skip to content

usherkielvin/cephra-queue-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

904 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Cephra Logo

Cephra QMS β€” EV Charging Queue Management System

Cephra is a full-stack EV charging queue management system designed to optimize station operations, reduce wait times, and improve customer flow.

Built as a Data Structures and Algorithms project, it integrates a Java desktop system, a PHP web application, and a shared MySQL database with real-time updates.


πŸš€ TL;DR

  • ⚑ Priority-based EV queue system (low battery first)
  • πŸ”„ Real-time updates using WebSocket + SSE
  • πŸ–₯️ Multi-interface system (Admin, Customer, Monitor)
  • πŸ”— Java + PHP connected directly to one MySQL database
  • πŸ“ˆ Designed for scalability and real-world station workflows

πŸ“Œ Why This Project Matters

EV infrastructure is growing rapidly, but queue handling at charging stations remains inefficient.

Cephra solves this by:

  • πŸ€– Automating queue prioritization
  • ⏳ Reducing idle bay time
  • πŸ‘€ Providing real-time visibility for both customers and operators
  • 🏭 Simulating a real production environment using multiple systems

🧩 Features

  • ⏱️ Real-time queue management across 8 charging bays
  • 🚦 Priority scheduling (battery < 20%)
  • ⚑ Automatic bay assignment (Fast / Normal)
  • πŸ–₯️ Live station monitor display (TV-ready)
  • πŸ“² Customer queue tracking and charging progress
  • πŸ› οΈ Admin dashboard for operations and control
  • πŸ”” Real-time updates via WebSocket and Server-Sent Events

πŸ–₯️ System Components

1. Admin Panel (Java Swing)
  • πŸ—‚οΈ Queue management
  • πŸͺ« Bay allocation
  • πŸ‘¨β€πŸ’Ό Staff and transaction control
  • πŸ“Š Real-time monitoring
2. Phone Simulator (Java Swing)
  • πŸ“± Simulates customer mobile interface
  • ⏳ Queue status and charging progress
3. Web Application (PHP)
  • 🌐 Customer interface (browser-based)
  • πŸ›‘οΈ Admin dashboard (SSE-powered)
  • πŸ–₯️ Monitor display (WebSocket-powered)

πŸ› οΈ Tech Stack

Layer Technology
πŸ–₯️ Desktop App Swing, Maven
🌐 Web Backend PDO
πŸ—„οΈ Database
πŸ”— Connection HikariCP
πŸ”„ Real-time WebSocket (Ratchet), Server-Sent Events
βœ‰οΈ Email PHPMailer
🎨 Frontend HTML, CSS, JavaScript, Bootstrap

πŸ—οΈ Architecture

Both Java and PHP systems connect directly to a shared MySQL database.

flowchart TD
	subgraph Java App
		A[JDBC]
	end
	subgraph PHP Web
		B[PDO]
	end
	A -- Shared DB --> DB[(MySQL cephradb)]
	B -- Shared DB --> DB
	DB -- Notifications --> SSE[Server-Sent Events]
	DB -- Notifications --> WS[WebSocket]
	SSE -- Admin Updates --> Admin[Admin Panel]
	WS -- Monitor Display --> Monitor[Monitor]
Loading

Real-Time Flow

  • πŸ›ŽοΈ MySQL triggers log updates into a notifications table
  • πŸ“’ PHP services read and broadcast updates
  • ⚑ Clients receive instant updates without refresh

🧠 Data Structures & Algorithms

QueueFlow
  • 🏁 Uses PriorityQueue<Entry>
  • πŸ”‹ Vehicles with battery < 20% are prioritized
  • ⏩ FIFO preserved within same priority
BayManagement
  • πŸͺ« Assigns available charging bays dynamically
  • ⚑ Supports Fast and Normal chargers
ChargingManager
  • ⏲️ Uses background Timer
  • πŸ”‹ Battery increases 1% per tick
  • πŸ† Auto-completes at 100%
Ticket Format
  • FCH001 β€” Fast charging
  • NCH001 β€” Normal charging
  • FCHP001 / NCHP001 β€” Priority tickets

πŸ“‚ Project Structure

Cephra-QMS/
β”œβ”€β”€ src/main/java/cephra/
β”‚   β”œβ”€β”€ Admin/
β”‚   β”œβ”€β”€ Database/
β”‚   β”œβ”€β”€ Frame/
β”‚   β”œβ”€β”€ Phone/
β”‚   └── Launcher.java
β”œβ”€β”€ src/main/resources/
β”œβ”€β”€ Appweb/
β”‚   β”œβ”€β”€ Admin/
β”‚   β”œβ”€β”€ User/
β”‚   β”œβ”€β”€ Monitor/
β”‚   └── shared/
└── pom.xml

βš™οΈ Setup

Requirements

  • β˜• Java 21+
  • πŸ”¨ Maven
  • πŸ—„οΈ MySQL 8+
  • 🐘 PHP (local server like Apache/Nginx)

1. Database Setup

Run:

Appweb/shared/notifications_setup.sql

2. Configure Web App

Create .env file:

DB_HOST=127.0.0.1
DB_NAME=cephradb
DB_USER=root
DB_PASSWORD=yourpassword

3. Configure Java App

Edit:

src/main/resources/db.properties

Set your database password:

dataSource.password=yourpassword

4. Run Web App

Serve the Appweb/ folder using your PHP server.


5. Run Java App

mvn exec:java

🌐 Access



πŸ“Š Future Improvements

  • πŸ“± Mobile app (React Native / Flutter)
  • πŸ”— API layer (Spring Boot REST)
  • ☁️ Cloud deployment (AWS / GCP)
  • πŸ’³ Payment gateway integration
  • πŸ€– Predictive queue optimization (AI-based)

πŸ‘₯ Team

Usher Kielvin Ponce Project Lead, Backend
Mark Dwayne Dela Cruz Web UI/UX
Dizon Dizon Backend, Database
Kenji Hizon Java Frontend

πŸ“„ License

MIT License

About

Java + PHP queue management system for EV charging stations, implementing priority queues, bay allocation, and real-time event-driven sync across a dual-interface architecture.

Topics

Resources

License

Stars

Watchers

Forks

Contributors