Lua is an easy and elegant programming language that is recorded as the fastest interpreted language on many benchmarks and proven success in other domains of development such as games and embedded systems. It has good language semantics, awesome documentation, it is very readable and has very powerful mechanisms such as metatables, proper tail calls and many other features that are worth taking a look. It's a great technical candidate for being a PHP replacement. Lua is being used in production for web development for a long time with success by websites such as TaoBao, a chinese online shopping website that ranks 11 globally on Alexa with over 760 million product listings, Cloudflare, Rackspace, itch.io, mail.ru, Mashape/Kong, Shopify and others. Wikipedia uses Lua for its template system. This blog itself is also running on Lua.
A common complaint of using Lua, though, is the ecosystem, which is exactly why PHP is so popular. PHP is pervasive and there are many tools and tutorials written for it, so the development becomes easy also for reasons that are not technical, specially due to a large & friendly community.
However, the landscape for Lua is changing and now the ecosystem is growing rapidly (a feat I partially attritube to the merge of LuaRocks and MoonRocks). We have been able to write in Lua for the web for years and now we can find a large number of tools available. You can write in Lua for major webservers such as Apache and Nginx/OpenResty (top 2 web servers used), and also others such as Lighttpd and pure Lua stand-alone servers like Xavante or Pegasus. Highlights go to Nginx server, which allows to develop blazing fast non-blocking asynchronous apps written in a sequential fashion keeping the event-driven logic hidden inside Nginx (no callback hell).
There are also many frameworks available, which this post aims to compare. I am myself the lead developer of one of them (Sailor) and I haven't developed using all the options I'm listing, but I hope this is a fairly decent comparison. You can make a pull request to this article to make it better.
Something important to note, there is one advantage that is not listed because it applies to all of them, which is the good performance and small footprint. This is even more enhanced on tools that support LuaJIT.
Cousins in other languages: Flask (Python), Sinatra (Ruby)
Website: leafo.net/lapis
Source: github.com/leafo/lapis
License: MIT
Lapis is a framework for OpenResty developed by the same creator of the MoonScript language and itch.io
Pros:
Cons:
Cousins in other languages: Zend (PHP), Yii (PHP), Rails (Ruby), Django (Python)
Website: sailorproject.org
Source: github.com/Etiene/sailor
License: MIT
Sailor is a fairly new framework that began as an independent project by the same maintainer of this blog and has been mentored under Google Summer of Code
Pros:
Cons:
Website: keplerproject.github.io/orbit
Source: github.com/keplerproject/orbit
License: GPL
Orbit is maybe the oldest and most stable framework written for Lua developed by a group of researchers during the Kepler project
Pros:
Cons:
Cousins in other languages: Node.js (Javascript)
Website: luvit.io
Source:github.com/luvit/luvit
License: Apache2.0
Luvit is a port of node.js to Lua that claims to be 2-4 times faster and save up to 20 times memory
Pros:
Cons:
Website: turbolua.org
Source: github.com/kernelsauce/turbo
License: Apache 2.0
Turbo is a framework for building event-driven, non-blocking RESTful web applications built on the top of Tornado web server
Pros:
Cons:
Website: ophal.org
Source: github.com/ophal
License: AGPL 3.0
Ophal is a is a highly scalable web platform and content management system
Pros:
Cons:
Website:luapress.org
Source: github.com/Fizzadar/Luapress
License: MIT
LuaPress is a static blog generator
Pros:
Cons:
Website: spu.tnik.org
Source: github.com/yuri/sputnik/
License: GPL
Sputnik is an extensible Wiki
Pros:
Cons:
| Stars | LR Downloads |
|---|---|
| Luvit 2068★ | Lapis 55060↓ |
| Lapis 1043★ | Lusty 1406↓ |
| Sailor 491★ | Turbolua 582↓ |
| Turbolua 270★ | Sailor 485↓ |
| Tir 250★ | Orbit 481↓ |
| Vanilla 122★ | LuaPress 108↓ |
| Orbit 83★ | Vanilla 38↓ |
| Lusty 56★ | Sputnik 34↓ |
My talk on web development in Lua and a Sailor introduction during CodingSerbia 2015: Link