A Spring Boot application for managing car service operations. It exposes a web UI with Thymeleaf and REST endpoints, integrates with external microservices for booking and payment, and supports OAuth2 login.
Last Update date: 2025-12-04
- Language: Java 17
- Build tool: Maven (wrapper included:
mvnw/mvnw.cmd) - Frameworks:
- Spring Boot 3.4.0
- Spring Cloud 2024.0.2
- Springdoc OpenAPI
- Databases:
- MySQL (default profile)
- H2 file DB (dev profile)
- Front-End:
- Thymeleaf
- Spring AI:
- Google GenAI
- Other: Lombok, Apache Commons Lang, Checkstyle
- Main class:
springboot.bg.harisauto.Application - Runs on port
8080by default (configurable viaserver.port).
- JDK 17+
- Maven 3.9+ (or use the provided Maven wrapper)
- MySQL 8.x (for default profile) or Docker for MailHog (optional for dev email testing)
- Run with default profile (MySQL required):
./mvnw spring-boot:run
- Run with dev profile (H2 + MailHog):
# start MailHog (optional but recommended for dev profile) docker compose -f docker-compose-mailhog.yml up -d # run app with dev profile ./mvnw spring-boot:run -Dspring-boot.run.profiles=dev
- Swagger UI:
http://localhost:8080/swagger-ui.html
check.sh— runs Checkstyle and opens the HTML report (note: has convenience for WSL + Windows Explorer).- Maven wrapper — use
./mvnwinstead of globally installed Maven. - Optional:
docker-compose-mailhog.yml— starts MailHog on ports 1025 (SMTP) and 8025 (Web UI).
Configuration lives primarily in:
src/main/resources/application.yml(default)src/main/resources/application-dev.yml(dev profile)src/test/resources/application-test.yml(tests)
Set these environment variables before running the app (copy/paste ready):
# Database (default profile uses MySQL)
export DB_USERNAME="your_database_username"
export DB_PASSWORD="your_database_password"
# Outbound email (default profile uses Gmail SMTP)
export EMAIL_USERNAME="your_gmail_address"
export EMAIL_PASSWORD="your_app_password"
# OAuth2 login
export GOOGLE_CLIENT_ID="your_google_client_id"
export GOOGLE_CLIENT_SECRET="your_google_client_secret"
export GITHUB_CLIENT_ID="your_github_client_id"
export GITHUB_CLIENT_SECRET="your_github_client_secret"
# AI (Gemini)
export GEMINI_API_KEY="your_gemini_api_key"
# Payments (Stripe)
export STRIPE_PUBLIC_KEY="your_stripe_public_key"Explanation and where to obtain keys:
- DB_USERNAME / DB_PASSWORD — MySQL credentials; create a user with access to database
car_service_db.
Docs: https://dev.mysql.com/doc/ - EMAIL_USERNAME / EMAIL_PASSWORD — Gmail SMTP account; for Gmail you need an App Password when 2FA is enabled.
Docs: https://support.google.com/accounts/answer/185833 - GOOGLE_CLIENT_ID / GOOGLE_CLIENT_SECRET — Create OAuth 2.0 Client ID (Web application) in Google Cloud Console.
Docs: https://developers.google.com/identity/protocols/oauth2 - GITHUB_CLIENT_ID / GITHUB_CLIENT_SECRET — Create an OAuth app in GitHub Settings → Developer settings → OAuth Apps.
Docs: https://docs.github.com/apps/oauth-apps/building-oauth-apps/creating-an-oauth-app - GEMINI_API_KEY — Obtain from Google AI Studio.
Docs: https://ai.google.dev/ - STRIPE_PUBLIC_KEY — Obtain the publishable key from Stripe Dashboard.
Docs: https://stripe.com/docs/keys
Additional service endpoints configured in application.yml:
payment-service.url— defaulthttp://localhost:8081booking-service.url— defaulthttp://localhost:8082
- Default (no profile):
- MySQL datasource
jdbc:mysql://localhost:3306/car_service_db?createDatabaseIfNotExist=true - Gmail SMTP on port 587, TLS
- OpenAPI at
/swagger-ui.html
- MySQL datasource
devprofile:- H2 file DB at
./data/testdbwith web console at/h2-console - MailHog SMTP on
localhost:1025, UI athttp://localhost:8025 - Redis cache configured (localhost:6379)
- H2 file DB at
This service communicates with external microservices via OpenFeign:
- Payment Service — base URL:
${payment-service.url}(defaulthttp://localhost:8081).- Link: payment-service
- Booking Service — base URL:
${booking-service.url}(defaulthttp://localhost:8082).- Link: booking-service
Top-level
pom.xml— Maven configurationsrc/main/java— Application sourcessrc/main/resources— App configuration, templates, static assetssrc/test/java— Testsdocker-compose-mailhog.yml— Dev email testing containercheck.sh— Checkstyle helper
Java packages
├─ api/ # API docs or specs (if used)
├─ checkstyle/ # Checkstyle configuration
├─ data/ # Local data (e.g., H2 file DB path)
├─ docker-compose-mailhog.yml # Dev SMTP testing tool
├─ pom.xml # Maven build descriptor
springboot.bg.harisauto
├── booking
│ ├── client
│ ├── dto
│ │ ├── request
│ │ └── response
│ └── service
│
├── cart
│
├── chatbot
│ ├── controller
│ ├── dto
│ └── service
│
├── common
│ ├── config
│ │ ├── ai
│ │ ├── database
│ │ ├── interceptor
│ │ ├── rest
│ │ ├── security
│ │ └── swagger
│ ├── exception
│ ├── init
│ └── logger
│
├── email
│
├── event
│
├── payment
│ ├── client
│ ├── controller
│ ├── dto
│ │ ├── request
│ │ └── response
│
├── service
│ ├── model
│ ├── repository
│ └── service
│
├── user
│ ├── model
│ ├── repository
│ └── service
│
├── validation
│ └── annotations
│
├── vehicle
│ ├── model
│ ├── repository
│ └── service
│
└── web
├── controller
├── dto
└── mapper
├─ src/main/resources/
│ ├─ application.yml # Default profile config (MySQL)
│ ├─ application-dev.yml # Dev profile (H2, Mailhog)
│ ├─ application-ci.properties # CI profile (H2 in-memory)
Resources
application.yml— default configuration, including DB, mail, OAuth, Swagger, service URLsapplication-dev.yml— dev profile overrides (H2, MailHog, Redis cache)templates/— Thymeleaf templates (auth, account, public, etc.)static/— static assets (CSS, JS)
-
All tests:
./mvnw test -
Run with a specific profile for tests (if needed):
./mvnw test -Dspring.profiles.active=test
- Checkstyle report:
Report path:
./mvnw checkstyle:checkstyle # or bash check.shtarget/site/checkstyle.html
- Default profile uses MySQL with Hibernate
ddl-auto: update. Ensure MySQL is running and accessible. - Dev profile uses H2 with console at
http://localhost:8080/h2-console(when dev profile is active).
- Username/password login with Spring Security (login page
/login) - OAuth2 login with Google and GitHub
- Role-based access (
/admin/**requiresROLE_ADMIN)
- Kristian Popov
This project is licensed under the MIT License. For more details, please refer to the file: LICENSE.