DEV Community

Takahiro Fukushima
Takahiro Fukushima

Posted on

How to easily start Backstage

Hi, I'm Tak.
Today's topic is Backstage.

I'm interested Platform engineering, DevOps, Cloud Native.
So I selected it.

What is “Backstage” ?

Backstage is an open source IDP (Internal Developer Portal) developed by Spotify to improve developer productivity.

Point

  1. To build Backstage
  2. To make GitHub repository from Backstage
  3. To add software template

Condition

  • node v20.11.1
  • yarn v1.22.22

1. To build Backstage

Type this command in terminal.

npx @backstage/create-app@latest
Enter fullscreen mode Exit fullscreen mode

Type input app name, for example "test-backstage"
Image description

Type this command

cd test-backstage && yarn dev
Enter fullscreen mode Exit fullscreen mode

Go to localhost:3000

Take a look this display.
Image description

2. To make GitHub repository from Backstage

First, Set GitHub access token in app-config.local.yaml
Image description

You make it, Go to https://github.com/settings/tokens/new,
So make access token.

And add this code in /package/backend/src/index.ts

backend.add(import('@backstage/plugin-scaffolder-backend-module-github'));
Enter fullscreen mode Exit fullscreen mode

Image description

in some cases, type this command in terminal.

export NODE_OPTIONS=--no-node-snapshot
Enter fullscreen mode Exit fullscreen mode

Then, Click "Create..." in sidebar.

Image description

Next, Click "CHOOSE",

Image description

Input Component name, then click "NEXT"

Image description

Input owner name and repository name, then click "REVIEW"

Image description

You check no problem, click "CREATE"

Image description

It's Created.

Image description

Go to GitHub, check repository list.

Image description

It's source code in repository.

Image description

Where are files in Backstage codes?

Image description

There are it in /examples/template/content directory.

3. To add software template

So add software template Laravel code.

For example, make /laravel-example/templatedirectory.

cd /laravel-example/template
composer create-project laravel/laravel content --prefer-dist
Enter fullscreen mode Exit fullscreen mode

Copy & Paste from /examples/template/content/catalog-info.yaml to /laravel-example/template/content/catalog-info.yaml,
And Copy & Paste template.yaml, entities.yaml, org.yaml.

.
├── entities.yaml
├── org.yaml
└── template
    ├── content
    │   ├── README.md
    │   ├── app
    │   ├── artisan
    │   ├── bootstrap
    │   ├── catalog-info.yaml
    │   ├── composer.json
    │   ├── composer.lock
    │   ├── config
    │   ├── database
    │   ├── package.json
    │   ├── phpunit.xml
    │   ├── public
    │   ├── resources
    │   ├── routes
    │   ├── storage
    │   └── tests
    └── template.yaml
Enter fullscreen mode Exit fullscreen mode

Then, add this code in app-config.yaml

    - type: file
      target: ../../laravel-example/template/template.yaml
      rules:
        - allow: [Template]
Enter fullscreen mode Exit fullscreen mode

Image description

Kill yarn process, next yarn dev.
Take a look Create a new componet display.

Image description

So you can create laravel code repository.

Finish

Are you interested Backstage?
It's easily to build and use Backstage.
I'm learning it now, so I'd like to use it more.

Thanks to read it.
Have a good engineer life!!

Top comments (0)