Overview
The Extracurricular Management System uses environment-specific configuration for both backend and frontend. This guide covers all available configuration options, best practices, and security considerations.Backend Configuration
The backend is configured viabackend/src/main/resources/application.properties.
Server Configuration
The port on which the Spring Boot application listens for HTTP requests.
Database Configuration
Connection Settings
application.properties
JDBC connection URL for MySQL database. Key parameters:
createDatabaseIfNotExist=true: Auto-creates database on first runuseSSL=false: Disables SSL (set totruein production with certificates)allowPublicKeyRetrieval=true: Required for MySQL 8.0+ authentication
Database username. Use a dedicated application user, not
root.Database password. Should be strong and unique per environment.
Schema Management Strategy
Controls how Hibernate manages database schema:
update: Automatically updates schema on entity changes (development)validate: Only validates schema matches entities (production recommended)create: Drops and recreates schema on startup (testing only)create-drop: Creates schema on startup, drops on shutdown (testing only)none: No schema management by Hibernate
The EMS entities use
@Version for optimistic locking (see Event.java:83). This prevents lost updates during concurrent modifications, especially critical during high-traffic event registrations.JWT Authentication
JWT (JSON Web Token) configuration for stateless authentication.application.properties
Secret key for signing JWT tokens. Must be:
- At least 256 bits (32+ characters)
- Hex-encoded or securely random
- Property name uses “secrete” (not “secret”) to match
JwtUtils.java:26
JWT token expiration time in milliseconds.
86400000= 24 hours (default)3600000= 1 hour604800000= 7 days
Email (SMTP) Configuration
EMS uses the Adapter Pattern for email notifications. TheOutlookEmailAdapter supports both Outlook/Office365 and other SMTP providers.
Development (Mailtrap)
application.properties
Production (Outlook/Office365)
application.properties
Configuration Reference
SMTP server hostname:
- Mailtrap:
sandbox.smtp.mailtrap.io - Outlook:
smtp.office365.com - Gmail:
smtp.gmail.com - Amazon SES:
email-smtp.{region}.amazonaws.com
SMTP server port:
587: STARTTLS (recommended)465: SSL/TLS2525: Mailtrap alternative port
SMTP authentication username (usually the email address).
SMTP authentication password or app-specific password.
Enable SMTP authentication.
Enable STARTTLS for encrypted connections.
Environment Variables
For production deployments, use environment variables instead of hardcoded values:application.properties
${VAR_NAME:default_value} uses the environment variable if set, otherwise falls back to the default.
Frontend Configuration
The React frontend uses Vite’s environment variable system.Environment File
Createfrontend/ems-frontend/.env:
.env
Base URL for backend API requests. All API calls are prefixed with this value.Examples:
- Development:
http://localhost:8080/api - Staging:
https://staging-api.example.com/api - Production:
https://api.example.com/api
Vite requires environment variables to be prefixed with
VITE_ to be exposed to the client code.Environment-Specific Configuration
npm run dev→.env.developmentnpm run build→.env.productionnpm run build --mode staging→.env.staging
Accessing Variables in Code
Access environment variables in your React components:src/services/api.js
Configuration Management
Development Setup
-
Copy example files:
-
Edit with your values:
- Database credentials
- JWT secret (generate with
openssl rand -hex 32) - SMTP settings (use Mailtrap for dev)
-
Add to
.gitignore:
Production Deployment
Use Secrets Management
Never hardcode production secrets. Use:
- AWS Secrets Manager
- HashiCorp Vault
- Kubernetes Secrets
- Docker Swarm Secrets
- Azure Key Vault
Validation
Set schema validation to This ensures the application fails to start if schema doesn’t match entities.
validate mode:Configuration Checklist
Database user created with appropriate permissions
Strong, unique JWT secret generated (32+ characters)
SMTP credentials tested and working
Environment variables configured for all secrets
Production uses
ddl-auto=validate, not updateSSL/TLS enabled for database connections in production
Frontend API URL points to correct backend
All sensitive files added to
.gitignoreSecrets stored in secure secrets manager (production)
Troubleshooting
Property Not Found Error
Property Not Found Error
Problem:
Could not resolve placeholder 'secreteJwtString'Solution: Ensure the property name matches exactly in application.properties. Note the spelling “secrete” (not “secret”) to match the @Value annotation in JwtUtils.java:26.Database Connection Failed
Database Connection Failed
Problem: Unable to connect to MySQLSolutions:
- Verify MySQL is running
- Check credentials are correct
- Ensure database user has proper permissions
- For remote databases, check firewall rules
- Add
&serverTimezone=UTCto connection URL if timezone errors occur
Email Not Sending
Email Not Sending
Problem: SMTP authentication failuresSolutions:
- For Outlook: Use an app password, not your main password
- Verify
starttls.enable=trueand port is 587 - Check firewall isn’t blocking SMTP port
- Test credentials with a mail client
Frontend Can't Reach Backend
Frontend Can't Reach Backend
Problem: API requests fail with CORS or connection errorsSolutions:
- Verify
VITE_API_BASE_URLis correct - Check backend is running and accessible
- Ensure CORS is configured in Spring Security
- Check browser console for specific error messages
Next Steps
Deployment
Deploy your configured application to production
Security
Learn about security architecture and best practices
API Reference
Explore available API endpoints
Architecture
Understand the system architecture