🏗️ CLI Scaffold Generator
Generate complete CRUD functionality from existing models with a single command. The scaffold generator creates routes, templates, and automatically imports everything into your application.
🚀 Basic Usage
First, create your model using the model CLI, then generate the scaffold:
Scaffold Generator
# Create a model first
lila-model create --name Product
# Generate complete CRUD scaffold
lila-scaffold-crud --model Product
# Custom route name
lila-scaffold-crud --model Product --name products
#execute migrations refresh
lila-migrations --refresh
📂 What Gets Generated
The scaffold generator creates a complete CRUD system:
app/routes/{name}.py- Complete CRUD routestemplates/html/{name}/index.html- DataTable with modals- Auto-imports routes in
main.py
🛤️ Generated Endpoints
The following routes are automatically created:
API Endpoints
GET /product → HTML page with DataTable
GET /api/product → JSON list of all products
GET /api/product/{id} → JSON single product
POST /api/product → Create new product
PUT /api/product/{id} → Update product
DELETE /api/product/{id} → Soft delete (active=0)
✨ Features
- ✅ Validates model exists before generating
- ✅ Responsive DataTable with search and pagination
- ✅ Create and Edit modals
- ✅ Soft delete functionality (active=0)
- ✅ Pydantic validation examples (commented)
- ✅ Multilingual support
- ✅ Auto-imports in main.py
🔧 Customization
After generation, you can customize:
- Import in
main.pythe generated route - Edit
app/routes/{name}.pyto add business logic - Uncomment Pydantic models for validation
- Customize the HTML template
- Add custom middleware