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
Application.initialize()creates the kernel viaBootstrap.Bootstrap.build()returns the container, registry, event bus, scheduler, health monitor, and lifecycle manager.NovaApplicationregisters each service in the registry and container.LifecycleManager.set_startup_order()is configured.Application.start()callsinitialize_all()andstart_all()on the lifecycle manager.- If successful, the scheduler is started and
ApplicationStartedis 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
- Create a service class in its subsystem (e.g.,
novacoder/my/service.py). - In
NovaApplication.initialize()innovacoder/app.py, instantiate the service using the loaded config. - 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) - Add the service name to
NovaApplication.SERVICE_ORDER. - Add an integration test in
tests/test_app.py. - 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.
Related Documentation
- Kernel
- Configuration
- CLI