Grok 4.1 Fast· xai
Frontier Reasoning Traces
Provide a boilerplate for a Scala Play Framework application.
- User
Provide a boilerplate for a Scala Play Framework application.
- Assistant
# Boilerplate for a Minimal Scala Play Framework Application This is a ready-to-use boilerplate for a **Play Framework 2.9.x** application using **Scala 2.13**. It includes a basic "Hello World" home page. ## Quick Start 1. Create a new directory (e.g., `myapp`) and copy the files below into it. 2. Run `sbt run` from the project root. 3. Open http://localhost:9000 in your browser. **Requirements:** - Java 8+ (JDK) - sbt 1.9.7+ (installed via SDKMAN, Homebrew, etc.) ## Directory Structuremyapp/ ├── build.sbt ├── project/ │ ├── build.properties │ └── plugins.sbt ├── app/ │ ├── controllers/ │ │ └── HomeController.scala │ └── views/ │ └── index.scala.html └── conf/ ├── application.conf └── routes
## File Contentsbuild.sbtname := """myapp""" organization := "com.example" version := "1.0-SNAPSHOT" lazy val root = (project in file(".")) .enablePlugins(PlayScala) scalaVersion := "2.13.12" libraryDependencies ++= Seq( guice, "org.scalatestplus.play" %% "scalatestplus-play" %% "6.0.0" % Test, "org.scalatestplus" %% "mockito-5-0" % "3.14.1" % Test ) // Reduces memory footprint during compilation play.sbt.PlayRun.hooks += PlayRunHook(() => (), () => sys.runtime.halt(0)) Test / fork := falseproject/plugins.sbtaddSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.9.0")project/build.propertiessbt.version=1.9.7conf/application.conf# This file is auto-generated. Manual changes will be lost. play.http.secret.key = "changeme" # HTTP Server play.server.port = 9000 play.http.router = play.api.routing.RouterProvider play.http.errorHandler = play.api.http.DefaultHttpErrorHandler # Logger play.logger { includeConfig = "application-logger.xml" }conf/routes# Home page GET / controllers.HomeController.index()app/controllers/HomeController.scalapackage controllers import javax.inject._ import play.api.mvc._ @Singleton class HomeController @Inject()(val controllerComponents: ControllerComponents) extends BaseController { def index(): Action[AnyContent] = Action { implicit request: Request[AnyContent] => Ok(views.html.index("Welcome to Play!")) } }app/views/index.scala.html@(title: String) <!DOCTYPE html> <html lang="en"> <head> <title>@title</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="stylesheet" media="screen" href="@routes.Assets.versioned("stylesheets/main.css")"> </head> <body> <section id="content" class="wrapper doc-wrapper"> <div class="container"> <div id="holder"> <h1>@title</h1> <p>This is a boilerplate Play application written in Scala. Edit <code>app/views/index.scala.html</code> to customize.</p> <p>Run with <code>sbt run</code>.</p> </div> </div> </section> </body> </html>Optional: Add Static Assets
Create
public/stylesheets/main.cssfor basic styling:body { font-family: Helvetica, Arial, sans-serif; margin: 0; padding: 20px; background: #f0f0f0; } .container { max-width: 800px; margin: 0 auto; } #holder { background: white; padding: 40px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); } h1 { color: #333; } code { background: #f4f4f4; padding: 2px 4px; border-radius: 4px; }Next Steps
- Add routes: Edit
conf/routes. - Add models/services: Create files in
app/models/orapp/services/. - Database: Add
jdbcorslickdependencies inbuild.sbt. - Tests: Run
sbt test. - Production: Use
sbt distfor a distributable ZIP. - Upgrade/Template: For the official latest, run
sbt new playframework/play-scala-seed.g8.
This boilerplate is production-ready minimalism. Customize as needed!
- Add routes: Edit
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.