diff --git a/plugins/gateway-backend/README.md b/plugins/gateway-backend/README.md index a8b55b36c7..3bbe728954 100644 --- a/plugins/gateway-backend/README.md +++ b/plugins/gateway-backend/README.md @@ -1,34 +1,39 @@ -# gateway +# Gateway Backend Plugin -Welcome to the gateway backend plugin! +A plugin for managing request routing in distributed Backstage deployments. -This plugin is useful for adopters who have [split the backend plugins into multiple different Backstage deployments](https://backstage.io/docs/backend-system/building-backends/index#split-into-multiple-backends) and implemented their own Discovery service to resolve the urls of the backend plugins. +## Overview -A custom discovery service helps you routing the requests from a backend plugin to another backend plugin, but it doesn't help you routing the requests from the frontend to a backend plugin, unless you hardcode the urls in the frontend or expose the different backend plugins via a custom reverse proxy. +This plugin is designed for organizations that have [split their backend plugins across multiple Backstage deployments](https://backstage.io/docs/backend-system/building-backends/index#split-into-multiple-backends) and implemented a custom Discovery service to resolve backend plugin URLs. -You can deploy this plugin in a "gateway" Backstage deployment to route requests from the frontend to the correct backend plugin. The plugin leverages the Discovery service to resolve the urls of the other backend plugins. If a plugin is already installed in the "gateway" Backstage deployment, the plugin the local plugin will be used. +While a custom discovery service handles routing between backend plugins, it doesn't address frontend-to-backend routing without either: + +- Hardcoding URLs in the frontend +- Implementing a custom reverse proxy + +The Gateway Backend Plugin solves this by providing a centralized routing solution in a dedicated "gateway" Backstage deployment. It routes frontend requests to the appropriate backend plugins using the Discovery service, while prioritizing local plugins when available. ## Installation -This plugin is installed via the `@backstage/plugin-gateway-backend` package. To install it to your backend package, run the following command: +1. Install the plugin package: ```bash # From your root directory yarn --cwd packages/backend add @backstage/plugin-gateway-backend ``` -Then add the plugin to your backend in `packages/backend/src/index.ts`: +2. Add the plugin to your backend in `packages/backend/src/index.ts`: -```ts -const backend = createBackend(); -// ... -backend.add(import('@backstage/plugin-gateway-backend')); +```diff + const backend = createBackend(); + // ... ++ backend.add(import('@backstage/plugin-gateway-backend')); ``` -Make sure to configure the `baseUrl` in the `app-config.yaml` file to point to the "gateway" Backstage deployment. +3. Configure the `baseUrl` in your `app-config.yaml` to point to your gateway deployment: ```yaml backend: - # the baseUrl of the "gateway" Backstage deployment + # The baseUrl of your gateway Backstage deployment baseUrl: http://gateway-backstage-backend.example.com ```