Books

Play’s documentation shows the available features and how to use them, but the documentation will not show how to create an application from start to finish. This is where tutorials and examples come in.

Tutorials and examples are useful for showing a single application at work, especially when it comes to integrating with other systems such as databases or Javascript frameworks.

There are two Play Seeds that are designed expressly for getting started with new Play applications. They contain a hello world controller and view template, filters, and nothing else.

If you have sbt 0.13.13 or higher installed, you can create your own Play project using sbt new using a minimal giter8 template (roughly like a maven archetype). This is a good choice if you already know Play and want to create a new project immediately.

Note: If running Windows, you may need to run sbt using sbt.bat instead of sbt. This documentation assumes the command is sbt.

Play is non-opinionated about database access, and integrates with many object relational layers (ORMs). There is out of the box support for Anorm, Ebean, Slick, and JPA, but many customers use NoSQL or REST layers and there are many examples of Play using other ORMs not mentioned here.

Slick is a Functional Relational Mapping (FRM) library for Scala that makes it easy to work with relational databases. It allows you to work with stored data almost as if you were using Scala collections while at the same time giving you full control over when a database access happens and which data is transferred. You can also use SQL directly. Execution of database actions is done asynchronously, making Slick a perfect fit for your reactive applications based on Play and Akka.

play-isolated-slick: This template uses a multi-module that hides Slick 3.x behind an API layer, and does not use Play-Slick integration. It also contains sbt-flyways and use Slick’s code generator to create the Slick binding from SQL tables.

The Play community also has a number of tutorials and templates that cover aspects of Play than the documentation can, or has a different angle. Templates listed here are not maintained by the Play team, and so may be out of date.

This is an incomplete list of several helpful blog posts, and because some of the blog posts have been written a while ago, this section is organized by Play version.

Play API REST Template by Adrianhurt: shows how to implement a complete Json RESTful API with some characteristics such as Authentication Token, pagination, filtering, sorting and searching and optional enveloping.

Play Multidomain Seed by Adrianhurt: tries to be a skeleton for a simple multidomain project (www.myweb.com and admin.myweb.com). It shows you how to use subprojects for that and how to share common code. It is also ready to use with Webjars, CoffeeScript, LESS, RequireJS, assets Gzip and assets fingerprinting. Please, check the readme file for more details.

Play Multidomain Auth by Adrianhurt: this is a second part of play-multidomain-seed project. This project tries to be an example of how to implement an Authentication and Authorization layer using the Silhouette authentication library. It also uses Play-Bootstrap for easy template scaffolding.

Upgrading from Play 2.3 to Play 2.5 by Gregg Hernandez: Learn how to deal with common problems when upgrading to Play 2.5, including maintaining legacy behavior, transitioning to Akka Streams, and implementing compile-time dependency injection.