An implementation of the authorization/authentication microservice using functional programming techniques. Based on scala, cats effect, doobie and http4s.
I am going to work with libraries from functional programing world. However, i would rather use libraries based on cats effect.
- Cats Effect - as the app core
- Http4s - as the web server
- Tapir - for describing api http endpoints
- Doobie - as database query and access library
- Scala Cache - cache based on redis for auth data
- Pure Config - for loading configuration
- Circe - for json encoding and decoding
- Fuuid - functional uuid
- log4Cats - functional logging
The easiest way to launch the application is to use one of the scripts prepared:
start-dev-env.sh
to run all required resources such as PostgresSQL or Redis as docker containersstart-dev-env.sh --withApp
to launch all required resources along with the application as docker containers
The project is divided into five separate sub-projects.
It contains configuration case classes and some base models.
It contains dao (based on doobie), migrations (flyway) and db models.
It contains service definitions.
It contains api and swagger docs definitions.
It contains main class and all objects initialization.
You can find everything you need here (http://localhost:9000/docs) after starting the application.
We are using git flow. Here are steps:
sbt clean compile
sbt scalafmtCheckAll
sbt scalastyle
sbt coverage test
sbt coverage it:test
sbt coverage e2e:test
sbt coverageAggregate
The tests are divided into three types. All in separate packages:
- unit -> package
src/test
- integration -> package
src/it
- end to end -> package
src/e2e