Skip to content

raeperd/realworld-springboot-java

Repository files navigation

RealWorld example apps cover Build Lines of Code Coverage Reliability Rating License: MIT

ReadWorld.io backend project using spring boot java using spring-security, spring-data-jpa

Insprired by

Getting started

Build from scratch

$ ./gradlew build bootRun

Using docker

$ docker run --rm -p 8080:8080 raeperd/realworld-spring-boot-java
  • Dockerhub registry is here
  • Container tags are simply branch name of this repository following git-flow strategy

How to test

After run application, you can try one of followings

using shell script

$ ./doc/run-api-tests.sh

using postman

Import ./doc/Conduit.postman_collection.json in your postman application

And also, pure gradle test covers almost every lines of code.

More details can be found in ./doc/README.md and original source

Overview

Design Principal

  • Always final whenever possible
  • Always pacakage private class whenever possible
  • Always test every package, class, method, insturction in codes
  • Try to avoid including additional dependencies as much as possbile
    • Implements JWT generation / validation logic without 3rd party library #3
  • Try to maintiain codes in domain package to keep POJO
    • Except for special spring annotations like @Service, @Repository
    • Not to use lombok in domain pacakge classes

Diagrams

User

realworld-User

  • Separate interface for JWTGenerator and JWTParser
  • Try to do everything in UserService

JWT

realworld-Jwt

  • Try not to use 3rd party library
  • Context from JWT token can be retrieved using UserContextHolder implemtation
  • HS256JWTService do core logic
    • Symmetric JWT token signing using HS256 (includes Base64URL, SHA256)
    • Validate given token

Article

realworld-Article

  • Separate @Entity with ArticleView class
  • Favorite of articles is another @Entity
  • ArticleView contains run-time information about Article

ArticleView

realworld-ArticleView

Profile

realworld-Profile

  • Profile as sperate service since it is used widely

Performance

performance

What can be done more

  • More strict validation in application layer
  • Profile view logic can be imporved.
  • JWT Token can be improved
    • JWTToken should not contains userid.
    • Current version of JWT authentication is somewhat imperfact.
    • More details in Stop using JWT for sessions

Contact

You can contact me with email or issue in this project

License

MIT License

Referenced

About

Spring boot java implementation of realworld example.app

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages