A modern, fast and elegant web framework for Luvit.
# Install Luvit (if not already installed)
curl -L https://github.com/luvit/lit/raw/master/get-lit.sh | sh
# Install Crescent Framework
lit install daniel-m-tfs/crescent-framework
# Create new project
crescent new myapp
cd myapp
# Configure
cp .env.example .env
nano .env
# Run
crescent server
# or
luvit app.luaServer running at http://localhost:3000 π
- β‘ Fast - Built on Luvit (LuaJIT + libuv)
- π£οΈ Routing - Express-like routing system with parameters
- π Middleware - Extensible middleware pipeline
- ποΈ ORM - Active Record pattern for MySQL
- π¨ Views - Template engine (etlua) for MVC pattern
- π Security - CORS, Auth, and Security middleware built-in
- π¨ CLI - Powerful code generators (controllers, models, migrations)
- π¦ Modular - Organize code in modules
- π Migrations - Database version control
- β Validation - Built-in data validation
crescent new <name> # Create new project from GitHub template
crescent server # Start development server
crescent make:module <name> # Create complete CRUD module
crescent make:controller <name> # Create controller
crescent make:service <name> # Create service
crescent make:model <name> # Create Active Record model
crescent make:routes <name> # Create routes file
crescent make:migration <name> # Create migration
crescent migrate # Run pending migrations
crescent migrate:rollback # Rollback last migration
crescent migrate:status # Show migration status- Installation Guide: INSTALLATION.md
- Database Guide: DATABASE.md
- Views & Templates: VIEWS.md
- Security Guide: SECURITY.md
- Website: https://crescent.tyne.com.br
- Starter Template: https://github.com/daniel-m-tfs/crescent-starter
- Luvit >= 2.18
- Lit (package manager, comes with Luvit)
- Git (for creating new projects)
- MySQL (optional, for database features)
# macOS / Linux / WSL
curl -L https://github.com/luvit/lit/raw/master/get-lit.sh | sh
# Or via Homebrew (macOS)
brew install luvitThis installs both luvit and lit (the package manager).
The easiest way to start is using the starter template:
# Clone the starter template
git clone https://github.com/daniel-m-tfs/crescent-starter.git myapp
cd myapp
# Install dependencies
lit install
# Install CLI globally (optional, for `crescent` commands)
./install-cli.sh
# Configure and run
cp .env.example .env
luvit app.lua# Install Crescent Framework
lit install daniel-m-tfs/crescent-framework
# Install MySQL support (optional)
lit install creationix/mysql
# Install CLI globally (requires framework source)
cd deps/crescent-framework
./install.sh
# The 'crescent' command will be available globally
crescent --help# Clone the repository
git clone https://github.com/daniel-m-tfs/crescent-framework.git
cd crescent-framework
# Add to PATH (optional)
export PATH="$PATH:$(pwd)/bin"
# Test
luvit crescent-cli.lua --helpmyapp/
βββ app.lua # Entry point
βββ bootstrap.lua # Migration runner
βββ config/
β βββ development.lua # Dev configuration
β βββ production.lua # Production configuration
βββ src/ # Your application modules
β βββ users/ # Example module
β βββ controllers/ # HTTP request handlers
β βββ services/ # Business logic
β βββ models/ # Database models (Active Record)
β βββ routes/ # Route definitions
βββ migrations/ # Database migrations
βββ public/ # Static files
βββ tests/ # Tests
local Crescent = require('crescent')
local env = require('config.development')
-- Create app
local app = Crescent.new(env)
-- Middleware
app:use(require('crescent.middleware.logger'))
app:use(require('crescent.middleware.cors'))
-- Routes
app:get('/', function(ctx)
return ctx.json(200, { message = "Hello Crescent!" })
end)
app:get('/users/{id}', function(ctx)
local id = ctx.params.id
return ctx.json(200, { id = id, name = "John Doe" })
end)
app:post('/users', function(ctx)
local body = ctx.body
-- Validate and save user
return ctx.json(201, body)
end)
-- Start server
app:listen()local Model = require("crescent.database.model")
local User = Model:extend({
table = "users",
timestamps = true,
fillable = {
"name", "email", "password"
},
hidden = {
"password"
},
validates = {
name = {required = true, min = 3},
email = {required = true, email = true, unique = true}
}
})
-- Usage
local user = User:create({
name = "John Doe",
email = "john@example.com",
password = "secret"
})
local users = User:all()
local user = User:find(1)
user:update({name = "Jane Doe"})
user:delete()Crescent supports templates using etlua for building MVC applications:
Controller:
local function show_profile(ctx)
local user = User:find(ctx.params.id)
-- Render view with data
return ctx.view("views/profile.etlua", {
name = user.name,
email = user.email
})
endView (views/profile.etlua):
<!DOCTYPE html>
<html>
<head>
<title>Profile - <%= name %></title>
</head>
<body>
<h1><%= name %></h1>
<p>Email: <%= email %></p>
</body>
</html>π See VIEWS.md for complete documentation.
crescent make:module ProductThis creates:
- β
Controller (
src/products/controllers/products.lua) - β
Service (
src/products/services/products.lua) - β
Model (
src/products/models/products.lua) - β
Routes (
src/products/routes/products.lua) - β
Module entry point (
src/products/init.lua)
Then just register in app.lua:
local productsModule = require("src.products")
productsModule.register(app)# Create migration
crescent make:migration create_users_table
# Edit migration file in migrations/
# Then run:
crescent migrate
# Rollback if needed:
crescent migrate:rollbackContributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License - see LICENSE file for details.
- Starter Template: https://github.com/daniel-m-tfs/crescent-starter
- Documentation: https://crescent.tyne.com.br
- LuaRocks: https://luarocks.org/modules/daniel-m-tfs/crescent-framework
- Issues: https://github.com/daniel-m-tfs/crescent-framework/issues
Built with the same philosophy as Express.js and inspired by NestJS and Laravel, Crescent brings modern web development patterns to the Lua ecosystem through Luvit's powerful async/await model.
- π Performance - LuaJIT's blazing fast execution
- π Async - Non-blocking I/O with libuv
- π¨ Elegant - Clean, expressive syntax
- π¦ Batteries included - ORM, migrations, validation, auth
- π οΈ Developer friendly - Powerful CLI and generators
Made with β€οΈ for the Lua community
