Getting Started
OUTDATED!
The fastest way to get a Mayari project running is by using our scaffolding tool, but you can also set things up manually if you prefer.
Prerequisites
Before we start, make sure you have the following installed:
Option 1: Using the CLI (Recommended)
We created a CLI tool that handles all the boilerplate for you. It sets up your folders, configures your package manager, and creates sample routes automatically.
Open your terminal and run:
# Scaffold into the current directory
pesde x nova/create -- .or
# Scaffold into a new named directory. Replace 'my-app' with whatever you want to name your project
pesde x nova/create -- my-appOnce executed, the CLI will guide you through two prompts:
- Project name: must follow pesde's package naming format:
scope/name(e.g.myorg/my_project). Names are automatically normalized to lowercase with hyphens converted to underscores. - Runtime: choose between
Zune,Lune, orLute.
After scaffolding, run the following to get started:
# If you scaffolded into a new directory
cd <project-name>
pesde install
lune run start
# or
lute run start
# or
zune run startOption 2: Manual Installation
If you prefer doing things yourself, follow these steps.
1. Install Mayari
Add Mayari to your project using pesde:
pesde add nova/core
pesde install2. Create the Entry Point
Create a file named index.luau (or any name you like) in your root directory. This file initializes Mayari and starts the server.
local Nova = require("path/to/nova")
local app = Nova.new(8080)
app:listen(function()
print("Server is running on http://localhost:8080")
end)3. Create your first route
Mayari uses Filesystem Routing. This means the files in your app folder determine your URL paths. Create a folder named app, and inside it, create a file named route.luau.
You can structure your project like this:
/my-app
└── /src
├── index.luau
└── /app
└── route.luauInside app/route.luau, add this code:
local Nova = require("path/to/nova")
local Home = {}
function Home.Get()
return Nova.response.json({ message = "Hello, world!" })
end
return Home4. Run it
Start your server:
lune run src/index
# or
zune run src/index
# or
lute run src/index