Ask HN: Modern stacks and frameworks for fast web app development?

48 points by nthnclrk ↗ HN
I remember seeing a couple of links in the past about really fast, lightweight web application development frameworks that seem to streamline a lot of things — unfortunately I didn't bookmark any at the time. I'm sure one almost described itself as a Bootstrap for web apps. I'd love to find one or two, but it's proving difficult.

I sure most were ruby based — think Padrino.

In any case, It'd be nice to see some suggestions from the community here so I can make some educated choices for a couple of small projects I have planned.

70 comments

[ 2.3 ms ] story [ 114 ms ] thread
It depends on complexity. This is my python stack:

Simple stuff (API endpoint only, minimal routing, minimal cookie/session related stuff) - Bottle.py

Simple stuff that needs really high performance squeezed out: Wheezy.web + gevent (this category is new. I invented it as an excuse to play with wheezy.web)

Moderately complex stuff (rendering, session, fancy routing): web.py

Complex stuff: pyramid.

I would rather nerf my projects than go to highly complex web stacks.

My Golang stack: Gorilla or plain golang.

Frontend: I am not really a fan of frontend rendering, but if I need to, AngularJS is my preferred framework.

Database part of the stack:

I use postgres for SQL stuff. MySQL is used when there are more people in the team involved. Considering MariaDB for dropin replacement if a team is involved. Still haven't bothered.

My preferred document based nosql database is couchdb. Preferred KV store is redis.

OS:

I used to develop for CentOS but strangely in the past 2 years I have moved on to Ubuntu. Sometimes updates can break things, but I certainly prefer it to the glacial CentOS or Debian

CEntOS should be glacial. That is the point of the EL distriubutions. If you want cutting-edge, that is what Fedora is for.

Servers should not be exciting; they should be battle-tested and rock-solid.

(comment deleted)
Here's ours:

- django - nginx - uwsgi - postgres - arch linux - linode server

My favorite at the time is: Backbone.js — nginx — rails — postgres — debian — linode server
Deploying Sinatra to Heroku is pretty darned fast and convenient (if not particularly economical at scale). I don't use Padrino on top of Sinatra, but I'd imagine that it would be just about as smooth.
For lightweight in Python, I started on Bottle, but found Flask to be more to my liking for very small projects/web services.

Mostly Django here; if you know the framework well, most things are very quick, but I wouldn't particularly call it "streamlined." Plus that up-front time to get to know it might disqualify it, and lightweight it definitely is not.

My Ruby friends tend toward Sinatra for small projects.

FLask is my go-to choice as well, the one I write before the write (that was never written so far).
*the one I write "before the rewrite"
Please note Flask isn't only for very small projects/web services.

Seriously, Flask can be used for huge projects too.

Do you have any good examples? I'd like to try Flask, but the only examples on the flask site are very, very small sites, and don't help at all with learning to structure something larger.
For Scala:

. Scalatra

. Play + Akka

The Play framework works quite well in Java as well. Although some knowledge of Scala is useful for the template engine, as well as some spots where the Java API abstraction leaks a bit.
Go with Gorilla Mux.

I use a Rails-ish directory structure {controllers,models,helpers,server,views} and can be knocking out the first skeleton pages and APIs in minutes.

I don't think Go needs a framework to be a really good fast web app language/environment.

If anyone is interested in a sample app I might knock one up just so that people can clone it and get started. There wouldn't be much to it, as I'm consumed by other work, but maybe people want such an example.

While I don't see myself switching any time soon, I think this kind of example is excellent for anyone looking to get a feel for how an unfamiliar language would actually be used in a semi-realistic situation (without having to dig through massive real-world projects with complexity that's normal for experienced devs but unintelligible to the uninitiated).
Cool, in that case I'll knock something up.

I'll try and make it realistic from the point of view of including many tasks that people generally want to do.

So I'll have it serve static files, read and write to a database, read a local config, cache stuff in memory, do something on a scheduled task basis, render templates.

Anything else anyone would like to see?

Not sure what I'll make that will require all of that, and I would like to keep it enough of a stub that people could rip out the example and quickly butcher it into whatever they wanted to prototype.

Maybe a code snippets site. I'm off out for the day, my first day off in 60 days, so I'll look at this tomorrow.

That much should be enough I think. Are you using the default templates ? I've seen that mustache has been ported to go.
Just got back from a long day away from the desk, will look at this tomorrow.

