Highly opinionated fork of the Lightbend Akka HTTP G8 template.
Out of the box, it provides:
- Fully functional Akka HTTP service
- Basic GitHub Actions workflow
- Helpers to fetch config values from the environment
- Setup for structured logging
- Access log for each incoming HTTP req
- Basic healthcheck
- Customized build.sbt
- Scalafmt setup
- Docker image creation and publishing support
- Always latest stable releases of required dependencies
- Support for code coverage
- Scalafix linter and rules
- ScalaSteward setup (with Pull Request auto-merge)
- (Optional) DynamoDB setup with Localstack for testing
Prerequisites:
- JDK 11+
- sbt 1.13.13+
Assuming that you have access to the private repository, in the console, type:
sbt new [email protected]:umatrangolo/akka-http-quickstart-scala.g8.git
This template will prompt for a set of parameters asking for the desired versions of all the dependencies; you can just press enter on the proposed choices given that they are the latest stable versions found on the Maven repository.
However, these are the ones that you will need to fill correctly:
Name | Description |
---|---|
name | Becomes the name of the project (e.g. foo-svc) |
description | Used to bootstrap README.md for the app |
organization | The organization owning this app (e.g. acme) |
codeowners | Content of the GitHub CODEOWNERS file |
package | Starting package (e.g. foo.bar) |
docker_maintainer | Email of the maintainer of this app |
docker_package_name | Specifies the package name for Docker (e.g. acme/foo-svc) |
The generated service is runnable out of the box and it is ready to accept requests. To start locally:
sbt run
that listens on port 9000. A simple example endpoint will greet you in a defined locale:
curl localhost:9000/greetings/sayHello?userName=Mike&lang=ch
More options are in the generated service README.
The template will use GitHub actions to implement a basic CI/CD pipeline.
We have three different pipelines with their jobs:
- CI
- lint: lints your code (e.g. checks formatting)
- test: compiles and runs tests checking also for coverage
- Scala Steward
- scala-steward: each Sunday it opens a lot of PRs proposing dependencies updates (that will be auto-merged on a green build) ** Note: ** You will need to create a Github token with the right permissions and inject that as a Github secret. Look at the YAML file that defines the action for more info.