Skip to main content
Version: Next

@backstage/backend-plugin-api

Home > @backstage/backend-plugin-api

Core API used by Backstage backend plugins.

Functions

FunctionDescription
createBackendFeatureLoader(options)Creates a new backend feature loader.
createBackendModule(options)Creates a new backend module for a given plugin.
createBackendPlugin(options)Creates a new backend plugin.
createExtensionPoint(options)Creates a new backend extension point.
createServiceFactory(options)Creates a root scoped service factory without options.
createServiceFactory(options)Creates a plugin scoped service factory without options.
createServiceRef(options)Creates a new service definition. This overload is used to create plugin scoped services.
createServiceRef(options)Creates a new service definition. This overload is used to create root scoped services.
createServiceRef(options)Creates a new service definition. This overload is used to create plugin scoped services.
createServiceRef(options)Creates a new service definition. This overload is used to create root scoped services.
isDatabaseConflictError(e)Tries to deduce whether a thrown error is a database conflict.
readSchedulerServiceTaskScheduleDefinitionFromConfig(config)Reads a SchedulerServiceTaskScheduleDefinition from config. Expects the config not to be the root config, but the config for the definition.
resolvePackagePath(name, paths)

Resolve a path relative to the root of a package directory. Additional path arguments are resolved relative to the package dir.

This is particularly useful when you want to access assets shipped with your backend plugin package. When doing so, do not forget to include the assets in your published package by adding them to files in your package.json.

resolveSafeChildPath(base, path)Resolves a target path from a base path while guaranteeing that the result is a path that point to or within the base path. This is useful for resolving paths from user input, as it otherwise opens up for vulnerabilities.

Interfaces

InterfaceDescription
AuthService

Provides token authentication and credentials management.

See the service documentation for more details.

BackendFeature
BackendModuleRegistrationPointsThe callbacks passed to the register method of a backend module.
BackendPluginRegistrationPointsThe callbacks passed to the register method of a backend plugin.
BackstageUserInfoRepresents user information that is available to the backend, based on some user credentials.
CacheService

A pre-configured, storage agnostic cache service suitable for use by Backstage plugins.

See the service documentation for more details.

CreateBackendFeatureLoaderOptionsOptions for creating a new backend feature loader.
CreateBackendModuleOptionsThe configuration options passed to createBackendModule().
CreateBackendPluginOptionsThe configuration options passed to createBackendPlugin().
CreateExtensionPointOptionsThe configuration options passed to createExtensionPoint().
DatabaseService

Manages access to databases that plugins get.

See the service documentation for more details.

DiscoveryService

The DiscoveryService is used to provide a mechanism for backend plugins to discover the endpoints for itself or other backend plugins.

See the service documentation for more details.

HttpAuthService

Provides handling of credentials in an ongoing request.

See the service documentation for more details.

HttpRouterService

Allows plugins to register HTTP routes.

See the service documentation for more details.

HttpRouterServiceAuthPolicyOptions for HttpRouterService.addAuthPolicy().
LifecycleService

Provides registration of plugin startup and shutdown lifecycle hooks.

See the service documentation for more details.

LifecycleServiceShutdownOptions
LifecycleServiceStartupOptions
LoggerService

A service that provides a logging facility.

See the service documentation for more details.

PermissionsService

Permission system integration for authorization of user/service actions.

See the permissions documentation and the service documentation for more details.

PermissionsServiceRequestOptionsOptions for PermissionsService requests.
PluginMetadataService

Access metadata about the current plugin.

See the service documentation for more details.

PluginServiceFactoryOptions
RootConfigService

Provides access to static configuration.

See the configuration documentation and the service documentation for more details.

RootHealthService
RootHttpRouterService

HTTP route registration for root services.

See the service documentation for more details.

RootLifecycleService

Registration of backend startup and shutdown lifecycle hooks.

See the service documentation for more details.

RootLoggerService

Root-level logging.

See the service documentation for more details.

RootServiceFactoryOptions
SchedulerService

Deals with the scheduling of distributed tasks, for a given plugin.

See the service documentation for more details.

SchedulerServiceTaskInvocationDefinitionOptions that apply to the invocation of a given task.
SchedulerServiceTaskRunnerA previously prepared task schedule, ready to be invoked.
SchedulerServiceTaskScheduleDefinitionOptions that control the scheduling of a task.
SchedulerServiceTaskScheduleDefinitionConfigConfig options for SchedulerServiceTaskScheduleDefinition that control the scheduling of a task.
ServiceFactory
ServiceRefOptions
UrlReaderService

A generic interface for fetching plain data from URLs.

See the service documentation for more details.

UserInfoService

Authenticated user information retrieval.

See the service documentation for more details.

Namespaces

NamespaceDescription
coreServicesAll core services references

Type Aliases

Type AliasDescription
BackstageCredentialsAn opaque representation of credentials, for example as passed in a request-response flow.
BackstageNonePrincipalRepresents a principal that is not authenticated (for example when no token at all was given to a request).
BackstagePrincipalAccessRestrictionsThe access restrictions that apply to a given principal.
BackstagePrincipalTypesThe types of principal that can be represented in a BackstageCredentials object.
BackstageServicePrincipalRepresents a service principal (for example when an external access method token was given to a request, or the caller was a Backstage backend plugin).
BackstageUserPrincipalRepresents a user principal (for example when a user Backstage token issued by the auth backend was given to a request).
CacheServiceOptionsOptions passed to CacheService.withOptions().
CacheServiceSetOptionsOptions passed to CacheService.set().
ExtensionPointTODO
LifecycleServiceShutdownHook
LifecycleServiceStartupHook
SchedulerServiceTaskDescriptorA semi-opaque type to describe an actively scheduled task.
SchedulerServiceTaskFunction

A function that can be called as a scheduled task.

It may optionally accept an abort signal argument. When the signal triggers, processing should abort and return as quickly as possible.

ServiceRefA reference to a backend service. You can use these references to mark dependencies on services and having their implementations injected automatically.
UrlReaderServiceReadTreeOptionsAn options object for UrlReaderService.readTree() operations.
UrlReaderServiceReadTreeResponseA response object for UrlReaderService.readTree() operations.
UrlReaderServiceReadTreeResponseDirOptionsOptions that control execution.
UrlReaderServiceReadTreeResponseFileRepresents a single file in a UrlReaderService.readTree() response.
UrlReaderServiceReadUrlOptionsAn options object for readUrl operations.
UrlReaderServiceReadUrlResponseA response object for UrlReaderService.readUrl() operations.
UrlReaderServiceSearchOptionsAn options object for search operations.
UrlReaderServiceSearchResponseThe output of a search operation.
UrlReaderServiceSearchResponseFileRepresents a single file in a search response.