backstage-backend-plugin

Community

Automate Backstage backend APIs & jobs.

Authorrothenbergt
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Developing Backstage backend plugins involves navigating complex concepts like dependency injection, core services (e.g., httpRouter, database, httpAuth), and ensuring secure-by-default practices. This Skill streamlines the process of building robust APIs and background jobs, reducing boilerplate and complexity.

Core Features & Use Cases

  • Specialized Workflows: Step-by-step procedures for creating and configuring backend plugins.
  • Best Practices: Production-ready patterns for authentication, validation, error handling, and database usage with Knex.js.
  • Golden Path Templates: Copy/paste code snippets for common backend patterns, including API endpoints and scheduled background tasks.
  • Use Case: Rapidly scaffold a new Backstage backend plugin, integrate core services like a database and logger, and define a secure API endpoint, ensuring all best practices for testing and scalability are followed.

Quick Start

Example: Define a new Backstage backend plugin with core service dependencies.

This snippet goes into src/plugin.ts after scaffolding.

import { createBackendPlugin, coreServices } from '@backstage/backend-plugin-api'; import { createRouter } from './service/router';

export const examplePlugin = createBackendPlugin({ pluginId: 'example', register(env) { env.registerInit({ deps: { httpRouter: coreServices.httpRouter, logger: coreServices.logger, database: coreServices.database, httpAuth: coreServices.httpAuth, userInfo: coreServices.userInfo, }, async init({ httpRouter, logger, database, httpAuth, userInfo }) { const router = await createRouter({ logger, database, httpAuth, userInfo }); httpRouter.use(router);

    httpRouter.addAuthPolicy({ path: '/health', allow: 'unauthenticated' });
  },
});

}, });

export { examplePlugin as default } from './plugin';

Dependency Matrix

Required Modules

@backstage/backend-plugin-api@backstage/backend-commonexpressexpress-promise-routerknex

Components

scriptsreferences

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: backstage-backend-plugin
Download link: https://github.com/rothenbergt/backstage-agent-skills/archive/main.zip#backstage-backend-plugin

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.