Overview
This guide walks you through setting up the Extracurricular Management System (EMS) for local development. EMS uses a Spring Boot backend with MySQL and a React frontend with Vite.Prerequisites
Before you begin, ensure you have the following installed:Backend Requirements
- Java 21 (JDK)
- Apache Maven 3.6+
- MySQL 8.0+
Frontend Requirements
- Node.js 20+
- npm (comes with Node.js)
Verify Prerequisites
Run these commands to verify your installations:Terminal
Database Setup
Create Database User
Create a dedicated database user for the application:
The database
ems_db will be created automatically by the application on first run due to the createDatabaseIfNotExist=true parameter.Backend Setup
Configure Application Properties
Create or edit
backend/src/main/resources/application.properties:application.properties
Install Dependencies
Maven will automatically download all dependencies:This command compiles the code and runs any available tests.
Start the Backend Server
Run the Spring Boot application:The backend will start on
http://localhost:8080. You should see:Frontend Setup
Create Environment File
Create a This tells the frontend where to find the backend API.
.env file in the frontend directory:.env
Install Dependencies
Install all Node.js packages:This installs React 19, TanStack Query v5, Tailwind CSS v4, and other dependencies.
Start the Development Server
Run the Vite development server:The frontend will start on
http://localhost:5173 (or the next available port).Project Structure
Understanding the codebase layout:Development Workflow
Running Both Servers
For full-stack development, run both servers in separate terminals:Hot Reloading
- Backend: Spring Boot DevTools enables automatic restart on code changes
- Frontend: Vite provides instant hot module replacement (HMR)
Building for Production
Troubleshooting
MySQL Connection Refused
MySQL Connection Refused
Problem:
Communications link failure or connection refused errors.Solutions:- Verify MySQL is running:
sudo systemctl status mysql - Check MySQL is listening on port 3306:
sudo netstat -tlnp | grep 3306 - Verify credentials in
application.properties - Try connecting manually:
mysql -u app_user -p
Port Already in Use
Port Already in Use
Problem:
Port 8080 is already in use or Port 5173 is already in use.Solutions:- Kill the process using the port:
lsof -ti:8080 | xargs kill -9 - Change the port in configuration files:
- Backend: Modify
server.portinapplication.properties - Frontend: Vite will automatically use the next available port
- Backend: Modify
JWT Token Invalid
JWT Token Invalid
Problem: Authentication fails with token errors.Solutions:
- Ensure
secreteJwtStringinapplication.propertiesmatches the value inJwtUtils.java(backend/src/main/java/com/ems/backend/security/JwtUtils.java:26) - The secret must be at least 256 bits (32+ characters)
- Clear browser local storage and log in again
SMTP Connection Errors
SMTP Connection Errors
Problem: Email notifications fail to send.Solutions:
- For development, use Mailtrap instead of real SMTP
- Verify SMTP credentials are correct
- Check firewall isn’t blocking port 587 or 2525
- Test with a simple SMTP client
Maven Build Failures
Maven Build Failures
Problem:
mvn clean install fails with dependency errors.Solutions:- Update Maven:
mvn --versionshould be 3.6+ - Clear Maven cache:
rm -rf ~/.m2/repository - Run with
-Uflag:mvn clean install -U - Check your Java version is exactly 21
Frontend Module Not Found
Frontend Module Not Found
Problem:
Cannot find module errors when running frontend.Solutions:- Delete
node_modulesand reinstall:rm -rf node_modules && npm install - Clear npm cache:
npm cache clean --force - Verify Node.js version is 20+:
node --version - Check for package.json corruption
Next Steps
Configuration
Learn about all configuration options and environment variables
Deployment
Deploy your application to production
Architecture
Understand the system architecture
API Reference
Explore the REST API endpoints