Getting Started
Lynx is a fast and simple web framework for Lune, a general purpose runtime for the Luau programming language. Lynx is inspired by Hono and shares a similar API.
Basic usage
local Lynx = require("@lynx/lynx")local app = Lynx.new()
app:get("/", function(c) return c:text("Hello, Lynx!")end)
app:serve()
Installation
To install Lynx, add the repository as a submodule in your project.
git submodule add https://github.com/Nicell/lynx.git lynx
This will add Lynx to your project in the lynx
directory.
To update Lynx, update the submodule from the remote.
git submodule update --remote
Editor setup and require aliases
To make importing Lynx easier, you can add a .luaurc
require alias to your project:
{ "aliases": { "lynx": "lynx/src/" }}
If you’re using the Luau LSP VSCode extension, add this directoryAlias
to your VSCode workspace’s settings.json
:
{ "luau-lsp.require.directoryAliases": { "@lynx": "lynx/src/" }}
This should give you inline autocompletion, inline documentation, and type-hinting support in your editor.
If you encounter “invalid require” TypeErrors or other issues when trying to require Lynx, try:
- closing and re-opening your
.luau
files, - making sure you’ve opened the current folder as a VSCode workspace,
- checking your
.luaurc
anddirectoryAliases
for syntax, spelling, invalid whitespaces and/or missing trailing slashes (sometimes can cause platform-specific issues), - and restarting the Luau LSP extension.
Using Lynx in your project
Now you can require Lynx using the alias "@lynx/lynx"
:
-- main.luau (or any other location in your project)local Lynx = require("@lynx/lynx") -- hover over the Lynx variable for inline documentation
Features
- 🧩 Simple API - Convenient methods for creating routes and generating a response
- ⚡️ Fast Routing - Efficient routing using a radix tree
- 📦 Intuitive Middleware - Extend request handling easily
Use cases
Lynx can be used to write a simple web API, a quick-and-easy simple html website, a proxy server, or to glue other web services together for extra potential!