Purely Functional HTTP microservice
Simple POC for dockerized HTTP microservice using Scala in a functional programming way.
Prerequisites
- JDK 17 (jenv can help)
- SBT
- Docker
- Minikube
- Terraform
Stack
Application stack
| SCOPE | TECH | |————————————-|————————————————————————–| | ✅ Effects | cats-effect | | ✅ Logging | log4cats | | ✅ Jdbc (plain, transactions, etc..) | doobie | | ✅ Db migration | fly4s | | ✅ Http client and server | http4s | | ✅ Http route definitions | tapir | | ✅ Config | pureconfig | | ✅ Json | circe | | ✅ Refinement types | refined | | | ⬜ Unit tests | munit | | ⬜ IT tests | testcontainers |
Infrastructure stack
| SCOPE | TECH | |—————————|————————————————————————————–| | ⬜ Project as template | g8 | | ✅ Containerized app | Docker via DockerSbt | | ⬜ Containers orchestrator | K8s | | ⬜ Service mesh | Istio |
Local Usage
First of all you have to publish the docker image of the app into your local repository with
./deployLocalDockerImage.sh
Then you can choose to either run the app with docker-compose
or minikube
.
Docker
Run the deploy script to run the app and the database with docker-compose
.infra/local/docker-compose/deploy.sh
⚠️ You should use
http
and nothttps
beware that Chrome by default usehttps
Minikube
Run the deploy script to run the app and the database with minikube. Services are not port forwarded by default.
.infra/local/minikube/deploy.sh
Customize
To customize this project please read the guide