CLI Commands

The beans CLI provides powerful commands to scaffold, manage, and develop your Lua on Beans applications.

add_box
Generators

Scaffold controllers, models & more

storage
Database

Migrations & database setup

play_arrow
Development

Dev server & file watching

add_box Generator Commands

Quickly scaffold new components for your application.

create controller Generate a new controller
$ beans create controller posts

Creates app/controllers/posts_controller.lua with basic CRUD actions

create model Generate a new model
$ beans create model post

Creates app/models/post.lua with standard database operations

create scaffold Generate complete resource
$ beans create scaffold posts

Creates controller, model, and views for a complete CRUD resource

create migration Generate a database migration
$ beans create migration add_indexes_to_posts

Creates a new migration file in migrations/ for schema changes

storage Database Commands

Manage your database schema with migrations.

db:setup Initialize the database
$ beans db:setup

Sets up the database according to your configuration

db:migrate Run pending migrations
$ beans db:migrate

Executes all pending database migrations

db:rollback Revert last migration
$ beans db:rollback

Reverts the last applied migration

play_arrow Development Commands

Commands for local development workflow.

dev Start development server
$ beans dev

Starts the development server with live reload on port 8080

specs Run test suite
$ beans specs

Runs the test suite for your application

list Command Reference

Quick reference for all available commands.

Command Description
beans new <name> Create a new Lua on Beans project
beans dev Start development server
beans -w Watch mode (auto-rebuild CSS/JS)
beans create controller <name> Generate a new controller
beans create model <name> Generate a new model
beans create scaffold <name> Generate controller, model, and views
beans create migration <name> Generate a database migration
beans db:setup Set up the database
beans db:migrate Run pending migrations
beans db:rollback Rollback last migration
beans specs Run test suite
lightbulb

Usage Tips

After migrations: Always run beans db:migrate after creating a new migration or pulling changes that include new migrations.

Rapid prototyping: Use beans create scaffold to quickly prototype new features with a complete CRUD setup.

Testing: Run beans specs regularly to ensure your changes haven't broken existing functionality.

Watch mode: Use beans -w during development to automatically recompile Tailwind CSS and Riot.js when you make changes.