Texas outline

July 2016

Quick-starting web apps with Yeoman

3 July 2016

For years, I’ve kept running representation of how I set up, build, and deploy applications in the various technologies I use in example repos. Usually these aren’t interesting enough to bother open-sourcing them — nobody but me really needs a skeletal SpriteKit+Swift project they can fork for a weekend’s gamedev doodling, for example. But lately I’ve been doing a ton of full-stack web development, both for work and in my personal projects, and as I move across projects I’ve started building up a really nice set of tools that I can use to build out minimal, robust apps really quickly.

The last time I was doing considerable web work, I kept my working knowledge of how to set up a project and start developing in the form of a Yeoman generator that I called Chassis. That repo evolved over the couple of years I used it, from a basic directory structure and starter Gruntfile to a full-fledged multi-page application in Coffeescript built by a complex Gulpfile.

All things must end, however, and I’ve made a pretty clean break with most of the technologies and best practices encoded in Chassis. For one thing, I’ve started building my web apps in a single repo for both server and client; for another, the technologies on the server side have completely changed. To that end, I’ve put together a new Yeoman generator for bootstrapping full-stack web projects, unimaginatively called: dropwizard-angular-gradle.

The technologies it relies on are basically right there in the name: the API server is built in Java 8 using the lovely Dropwizard framework, with dependencies and distribution handled by Gradle; the client is written in Typescript using Angular.js (1.x), with dependencies handled by Bower and building/live-reloading handled by Gulp. You can go from zero to fully working, deployable, testable application with just:

$ npm install -g yo
$ npm install -g generator-dropwizard-angular-gradle
$ mkdir awesome
$ cd awesome
$ yo dropwizard-angular-gradle

The generator will fetch some baseline Java, Node, & Bower dependencies, and set up an Intellij project for the API. You can start the server from within Intellij or using ./gradlew run; start a live-reloading auto-compiler for your Typescript and Less files with cd awesome-app; gulp watch. When you’re ready to deploy, build the whole kaboodle into a distribution with ./gradlew distZip.

Now if you’ll excuse me, I’m going to go bash out another couple of sweet prototypes. Shouldn’t take more than half an hour or so :).