Go to file
Sambo Chea a4fd70a188 Upgraded to spring boot 2.4.4 2021-03-25 11:17:40 +07:00
.github/workflows Add github actions 2020-11-26 16:05:49 +08:00
gradle/wrapper Upgraded to spring boot 2.4.4 2021-03-25 11:17:40 +07:00
src feat: add graphql exception handler 2021-03-23 17:16:31 +08:00
.gitignore refactor: application level prepare for graphql and switch to sqlite 2021-03-19 15:23:37 +08:00
Dockerfile Dockerfile fixed: use gradlew instead of gradle to run the version specified in gradle-wrapper.properties 2020-12-27 22:02:36 +03:00
LICENSE Create LICENSE 2021-03-09 16:05:52 +08:00
README.md Instruction for pre-commit hook 2021-03-03 15:33:49 +08:00
build.gradle Upgraded to spring boot 2.4.4 2021-03-25 11:17:40 +07:00
docker-compose.yml adding docker-compose file 2018-01-02 23:25:49 -08:00
example-logo.png update readme 2017-08-18 17:40:21 +08:00
gradlew updated Gradle, Spring Boot, MyBatis, Joda Time to latest 2020-09-20 14:11:34 +03:00
gradlew.bat updated Gradle, Spring Boot, MyBatis, Joda Time to latest 2020-09-20 14:11:34 +03:00


RealWorld Example App using Kotlin and Spring


Spring boot + MyBatis codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.

This codebase was created to demonstrate a fully fledged fullstack application built with Spring boot + Mybatis including CRUD operations, authentication, routing, pagination, and more.

For more information on how to this works with other frontends/backends, head over to the RealWorld repo.

How it works

The application uses Spring boot (Web, Mybatis).

  • Use the idea of Domain Driven Design to separate the business term and infrastruture term.
  • Use MyBatis to implement the Data Mapper pattern for persistence.
  • Use CQRS pattern to separate the read model and write model.

And the code organize as this:

  1. api is the web layer to implement by Spring MVC
  2. core is the business model including entities and services
  3. application is the high level services for query with the data transfer objects
  4. infrastructure contains all the implementation classes as the technique details


Integration with Spring Security and add other filter for jwt token process.

The secret key is stored in application.properties.


It uses a H2 in memory database (for now), can be changed easily in the application.properties for any other database.

Getting started

You need Java 8 installed.

./gradlew bootRun

To test that it works, open a browser tab at http://localhost:8080/tags .
Alternatively, you can run

curl http://localhost:8080/tags

Try it out with Docker

You need Docker installed.

docker-compose up -d

Try it out with a RealWorld frontend

The entry point address of the backend API is at http://localhost:8080, not http://localhost:8080/api as some of the frontend documentation suggests.

Run test

The repository contains a lot of test cases to cover both api test and repository test.

./gradlew test

Use git pre-commit hook

Follow the instruction from google-java-format-git-pre-commit-hook to use a pre-commit hook to make the code format style stable from different contributors.


Please fork and PR to improve the code.