A modern, responsive portfolio website built with Spring Boot and Thymeleaf, featuring a professional design, multilingual support, and a fully functional contact form with anti-spam protection.
π Live Demo: azmarach.work
- π± Responsive Design - Mobile-first approach with modern CSS Grid and Flexbox
- π Multilingual Support - Czech and English translations
- π§ Contact Form - Functional email sending with Mailgun integration and anti-spam protection
- π‘οΈ Security - Rate limiting, honeypot fields, and content-based spam detection
- β‘ Performance - Optimized with compression, caching, and HTTP/2
- π Monitoring - Spring Boot Actuator with health checks and metrics
- π¨ Modern UI - Custom fonts (League Gothic + Source Code Pro), gradient backgrounds
- π Production Ready - Proper logging, error handling, and security headers
- π Retry Logic - Email sending with exponential backoff and failure handling
- Spring Boot 3.x - Main framework
- Spring MVC - Web layer
- Spring Security - Security configuration
- Mailgun API - Professional email delivery service
- Unirest HTTP Client - API communication
- Thymeleaf - Template engine
- Bean Validation - Form validation
- Lombok - Boilerplate reduction
- HTML5 - Semantic markup
- CSS3 - Modern styling with CSS Grid/Flexbox
- JavaScript ES6+ - Interactive functionality
- Custom Fonts - League Gothic & Source Code Pro
- Responsive Design - Mobile-first approach
- Railway - Cloud hosting platform
- Cloudflare - CDN and DNS management
- Mailgun - Transactional email service
- Environment Variables - Secure configuration
- Spring Boot Actuator - Health checks and metrics
- SLF4J + Logback - Structured logging
- Correlation IDs - Request tracing
- MDC Context - Request correlation and tracing
- Java 17+
- Maven 3.6+
- Mailgun account with verified domain
-
Clone the repository
git clone https://github.com/charamzic/azmaweb.git cd azmaweb -
Set up Mailgun
- Create account at mailgun.com
- Add and verify your domain (e.g.,
mg.yourdomain.com) - Get your API key from the Mailgun dashboard
-
Create environment file
# Create .env file in project root CONTACT_EMAIL_ENABLED=true [email protected] CONTACT_EMAIL_FROM=Portfolio Contact <[email protected]> MAILGUN_API_KEY=your-mailgun-api-key MAILGUN_DOMAIN=mg.yourdomain.com
-
Run the application
mvn spring-boot:run
-
Access the application
- Website: http://localhost:8080
- Health check: http://localhost:8080/actuator/health
The application supports multiple profiles:
default- Basic configurationdevelopment- Development settings (hot reload, debug logging)production- Production optimizations (caching, security headers)railway- Railway-specific configuration
# Run with specific profile
mvn spring-boot:run -Dspring.profiles.active=development-
Create Mailgun Account
- Sign up at mailgun.com
- Choose EU or US region based on your location
-
Domain Verification
- Add your domain (e.g.,
mg.yourdomain.com) - Add DNS records (MX, TXT, CNAME) as provided by Mailgun
- Wait for verification (can take up to 48 hours)
- Add your domain (e.g.,
-
Configuration
MAILGUN_API_KEY=key-xxxxxxxxxxxxxxxxxxxxxxxxx MAILGUN_DOMAIN=mg.yourdomain.com CONTACT_EMAIL_FROM=Portfolio <[email protected]> [email protected]
- EU Region: Uses
https://api.eu.mailgun.net(configured by default) - US Region: Uses
https://api.mailgun.net(updateMAILGUN_API_BASEif needed)
- From: Your professional email ([email protected])
- To: Your personal email where you receive contact forms
- Reply-To: Automatically set to the contact form submitter's email
- Rate Limiting - 3 submissions per 15 minutes per IP
- Honeypot Fields - Hidden fields to catch bots
- Content Analysis - Spam keyword detection
- Input Validation - Server-side validation for all fields
- Email Validation - Proper email format validation with support for "Name " format
- Content Security Policy (CSP)
- HTTP Strict Transport Security (HSTS)
- X-Frame-Options: DENY
- X-Content-Type-Options: nosniff
- Secure cookies in production
- API Authentication - Secure Mailgun API key authentication
- Retry Logic - Exponential backoff with 3 retry attempts
- Error Handling - Comprehensive error logging and user feedback
- Email Masking - Sensitive email addresses masked in logs
curl https://azmarach.work/actuator/health# JVM Memory
curl https://azmarach.work/actuator/metrics/jvm.memory.used
# HTTP Requests
curl https://azmarach.work/actuator/metrics/http.server.requestscurl https://azmarach.work/actuator/info- Contact form submissions are logged with correlation IDs
- Email sending attempts and failures are tracked
- Mailgun provides delivery analytics and logs
- Connect GitHub repository to Railway
- Set environment variables in Railway dashboard
- Deploy automatically on git push
# Contact Form Configuration
CONTACT_EMAIL_ENABLED=true
[email protected]
CONTACT_EMAIL_FROM=Portfolio Contact <[email protected]>
# Mailgun Configuration
MAILGUN_API_KEY=key-xxxxxxxxxxxxxxxxxxxxxxxxx
MAILGUN_DOMAIN=mg.yourdomain.com
# Admin Configuration
ADMIN_USERNAME=your-admin-username
ADMIN_PASSWORD=your-secure-admin-password
# Railway Configuration
SPRING_PROFILES_ACTIVE=railwaysrc/
βββ main/
β βββ java/work/azmarach/azmaweb/
β β βββ config/ # Security, I18n configuration
β β βββ controller/ # Web and API controllers
β β βββ dto/ # Data transfer objects
β β βββ service/ # Business logic services
β β βββ ContactService # Email handling with Mailgun
β β βββ RateLimitService # Rate limiting logic
β β βββ SpamDetectionService # Anti-spam protection
β βββ resources/
β β βββ static/ # CSS, JavaScript, images
β β βββ templates/ # Thymeleaf templates
β β βββ messages*.properties # Internationalization
βββ test/ # Unit and integration tests
Update CSS variables in style.css:
:root {
--primary-color: #9d4edd;
--primary-light: #c77dff;
--primary-dark: #7209b7;
}- Update
messages.properties(English) - Update
messages_cs.properties(Czech) - Modify Thymeleaf templates in
templates/
Modify ContactService.formatEmailBody() method to customize email format
- Create
messages_[lang].properties - Add language to
I18nConfig.java - Update language switcher in
layout.html
- Set
CONTACT_EMAIL_ENABLED=falseto disable email sending and log submissions instead - Use Mailgun's sandbox domain for testing
- Check Mailgun logs for delivery status and issues
- Create Thymeleaf template in
templates/ - Add controller method in appropriate controller
- Update navigation in
layout.html
- Check Configuration: Verify all environment variables are set correctly
- Mailgun Domain: Ensure domain is verified in Mailgun dashboard
- API Key: Verify API key is correct and has sending permissions
- DNS Records: Confirm all DNS records are properly configured
- Logs: Check application logs for detailed error messages with correlation IDs
- "Domain not verified": Complete Mailgun domain verification process
- "Invalid API key": Check API key in Mailgun dashboard
- Rate limiting: Wait for rate limit reset or adjust limits in
RateLimitService
This project is open source and available under the MIT License.
Jan Charamza
- Website: azmarach.work
- GitHub: @charamzic
- LinkedIn: charamzic
- Email: [email protected]
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
β Star this repository if you found it helpful!