I'm thinking a good default would use the default templates (as they are good), memcached, PostgreSQL, have a config file in /etc (because no-one should be hard-coding their app, even if it's a quick thing) and I'll make some excuse to include the scheduled tasks as there is always an edge case need for them. I won't try and solve user login, I'll just use Persona.

It will be basic, but have a lot of simple components that people can delete out or extend depending on what they want to do.

Do you do i18n ? Other than that, seems to cover everything ! Cheers
Hah, not yet... this is really quick prototyping through to deployable something.

Once I've put it up, I'll accept pull requests... I'm sure there's enough people with small reqs that it could be knocked into shape enough to show how to do most things.

Sure, let me know when you put it on github. thanks !
Would love get my hands on your sample app :)
Interested in the sample app as well since I was looking for examples like this.
Completely agree. Im using Go a lot an its just a very nice language for the web (wonder why). I also use web.go. Which for me is very like flask/bottle. Ive found that a web app in go is very simple, fast and downright easy to build. Note that i currenly use webfaction to deploy Go apps. It works very well. If anyone wants to knkw more, just shoot me an email. Ill introducd you
knocking one up is the best way to clone
For quick prototyping I always use:

- CouchDB (DB with RESTful endpoint)

- Spine.js for logic and rendering (with jade for the templating and stylus as CSS pre-processor, with Foundation 4 as CSS lib). Spine.app can generate new projects the same way django-admin.py does.

I code nearly everything in CoffeeScript. This whole workflow/stack has always me started in no time.

For small projects, try Meteor.

Everything is in JavaScript, and you don't have to concern yourself with such trivialities as database or talking to the server. The recent releases (0.6 onwards) have really easy authentication, and lots of extra packages via Meteorite.

Not a specific answer to your question, but in case you missed it and have interest in the resulting application being quick even on small hardware: http://www.techempower.com/benchmarks/

The associated Github repository is an example of sorts for each framework's code style.

I haven't seen this, so I appreciate it.
CompoundJS for Node.js — it is very streamlined, and is in active development, although some of the docs are not yet updated.
My favorite at the moment is: AngularJS, Angular UI bootstrap, express.js or Scalatra for backend, mongoDB, TypeScript. WebStorm IDE.
MEAN - Mongo, Express, Angular, Node

I like it because I get

- high responsive / low latency sites

- fast ramp up time thanks to Mongo, no schemes, no migration, just JSON everywhere; JS objects are one of the most flexible data types

- more than just a key value store, a powerful document store with query capabilities close to SQL DBs (Mongo)

- an ecosystem where performance is important (e.g. tons of on performance trimmed templating engines like doT)

- just one language to get good in (JS)

- fresh, highly modular concept and no aged, outdated design patterns from 2005 legacy, bloated, monolithic web frameworks

- lightweight, lightweight, lightweight

- instant startup time of the VM

- no compilation

- a language implementation with C class performance (V8)

- Easy to find talents which can work on all parts of the system => real full stack devs

- a lightweight, unobtrusive FE framework which doesn't stand in your way (Angular)

- best package manager out there (npm)

I'm tempted to use this stack on a new project but I worry about MongoDB since data in this application is critical and loss would be catastrophic. Is it possible to substitute Postgres or something with atomicity?

Or maybe MongoDB has ironed out the problems that were listed on HN previous...

> but I worry about MongoDB since data in this application is critical and loss would be catastrophic

Don't worry, this is just some old and well debated prejudice against Mongo (don't want to start a mongo discussion here though). Mongo has five different safe write modes you can choose from plus optional journaling and is in general some of the most impressive piece of tech and the best document store I know. Just try it and you won't go back and it's popular: http://www.google.com/trends/explore#q=mongodb%2C%20postgres...

It is possible to substitute Pg, since it has PL/v8 and JSON types, so the 'one language for the whole stack' is satisfied.
Though Postgres is a great DB and supports JSON directly you get just a fraction of the query possibilities you have with Mongo. With Postgres you get some basic operations for the JSON data type (since the JSON support is added recently, think 12-18 months ago). So, I wouldn't consider it as a real substitute to Mongo.
Dropwizard in the back, Knockoutjs on the front, looking at angularjs as an alternative to KO.

I think there is much value in a hard separation of backend and frontend. Basically you get an API for free and I believe that most applications can benefit from having one: it helps with integration and migration, scaling and composition of services.

For small hacks, flask. Foundation for the frontend. I worked with Django and web.py, but found Flask and it's ecosystem of plugins a bit more lightweigth.

Being relegated to php lately, I've been using Silex/Twigg/composer for most of my projects. Silex is built on Symfony2 Components, Twigg is a php port of Jango Templats, and composer is a nice Bundler like dependency manager for PHP.
I like my FAM stack;

Flask - run on Pypy for extra speed and great for rapid development of APIs; AngularJS - client side Javascript templating for great single page app; MongoDB - Fast. Schemaless. Returns almost straight JSON to Angular from Flask.

Nginx sits in front, initially serving the HTML page to load the Angular page which pulls its data from the backend API.

Easy to drop in a Memcache/Varnish caching layer and everything can scale effectively.

The isolated nature of VirtualEnvs allows this to be installed on almost any Linux server and to have many different websites running on the same machine.

Did you benchmark pypy + flask? Any numbers compared to cpython?

And whats your whole setup? flask -> pypy -> ?? -> nginx ?

I'm yet to benchmark it but I'll run some ApacheBench and post them up in the next week.

And sorry - the missing link there is uWSGI. Found it to be much more stable and configurable than Gunicorn. Also did some load testing which required a lot of Async stuff (waiting for unreliable external APIs to respond...) and Gunicorn just fell over.

Async with pypy? I though pypy still doesn't support greenlets?

What did you use for async calls?

There was an old ruby framework called camping. I don't think you can get any more lightweight than that. But it's probably obsolete by now.

Meteor (meteor.com) may not be that lightweight, but it's a really neat model (inherently realtime, no glue code from template to database).

MongoDB (and to some extent CouchDB) are much simpler databases to get started with than MySQL. (No need to write migrations most of the time.) You will need to learn the various ways around the "read-modify-write" race condition nightmare.

For anyone doing any kind of development, I would recommend Vagrant (vagrantup.com). On the surface, it's just a VM where you run your code. But it makes it easy/simple to document your development(/production) environment assumptions, and check them into your VCS.

There are several benefits: All developers will have the same dev environment that mirrors production. New developers (even on different OSes) don't waste any time setting up an environment.

It seems to me that modern web dev happens mostly in JavaScript. The driving reason for this is so apps can be wrapped to be like native apps, and have a level of state and data persistence. The trend in modern web apps is to send a lot of data down as JSON, and only do serverside rendering in cases where you need SEO or incredible rendering speed.

You make a choice between angular, ember, bootstrap+handlebars, roll your own, or a few others. On the back-end, there is a similar array of very reasonable non-real-time frameworks, mostly centered around Python (Django, Flask, etc.), Ruby on Rails, or the newish and sexy and real-timish node.js. Go is apparently pretty popular on HN, and imagine it's not the same academic trap that Haskell is, but I've never touched the stuff. I find Google programming tools to be very good usually (AppEngine, Angular, Chrome dev tools).

Your data store that underlies all of this depends heavily on your application. You can still get plenty of mileage out of MySQL, or Postgres for geo apps, but there is a large community building on top of NoSQL type data stores too.

These are my impressions from having done web dev 4-5 years ago, then focusing mostly on mobile, then having some web projects under my management again recently. The shift to JavaScript became apparent to me when our engineers looked at and chose technologies. I personally was doing a lot of client-rendered Javascript ("web app style") 5 years ago for TrailBehind.com, and it seems like the whole world works that way now, just more high-tech with HTML compilers and templating and more.

Calling Haskell an academic trap ignores tons of wisdom its researchers shared with the world and other languages including Go already incorporated into its philosophy.
For fast development, I like Clojure + Compojure + Hiccup using IntelliJ. If you like Clojure then Hiccup is awesome to use: it is an efficient Clojure library for rendering HTML. A bonus: this combination also provides very good runtime performance. This combination has replaced Ruby + Sinatra in my little world.
Exactly! I just started messing around with Clojure after meaning to get into Lisp for ages now. Mind, blown. With hiccup (HTML), cssgen (CSS), ClojureScript (Javascript) and Compojure (server), you can use one language to write the entire web app from front to back. I'm not saying that this is the right way to do it, but it's pretty neat. It is fast to develop in too, basically you get something like Sinatra/Scalatra/Flask, and BYO-everything else (library support is good, but certainly nothing like Rails or Django).

I didn't realize IDEA had Clojure support, I will have to check that out. I mainly use emacs+nrepl and experiment a little with Light Table.