Using Lagom with Scala

Lagom is Approaching EOL

This project will only receive security patches until July 1, 2024, at that point the project will no longer receive any additional patches.

If you are an existing customer of Lightbend and we have not yet contacted you, please reach out to Support.

We recommend migrating any existing work to:

  • Akka for deeply customized projects with complex infrastructure needs. Akka now contains the vast majority of Lagom features.
  • Kalix for a managed scalable environment with an abstraction above the Akka framework layer to allow you to focus only on business logic.

Before starting, make sure you have JDK 8 installed and configured. See the Lagom documentation if you are not sure whether you have the right version of Java or to find the link for installing it.

We've made it easy to create your first project. The link below uses a Lagom Giter8 template to generate a compressed file that contains:

  • A distribution of sbt, the Scala build tool. (version 1.2.1, or later, recommended)

  • A Lagom Hello World project.

Download and extract the project

  1. Download the project .zip file (clicking initiates the download)

  2. Extract the compressed file to a directory of your choice.

    Note: On macOS, if you unzip using Archiver, you also have to make the sbt files executable:

    chmod u+x ./sbt 
    chmod u+x ./sbt-dist/bin/sbt
  3. In a shell, change into the top-level directory of the project, lagom-scala-sbt. For example, if you extracted the project into a directory named my-project:

    • In an OSX or Linux shell:

      cd my-project/lagom-scala-sbt
    • In a Windows shell:

      cd my-project\lagom-scala-sbt
  4. Start sbt and the Lagom development environment:

    ./sbt runAll

    It will take a bit of time for the project to build and run. When finished, the console displays the message Services started, ....

  5. Verify that the services are indeed up and running by invoking the hello service endpoint from any HTTP client, such as a browser: http://localhost:9000/api/hello/World

    The request returns the message Hello, World!.

Congratulations! You've created and run your first Lagom system. See the Lagom documentation to learn more about your new project.