Home · Developers · Guides · Application

Foundations

Application

The application bootstrap and lifecycle

The Application class is the top-level orchestrator of Nova Coder. It boots the kernel, wires every subsystem, and provides a clean startup and shutdown sequence.

NovaApplication

NovaApplication extends the base Application from the kernel and registers all Nova Coder services in the correct order.

from novacoder.app import create_app

app = create_app(project_path="/path/to/project")
results = app.start()

print(app.health())
app.stop()

Startup Order

config
  ↓
logging
  ↓
workspace
  ↓
memory
  ↓
ai
  ↓
runtime
  ↓
permissions
  ↓
tools
  ↓
agents
  ↓
plugins

Services are initialized in this order and stopped in reverse order.

Wiring Services

NovaApplication creates service instances and registers them in both the Registry and the Container:

config_service = ConfigService(overrides)
config_service.initialize()

registry.register_instance("config", config_service)
container.register_instance("config", config_service)
container.register_instance(ConfigService, config_service)

Each service is also registered by its class so code can resolve either by name or by type. For example, RuntimeService can be resolved by name "runtime" or by class RuntimeService.

Lifecycle

app = create_app()
app.initialize()   # Build kernel, wire services
app.start()          # Initialize and start all services
app.run()            # Start and keep alive
app.stop()           # Stop and dispose all services

Health and Status

report = app.health()
print(report.status)  # healthy, degraded, unhealthy
print(report.services)

status = app.status()
print(status["services"])

Configuration Overrides

app = create_app(
    project_path="/path/to/project",
    overrides={
        "model": {"provider": "openai"},
        "workspace": {"index_on_start": False},
    }
)

Boot Sequence

  1. Application.initialize() creates the kernel via Bootstrap.
  2. Bootstrap.build() returns the container, registry, event bus, scheduler, health monitor, and lifecycle manager.
  3. NovaApplication registers each service in the registry and container.
  4. LifecycleManager.set_startup_order() is configured.
  5. Application.start() calls initialize_all() and start_all() on the lifecycle manager.
  6. If successful, the scheduler is started and ApplicationStarted is published.

Error Handling

If a service fails during startup, the ApplicationStartFailed event is published and app.start() returns the failing results. The application will not be marked as running.

Development Instructions

Adding a Service to the Application

  1. Create a service class in its subsystem (e.g., novacoder/my/service.py).
  2. In NovaApplication.initialize() in novacoder/app.py, instantiate the service using the loaded config.
  3. Register it by name and by class in both the registry and container:
    self._registry.register_instance("my", my_service)
    self._container.register_instance(MyService, my_service)
    
  4. Add the service name to NovaApplication.SERVICE_ORDER.
  5. Add an integration test in tests/test_app.py.
  6. Update the relevant subsystem wiki page and this page.

Testing the Full Lifecycle

from novacoder.app import create_app

app = create_app()
results = app.start()
for name, (ok, error) in results.items():
    assert ok, f"{name}: {error}"
assert app.is_running()
report = app.health()
assert report.status.value == "healthy"
app.stop()

Changing the Startup Order

Edit NovaApplication.SERVICE_ORDER in novacoder/app.py. Ensure dependencies are initialized before services that need them.

Source: wiki/application.md · rendered 2026-11-10