Smart Campus Event Management System
CampusPulse is a robust, full-stack Spring Boot application designed to streamline event management within a campus or organizational environment. It provides an intuitive platform for organizers to create events, and for students/users to browse and register for upcoming activities.
- Event Lifecycle Management: Create, update, and manage events with statuses (
UPCOMING,ONGOING,COMPLETED,CANCELLED). - User Registration: Secure registration system with participant limits and deadline tracking.
- Role-Based Access Control: Differentiate between standard users and event organizers using Spring Security.
- Automated Email Notifications: Integrated SMTP support for sending event updates and verification tokens.
- Responsive UI: Server-side rendered views using Thymeleaf templates.
- In-Memory Database: Powered by H2 database for zero-config local development and testing, with automatic schema generation via Hibernate.
- Backend: Java 17, Spring Boot 3.2.5
- Frontend: HTML, CSS
- Security: Spring Security 6
- Data Access: Spring Data JPA, Hibernate
- Database: H2 Database (File-based)
- Template Engine: Thymeleaf (with Spring Security extras)
- Build Tool: Maven
- Utilities: Lombok (to reduce boilerplate)
- Navigate to the project root directory.
- Run the application using the Maven Spring Boot plugin:
mvn spring-boot:run
- The application will start on
http://localhost:8081.
The application uses a file-based H2 database stored at ./data/campusdb.
You can access the H2 console via your browser:
- URL:
http://localhost:8081/h2-console - JDBC URL:
jdbc:h2:file:./data/campusdb - Username:
sa - Password: (leave blank)
The application is configured using application.properties. Here is the core setup:
# Server
server.port=8081
# H2 Database Setup
spring.datasource.url=jdbc:h2:file:./data/campusdb;AUTO_SERVER=TRUE
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
# JPA / Hibernate
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=update
# Thymeleaf Configuration
spring.thymeleaf.cache=false
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.htmlThe heart of CampusPulse is the Event entity. It leverages JPA for database mapping and Lombok for concise code generation:
package com.campus.events.model;
import jakarta.persistence.*;
import lombok.*;
import java.time.LocalDateTime;
@Entity
@Table(name = "events")
@Getter @Setter @NoArgsConstructor @AllArgsConstructor @Builder
public class Event {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false, length = 200)
private String title;
@Enumerated(EnumType.STRING)
@Column(name = "event_type", nullable = false, length = 50)
private EventType eventType;
@Column(name = "event_date", nullable = false)
private LocalDateTime eventDate;
@Column(name = "registration_deadline")
private LocalDateTime registrationDeadline;
@Column(name = "max_participants")
@Builder.Default
private int maxParticipants = 0;
@Enumerated(EnumType.STRING)
@Column(nullable = false, length = 20)
@Builder.Default
private Status status = Status.UPCOMING;
// Checks if a student can currently register
public boolean isRegistrationOpen() {
if (registrationDeadline == null) return status == Status.UPCOMING;
return LocalDateTime.now().isBefore(registrationDeadline)
&& status == Status.UPCOMING
&& (maxParticipants == 0 || currentParticipants < maxParticipants);
}
public enum EventType {
TECHNICAL, CULTURAL, SPORTS, WORKSHOP, SEMINAR, OTHER
}
public enum Status {
UPCOMING, ONGOING, COMPLETED, CANCELLED
}
}src/main/java/com/campus/events/- Core Java source code/config- Security and application configuration classes/controller- Spring MVC web controllers/model- JPA Entities (Event,User,Registration)/repository- Spring Data JPA repositories/service- Business logic implementation
src/main/resources/- Static assets, Thymeleaf templates, and configurationapplication.properties- App configuration properties/templates- HTML views
data/- Auto-generated file-based H2 database storage