Getting Started with LilGuy
This guide will walk you through installing LilGuy and creating your first web application.
Installation
LilGuy is distributed as a single binary, making installation straightforward. Choose the installation method for your operating system:
Windows
- Download the Windows installer (
lilguy-installer.msi
) from the releases page - Double-click the installer and follow the prompts
- LilGuy will be added to your system PATH automatically
macOS
- Download the macOS installer package (
lilguy.pkg
) from the releases page - Double-click the package and follow the installation prompts
- LilGuy will be installed to
/usr/local/bin
Linux
- Download the appropriate binary for your architecture:
lilguy-linux-amd64
for 64-bit Intel/AMD systemslilguy-linux-arm64
for 64-bit ARM systems (like Raspberry Pi)- Make the binary executable:
- Move it to your PATH:
Verifying Installation
Open a terminal or command prompt and run:
You should see the version number printed to confirm successful installation.
LilGuy Commands
LilGuy comes with several built-in commands:
lilguy new <project-name>
: Create a new projectlilguy serve
: Run the development serverlilguy shell
: Start an interactive Lua shelllilguy run <function>
: Execute a specific functionlilguy query "SQL"
: Run SQL queries against the database
Creating Your First Project
-
Create a new project:
-
Start the development server:
Your app will be available at http://localhost:8000
Project Structure
A new LilGuy project has this structure:
myapp/
├── app.lua # Main application logic
├── assets/ # Static files (CSS, images, etc.)
│ └── pico.css # Default styling
└── templates/ # HTML templates
├── index.html
└── layout.html
Development Server Options
The serve
command has several useful options:
lilguy serve --help
Options:
-l, --listen <addr> Address to bind to [default: 0.0.0.0:8000]
--no-reload Disable auto-reload on file changes
-o, --open Open browser automatically
-i, --interactive Start an interactive Lua shell
Basic Usage
Routes
Routes are defined in app.lua
. Here's a simple example:
routes["/"] = function(req, res)
res:render("index.html", {
message = "Welcome to LilGuy!"
})
end
routes["/about"] = function(req, res)
res:render("about.html", {
title = "About Us"
})
end
Templates
Templates use Jinja2 syntax. Here's a basic template example:
{% extends "layout.html" %}
{% block content %}
<h1>{{ message }}</h1>
<p>This is a LilGuy app!</p>
{% endblock %}
Database
LilGuy uses SQLite for data storage. You can interact with the database in several ways:
-
Direct SQL queries:
-
From Lua code:
Next Steps
Now that you're familiar with the basics of LilGuy, you can:
- Learn about all available functions and features in the API Reference
- Check out the Examples for common usage patterns
- Join the community to get help and share your projects
Common Commands Reference
Here's a quick reference of common commands you'll use:
# Create a new project
lilguy new myapp
# Start the development server
lilguy serve
# Start the server and open browser
lilguy serve --open
# Start server with interactive shell
lilguy serve --interactive
# Run SQL queries
lilguy query "SELECT * FROM sqlite_master"
# Start an interactive shell
lilguy shell