📚 Spring Boot (Kotlin) Initial Setup — Complete Series
- Why Multi-Module Architecture? (Architecture Philosophy & Overall Structure)
- API Response Format Design
- Global Exception Handling (GlobalExceptionHandler)
- Swagger (OpenAPI) Configuration
- Security (JWT) Core Structure
- JWT TokenProvider
- Redis Configuration
- Validation Configuration
- Logging + MDC(traceId) Configuration
- application.yml Profile Separation (local/dev/prod)
- Multi-Module + JPA Basic Structure
- Sharing the Complete Project Template via Git ← this article
This article is the final part of the "Spring Boot (Kotlin) Initial Setup — 12-Part Series".
Throughout the previous posts, we built a production-ready foundation step by step: multi-module architecture → API → exception handling → security → logging → JPA.
Now, all of that is packaged into one complete project template and shared via Git.
🎁 1. Download the Template
You can download the template from GitHub and freely modify it for your project.
https://github.com/jaemoi/springboot-kotlin-initial-template
GitHub - jaemoi/springboot-kotlin-initial-template
A production-ready initial setup template for Spring Boot + Kotlin.
github.com
🔧 2. What’s Included in the Template
springboot_initial_setup/
├── api/
├── application/
├── batch/ (optional)
├── build.gradle.kts
├── settings.gradle.kts
└── ...
✔ Multi-Module Setup (api / application / batch)
- Clear separation of controller / service / repository layers
- Explicit module dependencies
- DTO → ServiceModel → Entity structure
✔ Unified API Response Format
- Includes
ApiResponse<T>base structure - Unified success/failure format
- ErrorCode enum included
✔ Global Exception Handling
- Centralized handler with
@RestControllerAdvice - Business/validation/server error handling
✔ JWT Security Core Structure
- TokenProvider
- JwtAuthenticationFilter
- Custom AccessDeniedHandler / EntryPoint
✔ Swagger (OpenAPI) Included
✔ Redis Basic Configuration
✔ Validation + Centralized Error Handling
✔ Logging with MDC (traceId / eventId / userId / clientIp)
- Automatically injects traceId per request
- Production-ready logging structure
✔ application.yml Profile Separation
- local / dev / prod
- Isolated environment configs
🏗 3. Things You Should Modify After Downloading
✔ 1) Change Your Package Name
The template uses com.example. Adjust it to your company/project domain.
✔ 2) Configure Your Real Database
For sharing purposes, all environment variables were removed, and an H2 in-memory DB is used by default.
spring:
datasource:
url: jdbc:mysql://~
username: xxx
password: xxx
Replace these with your actual DB settings.
✔ 3) Replace the JWT Secret Key
A dummy key is included. Generate a real key before deploying.
✔ 4) Update Swagger Title/Description
You can brand it with your own project information.
✔ 5) Remove Redis if Not Needed
🧪 4. How to Run
Local Environment
The project is configured to run with application-local.yml.
Although you can run the app using IntelliJ’s Run button,
multi-module projects sometimes confuse IDE run settings.
So the official method recommended is via Gradle:
$ ./gradlew :api:bootRun
The template runs immediately with **no environment variables needed**, using:
• embedded H2
• embedded Tomcat
• simple JWT configuration
💡 5. Why I Created This Template
One of the most challenging parts when starting Spring Boot is:
"What exactly should I set up first?"
There are many examples online, but it's extremely rare to find a template that is:
- ready for real-world extension
- easy for team collaboration
- considerate of production environments (logging, security, exception handling, etc.)
So I collected all these essentials into a single, ready-to-use template.
I'm still a developer with much to learn, so this template may have imperfections.
If you have suggestions or improvements, feel free to leave a comment — I will consider every idea carefully.
🙌 6. A Personal Note
I did not major in computer science, and the journey to becoming a developer required extra effort on my part.
I created this series hoping to help anyone who is just beginning their own development journey.
Happy coding — and thank you for reading.