Litestar Builder creates Litestar projects and adds domain modules to projects using
the bundled template in src/lst_builder/assets.
Starting a backend project often means repeatedly setting up the same
application structure, configuration, database integration, and feature-module
boilerplate before you can focus on your product. Litestar Builder automates
that setup by generating a ready-to-customize Litestar project from a
consistent template, including a src-based package layout and starter
application components.
The lst-build domain command extends a generated project with a feature
module's controller, schemas, service, dependencies, guards, and database
model. This gives new domains a consistent starting structure and avoids
manually creating and wiring those files each time. The generated code is
intended as a starting point that you can adapt; Litestar Builder does not
replace Litestar or make application-specific design decisions for you.
lst-build project my-project
cd my-project
uv syncThe command creates ./my-project by default. To use an existing or custom
directory as the project root, pass it as the second argument; files are created
directly in that directory:
lst-build project my-project ./workspaceThe generated project uses a src/<package> layout. The package name defaults to
the snake_case project name and can be set explicitly:
lst-build project my-project --package my_appA generated project uses a src layout. The package directory is named after
the selected package name (shown as my_app here):
my-project/
├── .env.example
├── .gitignore
├── .python-version
├── README.md
├── pyproject.toml
├── uv.lock
└── src/
└── my_app/
├── __main__.py
├── __metadata__.py
├── cli/
├── core/
│ ├── server/
│ ├── settings/
│ └── utils/
├── db/
│ ├── fixtures/
│ ├── migrations/
│ └── models/
└── domain/
└── accounts/
├── controller/
├── schemas/
├── services/
├── deps.py
└── guards.py
- The project-root files contain package metadata and dependencies
(
pyproject.toml,uv.lock), Python-version and Git settings, and the template README and environment example. __main__.pystarts the Litestar CLI.core/server/configures the application and its plugins,core/settings/holds application and infrastructure settings, andcore/utils/contains shared helpers.db/models/holds SQLAlchemy models,db/migrations/contains Alembic configuration and migration history, anddb/fixtures/is the location for fixture data.domain/accounts/is the starter account feature. Its controllers define routes, schemas describe request and response data, services hold business and persistence operations,deps.pyprovides injected dependencies, andguards.pycontains route access checks.
The template's sample CRUD domain and sample model are not copied into a new
project. Add a feature domain with lst-build domain inventory; this creates
src/my_app/domain/inventory/ with controller, schema, service, dependency,
and guard modules, plus src/my_app/db/models/inventory.py.
Run the command from inside a generated project:
lst-build domain inventoryAdd multiple domains by separating their names with spaces:
lst-build domain inventory billing notificationsThe command creates a domain module under <package>/domain/inventory and a
matching database model under <package>/db/models. Controllers are discovered
by the generated project's domain plugin; the model is registered in
db/models/__init__.py for migration discovery.