This project is bounded and heavily inspired by the hexagonal architecture -ports and adapters- and implementing tagless final encoding to achieved responsibility segregation, inversion of control and emergent behavior; leading to maintainable, predictable, highly composable and orthogonal program.
In this project algebras are pure functions, with a single responsibility, that compose into repositories, services or validators and the last ones compose into modules; modules compose into the main program. All the commitments in regards underlying effects, such as Streams or Futures, are deferred to the main program allowing to constrain and inject dependency capabilities.
As we can assume that parsing errors won't happen and the domain is quite anemic; the domain model contains only plain entities and values objects without any significant creation logic.
Instructions to run the code on your local machine for development and testing purposes.
Please install sbt: The interactive build tool from here in order to build, compile, test and run the code:
For Linux (deb)
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo apt-key add
sudo apt-get update
sudo apt-get install sbt
For Linux (rpm)
curl https://bintray.com/sbt/rpm/rpm > bintray-sbt-rpm.repo
sudo mv bintray-sbt-rpm.repo /etc/yum.repos.d/
sudo yum install sbt
Run sbt stage
, this will create a launcher at http/target/universal/stage/bin/quasar-http
.
Run sbt docker:publishLocal
, this will pull openjdk:jre-alpine
and build quasar-http:0.0.1
images.
You can check it out running docker images
.
You can run the code directly from sbt-shell typing sbt
and then http/run
.
After running sbt stage
, you can run the program as fallows:
./http/target/universal/stage/bin/quasar-http
If you already created quasar-http:0.0.1
image using sbt docker:publishLocal
, you can run it in the interactive mode:
docker run -i quasar-http:0.0.1 -p 8080:8080
All testing data is generated by ScalaCheck, a library used for automated property-based testing of Scala or Java programs.
Unit tests code is under core/src/test
. To run them use sbt test
.
Integration tests code is under console/src/it
. To run them use sbt it
.
Run sbt coverageAgg
to generate an aggregated report for unit and integration tests.
The generated report will be at target/scala-2.13/scoverage-report/index.html
Statement coverage.: 98.30%
Branch coverage....: 100.00%
This project is powered by the following libraries:
- cats: Lightweight, modular, and extensible library for functional programming
- catsEffects: The IO monad for Scala
- fs2: Purely functional, effectful, resource-safe, concurrent streams for Scala
- circe: A JSON library for Scala powered by Cats
- QuickLens: Optics library to modify deeply nested case class fields
- console: Effect-type agnostic Console I/O for Cats Effect
- scalaCheck: Property-based testing for Scala
- scalaTest: Testing tool for Scala
This project is licensed under the GNU License - see the LICENSE file for details.