A comprehensive Spring Boot web application for managing treasure hunt registrations with multi-step forms, file uploads, email notifications, and admin panel.
- Responsive Landing Page with beige theme and modern design
- Interactive Plan Display with filtering by difficulty level
- Multi-step Registration Form with validation and file uploads
- Real-time Form Validation with user-friendly error messages
- File Upload Support for photos, ID documents, and medical certificates
- Email Confirmations with detailed registration information
- YouTube Video Integration for plan previews
- Secure Admin Panel with Spring Security authentication
- Dashboard with statistics and charts
- Plan Management (Create, Read, Update, Delete)
- Registration Management with status updates
- File Download capabilities for uploaded documents
- Search and Filter functionality for registrations
- Spring Boot 3.x with Java 17
- PostgreSQL Database with JPA/Hibernate
- Email Integration with JavaMailSender and Thymeleaf templates
- File Storage with validation and security
- RESTful APIs for frontend integration
- Comprehensive Validation with Bean Validation
- Responsive Design with Bootstrap 5
- Java 17 or higher
- Maven 3.6+
- PostgreSQL 13+
- Gmail account for email functionality (optional)
-- Create database
CREATE DATABASE treasure_hunt_db;
-- Create user (optional)
CREATE USER treasure_user WITH PASSWORD 'treasure_pass';
GRANT ALL PRIVILEGES ON DATABASE treasure_hunt_db TO treasure_user;Update src/main/resources/application.yml:
spring:
datasource:
url: jdbc:postgresql://localhost:5432/treasure_hunt_db
username: treasure_user
password: treasure_pass
mail:
username: ${MAIL_USERNAME}
password: ${MAIL_PASSWORD}
app:
security:
admin:
username: ${ADMIN_USERNAME}
password: ${ADMIN_PASSWORD}- Enable 2-Factor Authentication on your Gmail account
- Generate an App Password: Google Account → Security → App passwords
- Use the generated password in
application.yml
# Clone the repository
git clone <repository-url>
cd treasure-hunt-registration
# Run with Maven
mvn spring-boot:run
# Or build and run JAR
mvn clean package
java -jar target/treasure-hunt-registration-1.0.0.jar- Main Website: http://localhost:8080
- Admin Panel: http://localhost:8080/admin
- Admin Credentials: set via environment variables ADMIN_USERNAME / ADMIN_PASSWORD (no defaults)
src/
├── main/
│ ├── java/com/treasurehunt/
│ │ ├── config/ # Configuration classes
│ │ ├── controller/ # REST and Web controllers
│ │ ├── entity/ # JPA entities
│ │ ├── repository/ # Data repositories
│ │ ├── service/ # Business logic services
│ │ └── TreasureHuntApplication.java
│ └── resources/
│ ├── static/ # CSS, JS, images
│ ├── templates/ # Thymeleaf templates
│ └── application.yml # Configuration
└── test/ # Test classes
- treasure_hunt_plans: Adventure plans with pricing and details
- user_registrations: User registration data and status
- uploaded_documents: File metadata and storage information
- One plan can have many registrations
- One registration can have multiple documents
- Cascade delete for data integrity
Configure via environment variables:
# File upload limits (in bytes)
MAX_PHOTO_SIZE=2097152 # 2MB for registration photos
MAX_DOCUMENT_SIZE=5242880 # 5MB for documents
MAX_IMAGE_SIZE=5242880 # 5MB for admin image uploads
MAX_VIDEO_SIZE=52428800 # 50MB for admin video uploads
# File upload directories
FILE_UPLOAD_DIR=uploads/documents
IMAGE_UPLOAD_DIR=uploads/images
# Allowed file types
ALLOWED_PHOTO_TYPES=image/jpeg,image/jpg,image/png
ALLOWED_DOCUMENT_TYPES=application/pdf,image/jpeg,image/jpgapp:
email:
from: your-email@gmail.com
support: support@treasurehuntadventures.com
company-name: Treasure Hunt Adventuresapp:
security:
admin:
username: admin
password: admin123 # Change in production!- Hero section with call-to-action
- Plan cards with filtering
- Responsive grid layout
- Smooth scrolling navigation
- Step 1: Personal information form
- Step 2: File uploads and medical consent
- Real-time validation
- Progress indicators
- Dashboard with statistics
- Plan management interface
- Registration management
- Responsive design
- Personalized greeting
- Plan details and pricing
- Registration number
- Pre-hunt checklist
- Contact information
- Registration confirmation
- Cancellation notifications
- Admin notifications
- Spring Security with form-based login
- BCrypt password encoding
- Session management
- CSRF protection for forms
- File type validation
- Size restrictions
- Secure file naming
- Path traversal prevention
- Bean Validation annotations
- Custom validators
- Client-side validation
- Server-side validation
# Run all tests
mvn test
# Run specific test class
mvn test -Dtest=RegistrationServiceTest
# Run with coverage
mvn test jacoco:report- Unit Tests: Service layer testing
- Integration Tests: Controller and repository testing
- Security Tests: Authentication and authorization
- Change default admin credentials
- Configure production database
- Set up SSL/TLS certificates
- Configure email settings
- Set up file storage location
- Configure logging levels
- Set up monitoring and health checks
export DB_USERNAME=your_db_user
export DB_PASSWORD=your_db_password
export GMAIL_USERNAME=your_email@gmail.com
export GMAIL_APP_PASSWORD=your_app_password
export ADMIN_USERNAME=your_admin_username
export ADMIN_PASSWORD=your_secure_passwordFROM openjdk:17-jdk-slim
COPY target/treasure-hunt-registration-1.0.0.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/app.jar"]GET /api/plans- Get all available plansGET /api/plans/{id}- Get specific planPOST /api/register- Submit registrationGET /api/health- Health check
GET /admin/registrations/{id}- Get registration detailsPOST /admin/registrations/{id}/status- Update registration statusPOST /admin/plans/{id}/toggle-status- Toggle plan status
-
Database Connection Error
- Check PostgreSQL is running
- Verify connection details in
application.yml - Ensure database exists
-
Email Not Sending
- Verify Gmail credentials
- Check App Password is correct
- Ensure 2FA is enabled on Gmail
-
File Upload Errors
- Check file size limits
- Verify upload directory permissions
- Ensure allowed file types are correct
-
Admin Login Issues
- Verify admin credentials in configuration
- Check password encoding
- Clear browser cache
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Email: support@treasurehuntadventures.com
- Documentation: [Project Wiki]
- Issues: [GitHub Issues]
Built with ❤️ using Spring Boot, PostgreSQL, and Bootstrap
