Simple project to quickly start developing a Scala-based microservice or web application.
Generally during development you’ll need two processes:
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
renameProject
- replace Bootzooka with your custom name and adjust scala package namescompile
- compile the whole projecttest
- run all the testsproject <sub-project-name>
- switch context to the given sub-project, then all the commands will be executed only for
that sub-project, this can be also achieved with e.g.: <sub-project-name>/test
~backend/re-start
- runs the backend server and waits for source code changes to automatically compile changed file and to reload itWith 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.
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.
There are two imports that are useful when developing a new functionality:
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.
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 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
).