/reactify-core

Java Library for Developing Reactive Backend Systems with Keycloak Authentication, Minio Storage, OAuth2 Security, Caching, and Trace Logging Integration ...

Primary LanguageJavaApache License 2.0Apache-2.0

Reactify-core Java lib with spring boot framework, Supports using keycloak, filter, trace log, cached, minio server, exception handler, validate and call API with webclient

This README provides quickstart instructions on running reactify-core on bare metal project spring boot.

SonarCloud

CircleCI Quality Gate Status Lines of Code GitHub Release License OpenSSF Best Practices Build status

Getting Started

Gradle is the only supported build configuration, so just add the dependency to your project build.gradle file:

⬇️ Download Gradle and Maven

dependencies {
    implementation("io.github.hoangtien2k3:reactify-core:1.1.7")
}
<dependency>
   <groupId>io.github.hoangtien2k3</groupId>
   <artifactId>reactify-core</artifactId>
   <version>1.1.7</version>
</dependency>

The latest reactify version is: GitHub Release

The latest stable lib reactify version is: latestVersion Click here for more information on reactify.

  1. Correct and complete setup to start the program application.yml or application.properties with CONFIG

  2. The reference documentation includes detailed installation instructions as well as a comprehensive getting started guide.

Here is a quick teaser of a complete Spring Boot application in Java:

Start Using Lib reactify-core

1. Use annotation @ComponentScan to scan all libraries

@ComponentScan(basePackages = {
        "com.reactify.*",           // add default: com.reactify.*
        "com.example.myproject"     // varies depending on your project
})
@SpringBootApplication
public class ExampleApplication {
    public static void main(String[] args) {
        SpringApplication.run(Example.class, args);
    }
}

2. Config your project file application.yml or application.properties

# spring config
spring:
  main:
    web-application-type: reactive
    allow-bean-definition-overriding: true
  messages:
    basename: i18n/messages

  #connect db R2DBC PostgreSQL
  r2dbc:
    url: r2dbc:postgresql://localhost:5434/auth
    username: admin
    password: admin
    pool:
      max-size: 10
      initial-size: 5

  # Config connect Keycloak
  security:
    oauth2:
      client:
        provider:
          oidc:
            token-uri: ${keycloak.serverUrl}/realms/${keycloak.realm}/protocol/openid-connect/token
        registration:
          oidc:
            client-id: ${keycloak.clientId}
            client-secret: ${keycloak.clientSecret}
            authorization-grant-type: ${keycloak.grantType} #password || #client_credentials
      resourceserver:
        jwt:
          jwk-set-uri: ${keycloak.serverUrl}/realms/${keycloak.realm}/protocol/openid-connect/certs
      keycloak:
        client-id: ${keycloak.clientId}

# Web client config
client:
  #keycloak
  keycloak:
    address: http://localhost:8080/realms/ezbuy-server/protocol/openid-connect
    name: keycloak
    auth:
      client-id: ezbuy-client
      client-secret: mI92QDfvi20tZgFtjpRAPWu8TR6eMHmw
  #notification
  notification:
    internal-oauth: true
    address: http://localhost:7777/v1/transmission
    name: notiServiceClient
    pool:
      max-size: 100
      max-pending-acquire: 100
    timeout:
      read: 60000
      write: 1000

# Unauthenticated endpoints config
application:
  http-logging:
    request:
      enable: true
      header: true
      param: true
      body: true
    response:
      enable: true
      body: true
  whiteList:
    - uri: /v1/auth/generate-otp
      methods:
        - POST
    - uri: /**
      methods:
        - OPTIONS
    - uri: /v1/auth/get-all
      methods:
        - GET
  data:
    sync-data:
      limit: 500

#keycloak client config
keycloak:
  clientId: ezbuy-client
  clientSecret: mI92QDfvi20tZgFtjpRAPWu8TR6eMHmw
  realm: ezbuy-server
  serverUrl: http://localhost:8080
  grantType: password
  host: localhost

# minio server config
minio:
  bucket: ezbuy-bucket
  enabled: true
  baseUrl: http://localhost:9000
  publicUrl: http://localhost:9000/ezbuy-bucket
  accessKey: 4DoaZ0KdzpXdDlVK104t
  secretKey: nuRiQUIJNVygMOHhmtR4LT1etAa7F8PQOsRGP5oj
  private:
    bucket: ezbuy-private

3. After completing the configuration, start running the project.

  # Using Maven
  mvn spring-boot:run

  # Using Gradle
  gradle bootRun

4. Refer to the following project, used

reactify-core library for webflux microservice project: keycloak-auth-service

Contributing

If you would like to contribute to the development of this project, please follow our contribution guidelines.

Alt

Star History

Star History Chart

Contributors ✨

Contributors

License

This project is licensed under the Apache License, Version 2.0

Copyright 2024-2025 the original author Hoàng Anh Tiến.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.