Hacker News new | past | comments | ask | show | jobs | submit login
Fullmoon – Redbean-based Lua web framework deployed as single file (github.com/pkulchenko)
155 points by keb_ on Feb 18, 2022 | hide | past | favorite | 21 comments



In case anyone didn't know, as another user rightfully mentioned, this is by Paul Kulchenko who is widely known for his work on the very impressive, very lightweight, and very robust Lua IDE, ZeroBrane Studio[1]. The man has a pretty amazing track record.

[1] https://studio.zerobrane.com/


Thanks for introducing Zerobrane, really looks fantastic. Also by extension introduced me to https://makeself.io/ for making Linux installations.


Just looked over the github page, showcase examples include https usage and a LOT of practical details on how to make practical use of Redbean/Cosmopolitan ecosystem. Thanks a lot to Kulchenko for the work done on Fullmoon!


Thank you for the feedback and all the kind words. @jart did a great job on Redbean/Cosmopolitan, so it's a delight to use and build on top of.


Anything from the cosmopolitan/αcτµαlly pδrταblε εxεcµταblε world is always a delight.


Seconded. Paul's contribution of the Fullmoon web framework is a great way to promote the stunning Cosmopolitan viewpoint.


Paul Kulchenko is a wonderful human being - zerobrane is a joy to use.

This looks like it could mesh very well with Node Red, or really any Lua scripted environment. Thanks!


The documentation for this (all in the README) is really, really good.


Need : sudo sh -c "echo ':APE:M::MZqFpD::/bin/sh:' >/proc/sys/fs/binfmt_misc/register" to run redbean, this really should be documented for linux

to run the demo, still I got lots of warning about "tool/net/redbean.c:1034:redbean:68740] (lua) failed to run lua code: /.init.lua:1: module 'fullmoon' not found", adding the path to LUA_PATH and LUA_CPATH did not help.

last, is there a lua version requirement for this? My system default to lua 5.1.

I was thinking about using this for an embedded board, but the code is actually quite large, 1.6M after zipped, which is too much for small boards.


Yes, that register patch may be needed on some Linux systems; I'll add this to the documentation.

Redbean can't use the system Lua, so it comes bundled with its own Lua interpreter (Lua 5.4; there is also work being done to allow LuaJIT or Luau to be embedded instead).

The modules need to be put in the .lua directory within redbean archive; redbean searches within its archive, so you don't need to set LUA_PATH/LUA_CPATH. I have instructions on how to get examples working included in the examples (https://github.com/pkulchenko/fullmoon/tree/more-links#examp...) section.

In terms of the size, this includes MbedTLS and SQLite, so if you don't need those modules, you can compile redbean without them, which should reduce the size considerably.


I updated the installation instructions [1] to add the register patch.

[1] https://github.com/pkulchenko/fullmoon#installation


It's a little bit tricky to put Redbean in a Docker container, if you want to do so, check out this repo, it might help doing that: https://github.com/kissgyorgy/redbean-docker


Does Lua have official style conventions? Most Lua code I've seen is in lower or snake_case, but this seems to be camelCase. I've never mixed and matched before, and I don't know if it's a big deal.


I don't think there is an official style convention, but there are popular style guides; for example, this one [1] is using the same style for variable naming. I do use all lowercase for most of my other Lua projects, but I thought camelCase could work better for this one.

[1] https://github.com/Olivine-Labs/lua-style-guide#variables


This looks great.

> Highly experimental with everything being subject to change.

Makes me a little hesitant to give the tires a serious kick, though.


Don't be. I just want to provide a fair warning, but some of my other projects (wxlua and ZeroBrane Studio already mentioned in other comments) maintain compatibility with dependency versions released 8 years ago. The API is also more stable than it was at v0.10 when the warning was added, even though I do expect changes, as both Fullmoon and redbean continue to be developed and new features are being added.


not slow enough to compile, is there a rust rewrite please? /s

lua is a lovely scripting language, i was looking at replacing my bash scripts the other day in my project, lua could be a solid candidate..


the best part is you can use Fennel lang for this.


Very nice!

Apart from using Redbean (which looks interesting itself), could you summarize the differences between Fullmoon and Lapis?


(Fullmoon author here) I actually started with integrating Lapis into redbean (I have redlapis module that mimics a subset of openresty API over redbean to Lapis, so I can run it over Redbean), but it led to too much work given the difference in the underlying server architecture, so I abandoned this effort in favor of the redbean-focused one (can publish what I have if someone is interested to give it a try). There were also some philosophical differences; for example, I preferred a different routing implementation (with specific routing order) and it was difficult to change or re-configure the one in Lapis.

In terms of the differences, Lapis is definitely the more feature rich one, as it includes its own ORM and integration with various back-ends (including data access and migration). Lapis is largely class-based and Fullmoon is taking a more procedural approach, which I think aligns better with redbean's simplicity and performance. Lapis provides session support, which Fullmoon currently doesn't have, but it's one of the next functions I plan to implement. Routing and templating capabilities are similar in both, even though the approaches taken are quite different.

Fullmoon is likely to be noticeably faster (at least based on my local tests) and can leverage some of the components already available in redbean out of the box (for example, argon2, hmac functions, and direct SSL integration). Lapis is well documented and has several interesting projects built on it, so it's much more battle tested. fullmoon is only 3 months old and is being actively worked on. Its code is also much shorter, so it may be easier to study and tweak. Fullmoon also includes 150+ tests that one can run locally or from redbean.

Hope this helps as a quick overview, but if there are more detailed questions, let me know.


Very comprehensive, thank you!




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

Search: