HN2new | past | comments | ask | show | jobs | submitlogin
Lapis – A web framework for Lua or Moonscript (leafo.net)
156 points by galfarragem on Jan 27, 2019 | hide | past | favorite | 27 comments


Hey, I'm Leaf and I made lapis. Thanks for sharing this

Although a new version hasn't been deployed in a while it's still heavily used (and developed, but it's been mostly stable for me). My current main thing is https://itch.io, which is powered by lapis. I have a bunch of other sites running on it too: https://streak.club https://sightreading.training and I also made https://luarocks.org

itch.io is the largest thing I've ever started, it's currently about 220k lines of MoonScript code.

Feel free to ask any questions!


I used moonscript extensively for a project about 6 years ago, and it was fantastic.

I love watching all the things you build, and thanks for all your contributions to the lua ecosystem!


Itch.io is my favourite storefront. The amount of creativity there is immeasurable.


Marco from Kong here. At Kong[1] we use Lapis for our control plane API and it's been phenomenal so far. If you have a project in Lua and are considering a web framework, I would definitely recommend Lapis - it's mature enough and battle tested. Pro tip: run on top of LuaJIT[2] for extra performance.

[1] - https://konghq.com/

[2] - http://luajit.org/


Lapis is fun! If you have a quick project idea to sketch out, it's very similar to Rails or Django - it just uses Lua.

I don't personally like the 'moonscript' language, but you can use traditional Lua instead. I think I remember it being easy to use luajit for performance, too.

The documentation is sort of bare-bones though, so if you want to go off the rails with your design it can take some figuring out.

Still, I would encourage people to give it a look; Lua is a fantastic language, Lapis is easy to set up and get started with, and it probably won't look unfamiliar if you've used a model/view/controller framework before.


Leafo wrote a blog post[1] a while back about how Lapis/OpenResty uses coroutines to implement seemless asynchronous functions that I always thought was interesting. I've been meaning to play around with Lapis to see how easy it is to work with...

[1]: http://leafo.net/posts/itchio-and-coroutines.html


I have a good experience in general with Lua and Tarantool. Last year, my company decided to give Lapis/openresty a shot, and It is very challenging. for example:

1- debugging moonscript error messages always references the compiled lua (nothing like sourcemaps)

2- creating layouts is just pure pain (you will need to create moonscript widgets instead of writing HTML so your frontend people need to learn Lua too.


Man, Moonscript looks amazing, reminiscent of pug/Jade.

Anyone experienced Moonscript? How is it, how is the ecosystem, is it fun?


I've used it a bit with love2d for game prototypes. I love it. It has my favorite syntax of probably any language. The community/ecosystem is certainly lacking but growing all the time. It still needs a bit of work to simplify debugging with some kind of sourcemap functionality. And it is extremely fun, especially in combination with love2d.


That is awesome. I used to write some moonscript for love2d too. Abandoned it for Godot but that really helped me get a better handle on game dev.


Ecosystem wise, it's the Lua ecosystem. Compatible, from both sides of the coin.

It's classes are fantastic when working with structures that lean that way, like in games. (I've used it a fair bit with Love2d.)

Comprehensions and stabby-procs are also something that are nice to have. Makes it easier in some cases. Just more consistent in others.


Very neat! Obviously heavily inspired by Rails/Sinatra but probably a few orders of magnitudes faster. Also MoonScript looks like a very interesting language[1].

[1]: https://moonscript.org/reference/


OpenResty looks pretty cool. Have any patterns emerged for building large-ish apps on it?


Kong api gateway seems to be using it.


Lapis is pretty much that. I don't know of anything larger running on openresty than the luarocks site.


The LuaRocks website is pretty small.

Lapis was born from https://itch.io (kind of like Rails was born from Basecamp). It is still the "largest" website I know using it.

OpenResty itself has a similar story with Taobao, one of the largest wesites in the world, even though now they use a fork (tengine). I think several other large Chinese and Russian websites use it.

In the US, Kong is also based on OpenResty, and CloudFlare uses OpenResty a lot (and is now its main sponsor).


I guess I downplayed how much more complexity there would be in itch than luarocks, and just thought about what probably gets more use.

Also I was trying to answer the apps question specifically as whole web apps that are running on openresty. So I wasn't thinking about tools built with openresty, though I think that is it's biggest utility.


I'be built a DDOS protection reverse proxy using it a few years back. It's still in use and serves thousand of domains with quite a bit a traffic.


Are there other frameworks that run on OpenResty? I like the idea very much and I like Lua, but I don't like this class/ORM thing.


The thing about OpenResty is that you can do most of it on your own without a framework at all. If you don't need all the (it's not really that much) stuff Lapis comes with, you could just require the modules you do need with Luarocks or OPM in a route and handle things that way. It's just Lua. If you don't want to use Lapis's ORM though, you could just not do it though. AND Lapis in vanilla Lua isn't especially OO, it looks a lot like Express/Sinatra.


Thank you. I guess I'll try it now.


How does this compare to Sailor?


Sailor is unmaintained and its main author (Etiene Dalcol) now advises the use of Lapis if you want to use Lua on the Web.

(This is a pretty simplified version of the situation, see https://github.com/sailorproject/sailor/issues/173 for more.)


anytime i see luarocks, i say nope:

https://github.com/luarocks/luarocks/issues/839


LuaRocks 3.0 ships with an all-in-one statically-built binary which is built against up-to-date libraries and does not require these third-party tools. Get it here:

http://luarocks.github.io/luarocks/releases/

The legacy package is, as the name implies, legacy. Thanks for reminding me about this issue, about time it is closed. The Windows installation instructions need to be updated at the LuaRocks wiki, but that's a separate issue.


Why is it important how old the build tools are!?


When did those tools switch to GPL v3?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: