How-To Guides
Scaffold a Full-Stack Project
Section titled “Scaffold a Full-Stack Project”lexigram new project my-app --template full -d ./workspacecd ./workspace/my-appls src/my_app/The full template includes application.yaml, app.py, modules structure, tests, and pyproject.toml.
Create a New Extension Package
Section titled “Create a New Extension Package”lexigram new package my-feature -d ./extensionscd ./extensions/lexigram-my-featureuv syncuv run pytestScaffolds lexigram-my-feature/ with pyproject.toml, src/lexigram/my_feature/, di/provider.py, and a unit test scaffold.
List All Available Generators
Section titled “List All Available Generators”lexigram gen listGenerators are contributed by installed packages. Each entry shows the generator name and description.
Generate a Model, Service, and Controller
Section titled “Generate a Model, Service, and Controller”lexigram gen model Productlexigram gen service ProductServicelexigram gen repository ProductRepositorylexigram gen controller ProductControllerGenerated files are placed in the project’s src/ tree, following framework conventions.
Run Database Migrations
Section titled “Run Database Migrations”lexigram db init # create initial migrationlexigram db migrate -m "add email field"lexigram db upgrade # apply pendinglexigram db rollback # revert lastlexigram db status # check statelexigram db list # show historyRequires lexigram-sql to be installed in the project.
Inspect the Runtime
Section titled “Inspect the Runtime”lexigram inspect providers # list DI providerslexigram inspect routes # show HTTP routeslexigram inspect health # run health checkslexigram inspect container # show container bindingsStart an Interactive Shell
Section titled “Start an Interactive Shell”lexigram shell # REPL with app contextlexigram shell --ipython # use IPython if availablelexigram shell --no-app # plain Python REPLThe context-loaded shell provides app, container, config, db, cache, and events.
Run Project Checks as a Pre-Commit Gate
Section titled “Run Project Checks as a Pre-Commit Gate”lexigram test # run pytestlexigram lint # run rufflexigram project typecheck # run mypylexigram project run-all # all checks- Use
--jsonflag on any command for machine-readable output - Generators create files relative to the project root; run from the project directory
- Migration files are timestamped and stored in the project’s migrations directory
- The dev server and run command auto-discover
create_app(); usemodule:attrsyntax to override