最好的Lua Web 框架

jopen 8年前

Lua是一个小巧的脚本语言。是巴西里约热内卢天主教大学(Pontifical Catholic University of Rio de Janeiro)里的一个研究小组,由Roberto Ierusalimschy、Waldemar Celes 和 Luiz Henrique de Figueiredo所组成并于1993年开发。 其设计目的是为了嵌入应用程序中,从而为应用程序提供灵活的扩展和定制功能。Lua由标准C编写而成,几乎在所有操作系统和平台上都可以编译,运行。Lua并没有提供强大的库,这是由它的定位决定的。所以Lua不适合作为开发独立应用程序的语言。Lua 有一个同时进行的JIT项目,提供在特定平台上的即时编译功能。

Micro frameworks

Cousins in other languages: Flask (Python), Sinatra (Ruby)

Lapis

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:

  • LuaRocks install
  • Excellent documentation
  • Supports OpenResty
  • Nice templating system
  • Stable and well-tested, being used in production by a number of projects
  • Active development
  • Supports MoonScript and LuaJIT
  • Popular with a growing community

Cons:

  • Does not support a big variety of webservers and databases (OpenResty with Postgres and MySQL only, but that should be enough for most projects)
  • Does not support Lua >= 5.2 (As it supports LuaJIT it might support Lua5.1, though)

MVC frameworks

Cousins in other languages: Zend (PHP), Yii (PHP), Rails (Ruby), Django (Python)

Sailor

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:

  • LuaRocks install
  • Works with a variety of databases through the LuaSQL library and native OpenResty MySQL api (for non-blocking operations)
  • Works on a big variety of webservers, including Nginx/OpenResty
  • Integrated with Lua->JS VMs allowing to use Lua for the front-end as well
  • Extensive and well-put documentation
  • Well tested and in active development
  • Compatible with Lua 5.1, 5.2 and LuaJIT
  • The maintainer constantly tries to reach communities outside of the Lua bubble

Cons:

  • Small community
  • It's still in alpha version, things change fast, it's being used in production only by a small number of projects
  • Single person project with not many active contributors

Orbit

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:

  • LuaRocks install
  • Stable
  • Works with a variety of databases through the LuaSQL library
  • It's being used in production by a number of projects
  • Clear documentation
  • Well supported by the Lua community, questions about it on the Lua list will most likely be answered

Cons:

  • Does not run on a big variety of web servers
  • The development seems fairly abandoned with no recent updates
  • Compatible with Lua 5.1 only

Event-driven frameworks

Cousins in other languages: Node.js (Javascript)

Luvit

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:

  • Popular
  • Stable and very well tested
  • Very active development with a fair number of contributors
  • Active community with chats, mail list and a blog
  • Asynchronous I/O
  • Has a number of packages to extend it

Cons:

  • No LuaRocks install
  • Awful documentation, a quick look can't tell how it really works, or which versions of Lua and which databases it supports
  • Not friendly to developers who aren't already familiarized with Node.js

TurboLua

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:

  • LuaRocks install
  • Stable and well-tested
  • Active development
  • Excellent and extensive documentation
  • Nice templating system

Cons:

  • Does not support a variety of webservers
  • Supports only LuaJIT
  • I couldn't find information on community
  • I couldn't find information on databases supported

CMS, Wikis & others

Ophal

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:

  • Active development
  • Big number of packages to extend it
  • Runs on major webservers
  • Supports a big variety of databases through LuaSQL
  • Maintainer puts a lot of effort into it

Cons:

  • No LuaRocks install
  • Supports only Lua5.1 and LuaJIT
  • Badly documented
  • Does not seem to be stable, it's currently on alpha v0.1 and I couldn't find tests
  • No/small community
  • Single-person project with no other contributors

LuaPress

Website:luapress.org

Source: github.com/Fizzadar/Luapress

License: MIT

LuaPress is a static blog generator

Pros:

  • LuaRocks install
  • Modern, fresh and in active development
  • Stable and well tested version
  • Nice template system, supports mustache and markdown
  • Reasonable documentation
  • Seems to be compatible with all Lua verions >= 5.1

Cons:

  • Not being used in production on many websites
  • Single person project with no other contributors and little to no community
  • Could be better documented

Sputnik

Website: spu.tnik.org

Source: github.com/yuri/sputnik/

License: GPL

Sputnik is an extensible Wiki

Pros:

  • LuaRocks install
  • Stable and used on production on a number of projects
  • Good documentation

Cons:

  • Compatible only with Lua5.1
  • Very old abandoned project, it's no longer maintained

Others