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 it. Used by the ./backend-start.sh
scriptWith 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. Update the ui/.env
file accordingly.
There are two imports that are useful when developing a new functionality:
If you are defining database queries or running transactions, add the following imports:
import com.softwaremill.bootzooka.infrastructure.Magnum.given
import com.augustnagro.magnum.{sql, DbTx}
This will bring into scope custom Magnum codecs, the sql query interpolator as well as the given instance which is required by methods that should run in a transaction.
If you are defining new endpoints, import the base endpoints from Http
, as well as Tapir:
import com.softwaremill.bootzooka.http.Http.*
import sttp.tapir.*
import sttp.tapir.json.jsoniter.*
This will bring into scope Tapir builder methods and schemas for documentation, along with Bootzooka-specific customizations.
Logging is performed using Slf4j. Extend Logging
to bring into scope a logger
value. The logs that are output to the
console include the current trace id.