@grest-ts/discovery-local
v0.0.48
Published
Local service discovery implementation for Grest Framework
Maintainers
Readme
Part of the grest-ts framework. Documentation | All packages
@grest-ts/discovery-local
IPC-based service discovery for local development and testing. Used internally by the framework — you typically don't interact with this package directly.
For a full overview of how discovery works, see the Discovery guide.
What it does
Runs a local discovery server that acts as a central router. Service instances connect over IPC, register their routes, and discover each other through the router. The router also acts as a reverse proxy, forwarding requests to the correct backend based on path prefix matching.
Standalone bin
npx @grest-ts/discovery-local --port 9000Runs GGLocalDiscoveryServer as its own process (default port 9000). Use this when you want the router up before any runtime, with clean ownership and its own logs. Without it, runtimes default to GGLocalDiscoveryResilientClient and leader-elect for the router port; with it running, point runtimes at it as plain GGLocalDiscoveryClients.
Exported classes
| Class | Purpose |
|---|---|
| GGLocalDiscoveryClient | Connects to an existing discovery server |
| GGLocalDiscoveryResilientClient | Adds leader election with automatic failover — multiple instances compete for the router port, and if the leader dies, a follower takes over |
| GGLocalDiscoveryServer | The router itself |
Testkit
Available via @grest-ts/discovery-local/testkit:
GGLocalRoutingStrategySelector— controls routing strategies in tests (e.g.first,roundRobin, or a custom strategy)
