Ask HN: Modern stacks and frameworks for fast web app development?
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.
(
67 comments
| 48 points
| on HN
)
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.
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.
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.
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.
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.
Seriously, Flask can be used for huge projects too.
Please note, flask code is easy to read, and you can change anything you want. Flask will not limit you, you can be sure in that.
As with all things though, what's new and edge may not necessarily scale or be supported in the long-term so caveat emptor (I think we need a developer specific latin phrase here). Once a service/site has become successful, key considerations such as community, active development, roadmaps, extendability etc. become paramount.
For those, you really can't beat some of the time-tested communities around PHP (Symfony/Cake), Python (Django/Flask/Bottle), Ruby (Rails/Sinatra) and Java (Spring).
I'd say that Node.js is entering this space from the backend perspective, but the front-end JS frameworks are an open battlefield right now (which is awesome, just fragile).
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)
Or maybe MongoDB has ironed out the problems that were listed on HN previous...
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...
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
Servers should not be exciting; they should be battle-tested and rock-solid.
As a long time Ruby developer who's always in search of faster, better, cheaper I've found the following:
- Rails is still the safe, moderately fast to develop in do-anything framework. It excels at CRUD and will have a maintained library available for pretty much anything you need to do. It however is relatively slow and Ruby comparatively sucks at anything async.
- Node and its supporting frameworks are fantastic at async and smaller single page type web apps. But it's a bit trickier than Rails or similar to structure and manage larger code bases. NPM is awesome for web development, better than Gems. Packages in general are not as mature as Ruby Gems and will be some time until they are. ORMs are quite weak compared to what you have in Rails (see Mongoose vs Mongoid).
My current stack of choice is Rails+Bootstrap for CRUD, Node+Restify for APIs (or Express if you need to throw in a little HTML as well), MongoDB for the DB, Redis for caching/pubsub/jobs. I'd use Postgres instead of MongoDB if I had an application where data integrity is paramount above all. All the supporting processes like job workers I write in Ruby (Sidekiq is great).
I'd like to use Go and I'm keeping an eye out for an application for it -- something that needs really high performance.
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.
Nitrogen Web Framework (http://nitrogenproject.com): Event-driven development. You can do almost complete development in Erlang and writing very minimal javascript or HTML (it's generated by the framework). Nitrogen doesn't provide a database abstraction layer, but Erlang does have database integration which works just fine. You could also use BossDB (below).
ChicagoBoss (http://chicagoboss.org): Rails inspired MVC for Erlang. Has a lot of stuff baked in: BossDB (ORM for a handful of different database servers), mail server, Django templates.
Zotonic (http://zotonic.com): The Erlang CMS. Lot and lots of stuff.
One of the most comprehensive resources for this is the Framework comparison put out by Evan Miller (the maker or ChicagoBoss): https://github.com/evanmiller/ChicagoBoss/wiki/Comparison-of...
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.
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.
The associated Github repository is an example of sorts for each framework's code style.
Also xkcd uses happstack, another haskell web framework...
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.
And whats your whole setup? flask -> pypy -> ?? -> nginx ?
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.
What did you use for async calls?
I like the simplicity of plain Go, but I have not done much with it yet. It seems quite straight forward and easy to pick up and get going with.
Otherwise, Python Flask is nice as well as Sinatra or Rails in Ruby. I'm not much of a fan of Django, but it's personal opinion. I just don't work well with it, others seem to really dig it. Seems nice otherwise.
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.
. Scalatra
. Play + Akka
- 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.
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.
I'd really like to know what people think. Collaboration and feedback are welcome.
[1] http://www.caspio.com/
- django - nginx - uwsgi - postgres - arch linux - linode server