Skip to content

awakelife93/spring-boot-kotlin-boilerplate

Repository files navigation

Spring Boot Boilerplate (Kotlin)

Environment & Skills

  • Application

    • Kotlin 2.0
    • Jdk 21
    • Spring boot 3.4.0
      • mvc
      • reactive
    • Gradle 8.10
    • Spring Security
    • Spring Batch
    • Springdoc OpenAPI
    • Postgresql
    • h2 database (PostgreSQL mode) - localhost environment
    • Jpa
    • QueryDSL
    • Redis
    • Jwt
    • Validation
    • Sentry
    • Kotlin Logging
    • Flyway
    • Webhook
      • Slack
      • Discord
    • Kafka
  • Test

    • Spring Boot Starter Test
    • Spring Security
    • Spring Batch
    • Junit 5
    • Mockito Kotlin
    • Mockito Inline
    • Kotest
    • Mockk
    • Instancio
    • h2 database (PostgreSQL mode)
    • Flyway
  • Etc

    • Pgadmin
    • Ktlint
    • Detekt
    • Mailhog
    • Netty resolver dns native macos

Project Guide

  • common
  • domain (post, user, auth)
  • example
    • WelcomeSignUpConsumer: Kafka Consumer(SignUp Event) Example
  • infrastructure (kafka, redis, webhook, mail)
  • security
    • spring security + jwt logic
  • utils
  • resources
    • db
      • migration: flyway sql
      • sql: spring batch postgresql metadata sql
    • application.yml
      • prod, dev, local, common, test, secret-{environment}
      • common: Write common variables for the project.
      • test: Create the variables needed for your test environment.
      • secret-{environment}: your secret variables for each environment.

Local Installation

To use the application, the following two services must be installed and running:

  • kafka
  • redis
  • mailhog

Description

  1. webhook
// example

// 1. all
webHookProvider.sendAll(
	"Subscription request received from method ${parameter.method?.name}.",
	mutableListOf("Request Body: $body")
)

// 2. target slack
webHookProvider.sendSlack(
	"Failed to send message to Kafka (foo)",
	mutableListOf("Failed to send message to Kafka: ${exception.message} / $foo")
)

// 3. target discord
webHookProvider.sendDiscord(
	"Failed to send message to Kafka (bar)",
	mutableListOf("Failed to send message to Kafka: ${exception.message} / $bar")
)
  1. mailhog

  2. lint

  3. docker-compose

    • If you plan to use it, you need to check the environment variables.
  4. create spring batch metadata table (localhost, development and production environments.)

  5. two types of tests

  6. kafka

  7. example

Author

Hyunwoo Park