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.

Model Builder Commands
# 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 = True and appends an active column. Calling delete on models automatically acts as soft delete.
  • Timestamps: Prompts you to add created_at and updated_at timezone/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.

cli.scaffold_crud

# 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.

cli.migrations

# 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.

cli.auth

# Generate auth system
lila-auth main

Admin Panel

Create admin users and admin panel.

cli.create_admin

# 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.

cli.minify

# 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.

cli.optimize

# Optimize all Images, CSS, and JS
lila-optimize

Security Utilities

Generate a new secure SECRET_KEY for your .env file.

cli.secret_key

# 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.

cli.seo

# 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