Migrate from v0.2 to v0.3
In v0.3, `metricsRoutes` and `devicesRoutes` were removed from `backend/core/gateway/workers/lib/server/index.js`. The auth and telemetry endpoints they registered are now delivered by the default plugins, which load automatically — no action needed for those.
If your v0.2 code patched or monkey-patched those registrations to inject custom logic:
1. Create a plugin directory with an [`mdk-plugin.json`](https://github.com/tetherto/mdk/blob/main/backend/core/plugins/README.md#manifest-format) and controller files for the routes you were injecting.
2. Pass the directory to `startGateway()` via `extraPluginDirs`.
```js
// Before (v0.2 — no longer works)
const server = require('@tetherto/mdk-gateway/workers/lib/server')
server.metricsRoutes.push(myCustomRoute)
// After (v0.3+)
await startGateway({
kernel,
extraPluginDirs: [path.join(__dirname, 'plugins/my-metrics')]
})
```
## Next steps
- Try the [live site backend example](/guides/deployment/run-all-workers-site) for a complete worked plugin with three routes: a live site overview,
a historical series, and a command endpoint running under PM2 or Docker
- Build the minimal dashboard tutorial — end-to-end worked example of the single-plugin + controller pattern
- Understand how Workers declare their data via `mdk-contract.json` — what `mdkClient` reads and `sendCommand` dispatches
- See the full [manifest and services reference](https://github.com/tetherto/mdk/blob/main/backend/core/plugins/README.md)
- Review the [Gateway API and config](https://github.com/tetherto/mdk/blob/main/backend/core/gateway/README.md)
# Run the Gateway (/guides/gateway/run)
## Overview
This guide covers three ways to run the Gateway: programmatically via `startGateway()` (the standard production path), connected to
a remote Kernel over HRPC (cross-host deployments), and as a standalone process from the source tree (for contributors).