CLI Commands Reference
Lila Framework provides powerful CLI tools to speed up development. All commands
follow the pattern
lila-{command}
Model Generator
Lila features a powerful model builder that scaffolds SQLAlchemy models inheriting from BaseModel.
Running the command without parameters starts the Interactive Wizard, allowing you to configure primary keys, soft delete logic, timestamps, and define custom columns right from the console.
# 1. Start the interactive console wizard
lila-model create
# 2. Create a default model skeleton non-interactively
lila-model create --name Product
# 3. Create a model with a custom database table name
lila-model create --name Product --table custom_products
# 4. Force interactive mode even when providing parameters
lila-model create --name User --interactive
# 5. List all active model files inside app/models/
lila-model list-models
Interactive Wizard Features
The interactive prompt guides you through standard configuration choices:
- Table Name: Automatically infers pluralized snake_case of the model name, or takes a custom name.
- Primary Key: Generates an optimized primary key (e.g.
id) configured with database indexes (index=True) for high query performance. - Soft Delete: Sets up
_delete_logic = Trueand appends an active column. Calling delete on models automatically acts as soft delete. - Timestamps: Prompts you to add
created_atandupdated_attimezone/TIMESTAMP fields. - Custom Column Loop: Add columns dynamically: asks for name, type (String, Integer, Float, Text, Boolean), length (for Strings), nullability, uniqueness, and optional defaults.
Scaffold Generator
Generate complete CRUD functionality from existing models.
# Generate scaffold from model lila-scaffold-crud --model Product # Custom route name lila-scaffold-crud --model Product --name products
Migrations
Run database migrations to create tables from models.
# Run migrations lila-migrations migrate # Refresh (drop and recreate all tables) lila-migrations migrate --refresh
Authentication
Generate authentication system with login, register, and password recovery.
# Generate auth system lila-auth main
Admin Panel
Create admin users and admin panel.
# Create admin user lila-create-admin --password mypassword # Create admin panel lila-create-panel-admin --password mypassword
Minify Assets
Minify CSS and JavaScript files in-place for production.
# Minify all CSS and JS files lila-minify
Optimize Assets (Ahead-of-Time)
Create a production-ready manifest mapping, convert images to WebP, and generate parallel
.min.js and .min.css files without modifying your original files. The
public() Jinja helper will automatically load these optimized assets.
# Optimize all Images, CSS, and JS lila-optimize
Security Utilities
Generate a new secure SECRET_KEY for
your .env file.
# Replace SECRET_KEY in .env with a new randomly generated token lila-secret-key
SEO Generators
Generate sitemap.xml and robots.txt files automatically based
on your application's routes.
# Generate sitemap.xml in the public folder lila-seo sitemap --domain https://mywebsite.com # Generate robots.txt in the public folder lila-seo robots --domain https://mywebsite.com