Files
backstage/packages/backend
blam d721c5c2d2 Merge branch 'master' of github.com:spotify/backstage into blam/github-as-source
* 'master' of github.com:spotify/backstage: (52 commits)
  build(deps): bump @rollup/plugin-json from 4.0.3 to 4.1.0 (#1360)
  build(deps-dev): bump lerna from 3.22.0 to 3.22.1 (#1390)
  build(deps): bump graphql from 15.0.0 to 15.1.0 (#1391)
  core-api: switch IdentityApi id token access to async
  Adding name of signed in user to greeting message (#1387)
  Fix CircleCI plugin (#1384)
  packages/core: update to not use default exports for components
  auth-backend: clean up naming and types of TokenFactory time handling
  auth-backend: some review feedback of oidc bits
  auth-backend: remove logging from DatabaseKeyStore
  auth-backend: more docs for TokenFactory
  auth-backend: added tests for TokenFactory and fix keyDuration being ignored
  auth-backend: added tests for DatabaseKeyStore
  auth-backend: refactor identity to remove logic from storage layer
  auth-backend: document identity types
  auth-backend: refactor identity APIs for forwards compatibility
  auth-backend: update standalone setup to use service builder and HMR
  auth-backend: issue user id tokens when signing in with google or github
  auth-backend: move logger setup out from constructors and use non-reserved fields
  auth-backend: make key duration configurable
  ...
2020-06-22 13:38:02 +02:00
..

example-backend

This package is an EXAMPLE of a Backstage backend.

The main purpose of this package is to provide a test bed for Backstage plugins that have a backend part. Feel free to experiment locally or within your fork by adding dependencies and routes to this backend, to try things out.

Our goal is to eventually amend the create-app flow of the CLI, such that a production ready version of a backend skeleton is made alongside the frontend app. Until then, feel free to experiment here!

Development

To run the example backend, first go to the project root and run

yarn install
yarn tsc
yarn build

You should only need to do this once.

After that, go to the packages/backend directory and run

AUTH_GOOGLE_CLIENT_ID=x AUTH_GOOGLE_CLIENT_SECRET=x AUTH_GITHUB_CLIENT_ID=x AUTH_GITHUB_CLIENT_SECRET=x SENTRY_TOKEN=x LOG_LEVEL=debug yarn start

Substitute x for actual values, or leave them as dummy values just to try out the backend without using the auth or sentry features.

The backend starts up on port 7000 per default.

Populating The Catalog

If you want to use the catalog functionality, you need to add so called locations to the backend. These are places where the backend can find some entity descriptor data to consume and serve.

To get started, you can issue the following after starting the backend, from inside the plugins/catalog-backend directory:

yarn mock-data

You should then start seeing data on localhost:7000/catalog/entities.

The catalog currently runs in-memory only, so feel free to try it out, but it will need to be re-populated on next startup.

Authentication

We chose Passport as authentication platform due to its comprehensive set of supported authentication strategies.

Read more about the auth-backend and how to add a new provider

Documentation