None Here’s a minimal, but complete, Scala Play Framework boilerplate you can drop into a new directory and run with sbt run.
Directory layout
text
play-scala-boilerplate/
app/
controllers/
HomeController.scala
views/
main.scala.html
index.scala.html
conf/
application.conf
routes
project/
build.properties
plugins.sbt
build.sbt
project/plugins.sbt
scala
// SBT plugin for Play
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.20") // use latest 2.8.x
project/build.properties
properties
sbt.version=1.9.9
build.sbt
scala
import play.sbt.PlayImport._
import sbt._
import Keys._
name := "play-scala-boilerplate"
version := "1.0.0-SNAPSHOT"
scalaVersion := "2.13.12"
lazy val root = (project in file("."))
.enablePlugins(PlayScala)
.settings(
libraryDependencies ++= Seq(
guice // default DI
),
scalacOptions ++= Seq(
"-deprecation",
"-feature",
"-unchecked"
)
)
conf/application.conf
hocon
play.http.secret.key = "changeme-please-use-a-real-secret"
play.http.secret.key = ${?APPLICATION_SECRET}
play.filters.hosts {
allowed = ["localhost", "127.0.0.1"]
}
play.modules.enabled += "play.modules.guice.GuiceModule"
conf/routes
routes
# Home page
GET / controllers.HomeController.index
# Static assets
GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)
app/controllers/HomeController.scala
scala
package controllers
import javax.inject._
import play.api.mvc._
@Singleton
class HomeController @Inject() (
val controllerComponents: ControllerComponents
) extends BaseController {
def index() = Action { implicit request: Request[AnyContent] =>
Ok(views.html.index("Your new Play application is ready."))
}
}
app/views/main.scala.html
scala
@(title: String)(content: Html)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>@title</title>
</head>
<body>
@content
</body>
</html>
app/views/index.scala.html
scala
@(message: String)
@main("Welcome to Play") {
<h1>@message</h1>
<p>If you see this page, your Play app boilerplate is working.</p>
}
(Optional) public assets
If you want assets:
text
public/
stylesheets/main.css
javascripts/main.js
and then reference them in main.scala.html using:
scala
<link rel="stylesheet" href="@routes.Assets.versioned("stylesheets/main.css")">
<script src="@routes.Assets.versioned("javascripts/main.js")"></script>
Running
From the project root:
Visit http://localhost:9000/.
If you want, I can adapt this boilerplate for Scala 3 or add basic JSON endpoints, database config, or testing setup.