Bootzooka

Simple project to quickly start developing a Scala-based microservice or web application.


Development tips

Generally during development you’ll need two processes:

Cloning

If you are planning to use Bootzooka as scaffolding for your own project, consider cloning the repo with git clone --depth 1 in order to start the history with last commit. You can now switch to your origin repository of choice with: git remote set-url origin https://repo.com/OTHERREPOSITORY.git

Useful sbt commands

Database schema evolution

With Flyway, all you need to do is to put DDL script within bootzooka-backend/src/main/resources/db/migration/ directory. You have to obey the following naming convention: V#__your_arbitrary_description.sql where # stands for unique version of your schema.

Developing frontend without backend

If you’d like to work only on the frontend, without starting the backend, you can proxy requests to a working, remote backend instance. In ui/package.json you need to edit the proxy settings.

Imports

There are two imports that are useful when developing a new functionality:

Database

If you are defining database queries or running transactions, add the following import:

import com.softwaremill.bootzooka.infrastructure.Magnum.*

This will bring into scope custom Magnum codecs.

HTTP API

If you are describing new endpoints, import all members of the current Http instance:

import com.softwaremill.bootzooka.http.Http

class UserApi(http: Http):
  import http.*

  ...

This will bring into scope Tapir builder methods and schemas for documentation.

Logging

Logging is performed using scala logging. Extend Logging to bring into scope a logger value.

Bootzooka also supports correlation ids. The id is read from the X-Correlation-ID header of incoming requests (see CorrelationIdInterceptor), or a new one is generated. The correlation ids are included in all outgoing http requests (see SetCorrelationIdBackend).