Simple web application with a database. Built using Scala.js and Docker.

Name Last Update
app Loading commit data...
ci Loading commit data...
logs Loading commit data...
project Loading commit data...
readme_files Loading commit data...
.gitignore Loading commit data...
.gitlab-ci.yml Loading commit data... Loading commit data...
LICENSE Loading commit data... Loading commit data...
build.sbt Loading commit data...
docker-compose.yml Loading commit data...

Scala.js example web application

Codacy Badge

Minimal but complete web application with a Postgres database. Built using Scala.js and Docker.

Get started

Run the server locally in a Docker container

  1. Install SBT and Docker
  2. Start SBT in the project's root directory and switch to the JVM project: project appJVM
  3. Execute dockerComposeUp in SBT to build the application, package it as a Docker image, and run the created image
  4. Point your browser to localhost
  5. Stop the running containers using dockerComposeStop

Platform specifics

  • On Windows, make sure you share your Windows drive to make volumes work. Go to Docker's settings → Shared Drives
  • On Linux, make sure the directories on the host used in the volumes allow being written to. For example ./logs must be writable

Project structure

  • Backend code is in app/jvm. This includes code for the web server and connecting to the database. It will run on the JVM.
  • Frontend code is in app/js. This code will be translated to JavaScript and run in the client's browser.
  • The code shared between frontend and backend is in app/shared.

Miscellaneous hints

  • Don't forget to reload in the SBT console after making changes to build.sbt
  • To create JavaScript faster, start SBT like this: sbt -D"dev.mode=true". The generated JavaScript file will be larger, though
  • Use dockerComposeRestart skipPull in SBT to rebuild and restart your application


Debugging the server

  1. Create a remote debugging configuration that attaches to the JVM on port 5005
  2. Start SBT like this: sbt -D"dev.mode=true"
  3. Start debugging using the remote configuration

The Stack

These are the libraries and languages used in the application:

Technology stack


  • Postgres: A relational database system that stores the data of this application. We use the official Postgres Docker image.
  • Slick: Lets us store data in the Postgres database and get data from it using Scala
  • Scala: Implements the server logic
  • Akka HTTP: Provides the HTTP routing for the server


  • Scala.js: Compiles Scala to JavaScript. With the compiled Scala code, we add GUI elements dynamically, read their contents, and make Ajax calls to the server
  • Pure.css: Styles GUI elements such as buttons, tables, and forms in the browser