Backstage
    Preparing search index...

    Module @backstage/plugin-catalog-backend

    Catalog Backend

    This is the backend for the default Backstage software catalog. This provides an API for consumers such as the frontend catalog plugin.

    It comes with a builtin database-backed implementation of the catalog that can store and serve your catalog for you.

    It can also act as a bridge to your existing catalog solutions, either ingesting data to store in the database, or by effectively proxying calls to an external catalog service.

    This @backstage/plugin-catalog-backend package comes installed by default in any Backstage application created with npx @backstage/create-app, so installation is not usually required.

    To check if you already have the package, look under packages/backend/package.json, in the dependencies block, for @backstage/plugin-catalog-backend. The instructions below walk through restoring the plugin, if you previously removed it.

    # From your Backstage root directory
    yarn --cwd packages/backend add @backstage/plugin-catalog-backend

    Then add the plugin to your backend, typically in packages/backend/src/index.ts:

    const backend = createBackend();
    // ...
    backend.add(import('@backstage/plugin-catalog-backend'));

    In the old backend system there's a bit more wiring required. You'll need to create a file called packages/backend/src/plugins/catalog.ts with contents matching catalog.ts in the create-app template.

    With the catalog.ts router setup in place, add the router to packages/backend/src/index.ts:

    +import catalog from './plugins/catalog';

    async function main() {
    ...
    const createEnv = makeCreateEnv(config);

    + const catalogEnv = useHotMemoize(module, () => createEnv('catalog'));
    const scaffolderEnv = useHotMemoize(module, () => createEnv('scaffolder'));

    const apiRouter = Router();
    + apiRouter.use('/catalog', await catalog(catalogEnv));
    ...
    apiRouter.use(notFoundHandler());

    At this point the catalog-backend is installed in your backend package, but you will not have any catalog entities loaded. See Catalog Configuration for how to add locations, or copy the catalog locations from the create-app template to get up and running quickly.

    CodeOwnersProcessor and AnnotateScmSlugEntityProcessor are no longer exported by this package. Use the corresponding community modules to retain their behavior:

    Install the module you need in your backend package and register it with backend.add(import('<module-package>')). Remove your custom registration of the old processor to avoid registering it twice. If you need to configure a processor explicitly, follow the replacement module's documentation.

    Internal publication bookkeeping adds a nullable generation column without rewriting existing entities. PostgreSQL builds its index concurrently, but still scans the entire catalog table, even when every generation is null.

    The metadata transaction has a five-second lock-wait timeout. If it expires, startup fails and must retry; repeated failures can cause deployment restart loops. The concurrent index phase has no imposed timeout and can wait on long transactions elsewhere in the database, including other plugins using separate schemas. It may exceed deployment startup deadlines.

    Large installations can prepare the column and index out of band before starting the upgraded service. Use the catalog plugin's schema, inspect for an existing or invalid index first, and run these commands outside a transaction:

    ALTER TABLE final_entities ADD COLUMN IF NOT EXISTS generation bigint;
    CREATE INDEX CONCURRENTLY final_entities_generation_idx
      ON final_entities (generation) INCLUDE (entity_ref)
      WHERE generation IS NOT NULL;
    

    The migration preserves an existing valid index and repairs an invalid one left by an interrupted build. Reruns do not reset the generation counter. Reversing the migration discards this bookkeeping, not entity or search contents.

    This does not expose a change-feed API or track deletions. On PostgreSQL, generations are assigned by a database trigger, so writes from older instances during a rolling upgrade are tracked too. On SQLite and MySQL, older instances can overwrite content while retaining a previously assigned generation. A non-null generation is therefore not proof of complete change tracking. Any future feed needs an explicit rollout activation boundary and initial synchronization strategy.

    This backend plugin can be started in a standalone mode from directly in this package with yarn start. However, it will have limited functionality and that process is most convenient when developing the catalog backend plugin itself.

    To evaluate the catalog and have a greater amount of functionality available, run the entire Backstage example application from the root folder:

    # in one terminal window, run this from from the very root of the Backstage project
    cd packages/backend
    yarn start

    This will launch both frontend and backend in the same window, populated with some example entities.

    • catalog is the frontend interface for this plugin.
    index
    plugins/catalog-backend/src/alpha