https://github.com/geirolz/fp-microservice
A purely functional microservice template in Scala
https://github.com/geirolz/fp-microservice
cats distributed-systems fp functional-programming kafka microservice scala template
Last synced: 7 months ago
JSON representation
A purely functional microservice template in Scala
- Host: GitHub
- URL: https://github.com/geirolz/fp-microservice
- Owner: geirolz
- Created: 2021-04-30T12:20:59.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-03-16T00:11:07.000Z (7 months ago)
- Last Synced: 2025-04-13T09:05:31.924Z (7 months ago)
- Topics: cats, distributed-systems, fp, functional-programming, kafka, microservice, scala, template
- Language: Scala
- Homepage: https://geirolz.github.io/fp-microservice/
- Size: 621 KB
- Stars: 12
- Watchers: 2
- Forks: 1
- Open Issues: 55
-
Metadata Files:
- Readme: README.md
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
## Purely Functional HTTP microservice
[](https://github.com/geirolz/fp-microservice/actions)
[](https://gitlab.com/moneyfarm-tech/sandbox/steward)
[](https://mergify.io)
[](https://www.codacy.com/gh/geirolz/fp-microservice/dashboard?utm_source=github.com&utm_medium=referral&utm_content=geirolz/fp-microservice&utm_campaign=Badge_Grade)
Simple POC for dockerized HTTP microservice using Scala in a functional programming way.
1. [Prerequisites](#Prerequisites)
2. [Stack](#Stack)
3. [Usage](#Usage)
4. [Customize](#Customize)
5. [Roadmap](#Roadmap)
## Prerequisites
- JDK 17 (jenv can help)
- SBT
- Docker
- Minikube
- Terraform
## Stack
### Application stack
| SCOPE | TECH |
|-------------------------------------|--------------------------------------------------------------------------|
| ✅ Effects | [cats-effect](https://github.com/typelevel/cats-effect) |
| ✅ Logging | [log4cats](https://github.com/typelevel/log4cats) |
| ✅ Jdbc (plain, transactions, etc..) | [doobie](https://github.com/tpolecat/doobie) |
| ✅ Db migration | [fly4s](https://github.com/geirolz/fly4s) |
| ✅ Http client and server | [http4s](https://github.com/http4s/http4s) |
| ✅ Http route definitions | [tapir](https://github.com/softwaremill/tapir) |
| ✅ Config | [pureconfig](https://github.com/pureconfig/pureconfig) |
| ✅ Json | [circe](https://github.com/circe/circe) |
| ✅ Refinement types | [refined](https://github.com/fthomas/refined) | |
| ⬜ Unit tests | [munit](https://github.com/scalameta/munit) |
| ⬜ IT tests | [testcontainers](https://github.com/testcontainers/testcontainers-scala) |
### Infrastructure stack
| SCOPE | TECH |
|---------------------------|--------------------------------------------------------------------------------------|
| ⬜ Project as template | [g8](http://www.foundweekends.org/giter8/) |
| ✅ Containerized app | [Docker](https://www.docker.com/) via [DockerSbt](https://github.com/sbt/docker-sbt) |
| ⬜ Containers orchestrator | [K8s](https://kubernetes.io/) |
| ⬜ Service mesh | [Istio](https://istio.io/) |
## Local Usage
First of all you have to publish the docker image of the app into your local repository with
```shell
./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
```shell
.infra/local/docker-compose/deploy.sh
```
> ⚠️ **You should use `http`** and not `https` beware that Chrome by default use `https`
### Minikube
Run the deploy script to run the app and the database with minikube.
Services are not port forwarded by default.
```shell
.infra/local/minikube/deploy.sh
```
## Customize
To customize this project please read the [guide](doc/guide.md)