npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

backstage-grpc-playground

v0.3.0

Published

A frontend plugin for Backstage supporting gRPC playground

Downloads

1,558

Readme

backstage-grpc-playground

GitHub Project Level GitHub issues GitHub contributors

Overview

backstage-grpc-playground is a backstage plugin ported from BloomRPC which is an Electron application. We modified some of the original code to make this compatible with Backstage entity. See Compare to BloomRPC

This repo contains React frontend plugin. For the backend plugin, please checkout backstage-grpc-playground-backend

Changelog

View Full changelog

Requirements

  • Backstage ^1.5.0
  • Node.JS 14 | 16

Methods supported

  • Unary
  • Client streaming
  • Server streaming

Not supported (yet)

We are currently not supporting

Install

Install backstage-grpc-playground for packages/app

E.g: In your backstage project root

yarn --cwd packages/app add backstage-grpc-playground

Usage

Customize ApiDoc to use backstage-grpc-playground for grpc type

// packages/app/src/apis.ts
import { GrpcPlaygroundComponent } from 'backstage-grpc-playground';

// your code
// ...

export const apis: AnyApiFactory[] = [
  // other apis 
  // ...
  
  createApiFactory({
    api: apiDocsConfigRef,
    deps: {},
    factory: () => {
      // load the default widgets
      const definitionWidgets = defaultDefinitionWidgets();

      return {
        getApiDefinitionWidget: (apiEntity: ApiEntity) => {
          // custom rendering for grpc
          if (apiEntity.spec.type === 'grpc') {
            return {
              type: 'grpc',
              title: 'gRPC Playground',
              component: GrpcPlaygroundComponent
            }
          }
          
          // fallback to the defaults
          return definitionWidgets.find(d => d.type === apiEntity.spec.type);
        },
      };
    },
  }),
]

A path /grpc-playground in backstage application

// packages/app/src/App.tsx
import { GrpcPlaygroundPage } from 'backstage-grpc-playground'

// your code
// ...

const routes = (
  <FlatRoutes>
    // other routes 
    // ...
    <Route path="/grpc-playground" element={<GrpcPlaygroundPage />} />
  </FlatRoutes>
);

Example importing API definition from Github examples/yaml-definition/unary.yaml

import API

Compare to BloomRPC

  • Load proto files from defined entity spec (learn more at examples), creating clients and send gRPC requests at backstage backend
  • Proto files are contained in backend (default /packages/backend/proto)
  • Able to view document generated as markdown with protoc-gen-doc integrated in backend plugin. See example
  • Removed "Import from server reflection" See issue
  • Removed "Add import paths" button
  • Removed "gRPC-web" switch
  • Missing imports warning, allow user to upload folder
    • User upload a file "employee.proto" that imports "common.proto" missing import 1

    • User upload a file "account.proto" that imports some google-apis proto files. In this case user should import google folder missing import 2

  • Support generating document file in https://github.com/zalopay-oss/backstage-grpc-playground-backend/pull/1
  • Support proto library https://github.com/zalopay-oss/backstage-grpc-playground/issues/9, see guide

Yaml file definition

See yaml-definition

Examples

View document

See example

Unary

call 1

See example

Stream

call 1

See example

Acknowledgements