Skip to main content

spa.config.json

The project configuration file, placed at the root of the moon_template directory.

Full schema

{
"page_title": "my_app",
"mount_id": "app",
"initial_props": {
"user": "guest"
},
"server": {
"host": "127.0.0.1",
"port": 8000
},
"router": {
"routes": [
{
"path": "/",
"component": "Home",
"props": {},
"children": [],
"index": false,
"guard": null,
"meta": {}
}
]
}
}

Fields

FieldTypeDefaultDescription
page_titlestring"moon-spa"HTML <title> tag value
mount_idstring"app"DOM element ID where the app mounts
initial_propsobject{}Default props passed to the entry component
server.hoststring"127.0.0.1"Bind address
server.portnumber8000Port
routerobject | nullnullRouter configuration (see Router API)

Router Contract

When router is enabled:

  • route rendering is driven by router.routes.
  • matched components are rendered from the route stack.
  • route groups can use children without defining a component on group nodes.
  • when router.initial_path is "/", initial render starts from the route that matches "/".

Minimal config

{
"page_title": "hello",
"server": { "host": "0.0.0.0", "port": 3000 }
}

Config loading

TemplateConfig is a frozen dataclass defined in moon_spa.types.