# fn-55-headless-daemon-and-watch-mode-for.2 Extract reusable headless background runtime

## Description

Extract a reusable background runtime from the current `gno serve` startup path.

The goal is that the watcher/scheduler/database/context lifecycle exists independently of the web server. The result should be a reusable runtime/service object that both `gno serve` and `gno daemon` can consume.

Focus on:

- DB/store/context lifecycle extraction
- making browser event-bus requirements optional or no-op compatible
- preserving current `gno serve` behavior with no regressions
- clear `start()` / `dispose()` semantics

## Acceptance

- [ ] Shared background runtime exists outside the web-server entrypoint.
- [ ] `gno serve` uses the extracted runtime with no behavior regression.
- [ ] Headless use no longer requires a browser event bus.
- [ ] Runtime has explicit lifecycle methods.

## Done summary

Extracted a reusable background runtime from the existing `gno serve` startup path.

Added a shared runtime module that owns DB/config/context/scheduler/watcher lifecycle so both `gno serve` and `gno daemon` can reuse the same background indexing machinery.

## Evidence

- Commits: f0053ee
- Tests: bun run lint:check, bun run typecheck, bun test, bun run docs:verify, mise exec ruby@3.3.6 -- make build
- PRs:
