Library mote - Lightweight HTTP server for Lua
I've been working on a standalone HTTP server for Lua/LuaJIT. It started as the core of a Backend as a service (BaaS) project I was building and I decided to extract it into a standalone library. It has Koa-style routing with URL params, onion middleware, and built-in support for CORS, JWT, rate limiting, and Server-Sent Events with pub/sub. Runs on Linux, macOS, and Windows. No nginx or openresty needed, though a reverse proxy is still recommended for TLS in production.
Example:
local mote = require("mote")
mote.get("/users/:id", function(ctx)
ctx.response.body = { id = ctx.params.id }
end)
mote.create({ port = 8080 }):run()luarocks install mote
https://github.com/luanvil/mote
I'd love to hear what you think.
31
Upvotes
6
u/activeXdiamond Jan 26 '26
Always happy to see more webdev stuff in the Lua world.
As someone with programming experience but minimal experience in anything web related, can you give me a quick description of the difference between this and Lapis or OpenResty?
I'm guessing it's sort of a "game engine vs game framework" thing?
1
u/ineedanamegenerator Jan 26 '26
Haven't read through much of the code, but could this be used with copas? Would be nice to run a webserver co-routine.
3
u/ineedanamegenerator Jan 26 '26
This looks really cool. I'm using openresty a lot but this is interesting for adding a small REST API and webinterface to some Lua based tools I made.
Now I have to find time to try this.
3
u/Nervous-Pin9297 Jan 27 '26
Dammit if only I heard of this a week earlier. Looks really cool! I stared it and will use in the future.