Play Framework

Tutorial: Play Framework, JPA, JSON, jQuery, & Heroku

UPDATE: This tutorial is for Play 1.x (an old version). Check out my Play 2 Tutorial if you want to get started with the latest stuff. (Thanks to John Borys for pointing this out.)

If you are a Java developer then you really need to give Play Framework a try. It is really refreshing to take a few minutes, step out of the legacy-feeling world of traditional Java web app development and into something modern and fun. I want to walk you through a very simple tutorial where we will build a web application with Play Framework. The application will use JPA for persistence and expose access to the data through a JSON over HTTP interface. The client-side of the application will be built with jQuery. Lets get started.

Heroku Preso from Devoxx 2011

As expected… Devoxx 2011 rocked! Such a fun conference with top notch sessions and people. I presented a session on how to deploy Java, Play Framework, and Scala apps on Heroku. Matt Raible did a great (and very thorough) write-up on my session. Thanks Matt! Here are my slides:

There was also some hot news at Devoxx… Play Framework 2 is the official web framework in the Typesafe Stack! And Heroku already supports Play 2! Awesome stuff.

Running Play Framework + Scala Apps on Heroku

Building Play Framework apps with Scala is all the rage right now. And for good reason… It’s never been easier to build and deploy JVM-based web apps! Lets walk through how to build a Play app with Scala and then deploy it on the cloud with Heroku.

Step 1) Install the Play Framework (make sure you have at least version 1.2.3)

Step 2) Install the Play Scala module:

play install scala

Step 3) Create a new Play app with Scala support: