Skip to main content

CLI Reference

The moon-spa command-line tool.

moon-spa <command> [options]

Commands

moon-spa create <name>

Scaffold a new project by copying the built-in moon_template into a new directory.

moon-spa create my_app
ArgumentDescription
nameProject name (letters, numbers, underscore — no spaces)

Optional path:

moon-spa create my_app ./apps
ArgumentDefaultDescription
path.Destination directory where the project folder is created

Errors:

  • ValueError if the name contains invalid characters
  • FileExistsError if the directory already exists

moon-spa serve

Start the development server.

moon-spa serve
moon-spa serve --reload
OptionDescription
--reloadWatch .lspa, .py, .css, .js for changes and live-reload the browser

Prints the server URL on startup:

Serving moon-spa at http://127.0.0.1:8000

With `--reload`, the watcher path is shown relative to the current working directory:

```text
Live reload activated. Watching src for file changes...

moon-spa new component <name> [path]

Create a new component by copying ComponentTemplate, renaming files/content, and writing it into moon_template/components/<name>/.

moon-spa new component UserCard
moon-spa new component UserCard ./apps/my_project
ArgumentDefaultDescription
nameComponent name (Python identifier, e.g. UserCard)
path.Project root where moon_template exists

CLI output includes the exact created locations:

Component created at: <...>/components/UserCard/UserCard.lspa
Style created at: <...>/components/UserCard/UserCard.css

With `--reload`, the watcher path is shown relative to the current working directory:

```text
Live reload activated. Watching src for file changes...

moon-spa new component <name> [path]

Create a new component by copying ComponentTemplate, renaming files/content, and writing it into moon_template/components/<name>/.

moon-spa new component UserCard
moon-spa new component UserCard ./apps/my_project
ArgumentDefaultDescription
nameComponent name (Python identifier, e.g. UserCard)
path.Project root where moon_template exists

CLI output includes the exact created locations:

Component created at: <...>/components/UserCard/UserCard.lspa
Style created at: <...>/components/UserCard/UserCard.css

Invoke via Python module

python -m moon_spa serve --reload
python -m moon_spa create my_app
python -m moon_spa new component UserCard

Serve flow