Archivo | Backend RSS for this section

Reactive ScalaJdbc with Flyway Play

  1. Postgres Driver /
  2. Flyway to add reactive non-blocking: flyway/flyway-play (play 2.4 +)/
  3. Scalikejdbc-async here
  4. Edit conf/application.conf add
play.modules.enabled += ""
  1. postgresql-async (More and in depth analysis here)

Add in conf/application.conf

play.modules.enabled += ""


# Database configuration
# ~~~~~
# You can declare as many datasources as you want.
# By convention, the default datasource is named `default`


# ScalikeJDBC original configuration

play.modules.enabled += "scalikejdbc.PlayModule"


  1. Implement SuperMail model
  2. Create REST endpoints
  3. Add to routes
GET        /bars:username                   controllers.Application.getSuperMails(username: String)
POST       /bars                   controllers.Application.createSuperMail


  1. Implement Controller
  2. Test

Original reactive post here.

More details to handle request here (Official lightbend)

Play + Scalikejdbc +Postgres

Create a new project from scala seed

sbt new playframework/play-scala-seed.g8


Import in IntelliJ IDEA.

Open build.sbt and add:


Open conf/application.conf

Add as following


In plugin.sbt add the following


And enable the reverse plugin at build.sbt


Create a configuration file in project/


This configuration will allow us to create a model from existing db tables. Next step is to go a terminal (In IntelliJ IDEA there is a Terminal access on the botton, next to sbt terminal) in the root directory of your project and execute:

sbt "scalikejdbcGen messages Messages"

If all configurations are correct you will get a result like this:



After that a models package containing a Messages case class with the implementation of methods for CRUD are created in our project.

However the automation provided is awesome for this type of examples, since our table has a serial id we need to change the signature of our case class to exclude the id and to implement the date automatically (not provided by)