-
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
- 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.
- db
To use the application, the following two services must be installed and running:
- kafka
- redis
- mailhog
- webhook
- enable & route endpoint
- default enable true
- types
- slack
- discord
- enable & route endpoint
// 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")
)
-
mailhog
- mailhog is a tool for testing email sending.
- If you want to use MailHog, the default SMTP port is 1025. Of course, if you already have your own preferred setup, you can freely adjust the port as needed.
- dashboard: http://localhost:8025
- Please check the settings in application-local.yml and application-secret-local.yml.
-
lint
- ktlint
- using the official lint rules by default.
- report output
- build/reports/ktlint
- detekt
- using rules
- report output
- build/reports/detekt
- ktlint
-
docker-compose
- If you plan to use it, you need to check the environment variables.
-
create spring batch metadata table (localhost, development and production environments.)
- Run your ddl script or Please refer
to github - spring batch
- Since this project uses postgresql, the spring.batch.jdbc.initialize-schema: always option does not work.
- localhost & test environment, generating batch-postgresql-metadata-schema.sql.
- Run your ddl script or Please refer
to github - spring batch
-
two types of tests
- mockito
- kotest & mockk
- if you want to bypass Spring Security authentication issues.
- SecurityListenerFactory
- BaseIntegrationController
// example listeners(SecurityListenerFactory()) Then("Call DELETE /api/v1/users/{userId}").config(tags = setOf(SecurityListenerFactory.NonSecurityOption)) { // ... }
- if you want to bypass Spring Security authentication issues.
-
kafka
- KafkaTopicMetaProvider
- Manage metadata related to topics
- DLQ
- DLQs are dynamically created in this project.
- default fallback partition: 1 (if the topic partition does not exist)
- KafkaTopicMetaProvider
-
- When a user signs up, an event is generated to send an email to the recipient.
- You can test this flow by referring to the MailHog and Kafka sections.
- When a user signs up, an event is generated to send an email to the recipient.
Hyunwoo Park