Code Monkey home page Code Monkey logo

spring-graphql-keycloak-boilerplate's Introduction

spring-graphql-keycloak-boilerplate

Description

This is a boilerplate project to create a Spring Boot application with GraphQL and KeyCloak integration.

Features

  • Supported both GraphQL and REST APIs
  • KeyCloak integration with the following features:
    • Single sign-on (SSO)
    • Login
    • Logout
    • Forgot password
    • Register
    • Reset password
    • Admin panel
    • And much more...
  • GraphiQL playground
  • Spring Boot DevTools
  • Already configured with PostgreSQL drivers and JPA

Tech stack

  • Spring Boot v3 (View configuration here):
    • Spring for GraphQL
    • Spring Web
    • Lombok
    • Spring Boot DevTools
    • Spring Data JPA
    • PostgreSQL Driver
  • KeyCloak v21 + Spring Security
  • GraphQL + GraphiQL
  • Maven

Initial setup

  1. Start PostgreSQL container using Docker Compose
docker-compose up -d
  1. Run KeyCloak container
chmod -x ./start-keycloak.sh && ./start-keycloak.sh

After the container is up and running, you can access the KeyCloak admin panel at http://localhost:8082/ with the following credentials:

  • Username: admin
  • Password: admin

Notice: Unfortunately, you can change the username and password by editing the start-keycloak.sh file.

  1. Setup KeyCloak realm and application client

Since KeyCloak is not part of this project, you need to manually setup the KeyCloak realm and application client.

You can follow the official documentation here.

  1. Edit the application.properties file

You need to update the configured KeyCloak realm and client ID (and secret if you have one).

spring.security.oauth2.client.provider.keycloak.issuer-uri=http://localhost:8082/realms/<REALM NAME>
spring.security.oauth2.resourceserver.jwt.issuer-uri=http://localhost:8082/realms/<REALM NAME>
spring.security.oauth2.client.registration.keycloak.client-id=<CLIENT NAME>
spring.security.oauth2.client.registration.keycloak.client-secret=<CLIENT SECRET>
  1. Run the application with Maven
mvn spring-boot:run

spring-graphql-keycloak-boilerplate's People

Contributors

filippofinke avatar lucadibello avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

filippofinke

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.