Skip to content
Template for Play2.7.x projects, including all official Play Framework dependencies, WebJars and JQuery
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Play Framework 2.7 Template

License GitHub version

Template for Play 2.7.x projects, using Scala 2.13, including all official Play Framework dependencies, JQuery and Bootstrap. Dependency injection is used throughout. A Bootstrap view template is provided, and a plain HTML view template is provided.

Links to the appropriate lectures are provided in each file. The Standard Files and Directories and Improved Template lecture discusses this GitHub project in detail.

Bash Script

This template is best used in conjunction with a bash script that looks like this, which you might place in /usr/local/bin/play27Template:


# Clones play27-template and starts a new SBT project
# Optional argument specifies name of directory to place the new project into

if [ "$1" ]; then DIR="$1"; fi
git clone "$DIR"
cd "$DIR"
rm -rf .git
git init
echo "Remember to edit and build.sbt ASAP"

Remember to make the script executable!

$ chmod a+x /usr/local/bin/play27Template

Now you can use the play27Template script to make new Play Framework for Scala projects:

$ play27Template newProjectName

Now you can use sbt to run and test your project.

$ cd newProjectName
$ sbt -jvm-debug 9999 run

Using GitHub?

GitHub Pages

play27Template sets up the GitHub pages branch for your new project. Before you can use it, edit build.sbt and change this line so your GitHub user id and project name are substituted for the placeholders yourGithubId and my-new-project:

git.remoteRepo := ""

Now you can publish the Scaladoc for your project with this command:

sbt ";doc ;ghpagesPushSite"

The Scaladoc will be available at a URL of the form:

The Scaladoc for this template project is here

Try Hub!

With hub and play27Template you can create a new SBT project and a matching GitHub project with only two commands. The setup documented below will supply your GitHub username and password, and will only prompt your for your 2-factor-authentication (2FA) token each time you run it if you set up your GitHub account to use 2FA.

Install Hub

Install Hub on Mac OS:

$ brew install hub

Install Hub on Linux:

$ sudo -H pip install hub

Put your GitHub login credentials in ~/.bash_profile or ~/.profile. Also alias hub as git (hub also executes git commands):

export GITHUB_USER=yourGithubUserName
export GITHUB_PASSWORD=yourPassword
alias git=hub

Reload ~/.bash_profile

$ source `~/.bash_profile`

... or reload ~/.profile

$ source `~/.profile`

Using play27Template with Hub

Create a new SBT project and create a new GitHub project, which hub automatically adds as a git remote:

$ play27Template bigBadProject
$ cd bigBadProject
$ git create -d "Project description"
two-factor authentication code: 881078
Updating origin
created repository: mslinn/bigBadProject

Now check in the new project:

$ git add -A && git commit -m "Initial checkin" && git push -u origin master
You can’t perform that action at this time.