ClickStart: Scala Plus Lift Web Apps in One Click

Earlier , I wrote about the productivity boosts offered by the ClickStart application templates feature. The essence of the earlier blog is: ClickStarts are like continuous deployment “in a box.” A ClickStart clones a bunch of template source code, sets up the corresponding repository, the Jenkins job, the database and deploys the application.

So in one click, developers are ready to leap in and start coding. You make a change to the source repo, push it and that will trigger the Jenkins pipeline and redeploy. See my earlier blog that shows the steps to create an application.

In earlier blogs, I have covered where you can find the generated source, how to connect to the database and access the Jenkins build and corresponding continuous deployment settings. So this blog keeps it simple and uses a ClickStart with two of the latest technologies (Lift framework with Scala).

 

Lift framework with Scala

 

Lift framework with Scala

 

If you are logged in, click on the ClickStart button on the top left and select the “Scala and Lift” card (Image 1), enter the name of the application and you are good to go (as seen in earlier apps).

ClickStart Scala and Lift

Image 1: ClickStart panel

The Lift web framework is one of the earliest (perhaps *the* earliest?) web framework for the Scala language, which specializes in interactive realtime (AJAX) applications. It is battle-hardened from years of serious use and has been noted for being a great framework, security-wise - preventing common mistakes that can cause problems like XSS (by default, Lift apps are resistant to the OWASP Top 10 vulnerabilities including XSS, XSRF and parameter tampering), which can easily creep in with rich web apps. Lift is a so called “full stack” framework - meaning it contains all the parts you need to build a web app - no extra libraries are required (e.g., it will do templating, database/ORM and more).

Some other features the Lift project likes to tout:

  •  Developer centric — Lift apps are fast to build, concise and easy to maintain
  •  Designer friendly — Lift apps can be developed in a totally designer friendly way
  •  Scalable — Lift apps are high performance and scale in the real world to handle insane traffic levels
  •  Modular — Lift apps can benefit from easy to integrate, pre-built modules
  •  Interactive like a desktop app — Lift’s Comet support is unparalled and Lift’s AJAX support is super easy and very secure

If you want to try it out:

One you have it running, follow the instructions to clone your repo from your CloudBees Git repo to your desktop.

When you have the source code, take a look at src/main/webapp/index.html - you will see lift:helloWorld.howdy which binds to the code in src/main/scala/code/snippet/HelloWorld.scala.

src/main/scala/code/model/User.scala shows Lift’s simple “ORM” in action with the database.

Finally, note that index.html refers to src/main/webapp/templates-hidden/default.html for common content for all pages. You can see in HTML tags where there is “lift:” in the class it refers to a lift resource, such as a template, or a piece of code elsewhere.

This will get you started - make changes, push them to the source repo and you are on your way!

The next blog in this series will talk about the underlying data model that ties the entire lifecycle together and will tell you how to contribute your own ClickStarts.

Regards,

Harpreet Singh
Senior Director, Product Management
CloudBees
www.cloudbees.com

Harpreet Singh

Harpreet has 12 years of experience in the software industry. Prior to CloudBees, he was at Oracle and Sun for 10 years in various roles, including leading the marketing efforts for Java EE 6 and GlassFish 3.1. He was also product manager for Hudson, launching it within Sun’s GlassFish Portfolio.

Add new comment