Difficulty: intermediate
Estimated Time: 15 minutes

IMPORTANT: You need to do the steps in sequence in order for the state of the lesson's learning environment to be consistent. Otherwise, you'll get behaviors that might be confusing.


The objective of this scenario is to demonstrate how to use the Node.js package grpc-tools to auto-generate gRPC messages and procedures defined in the .proto file that ships with ProgrammableWeb's demonstration gRPC API SimpleService.

Also, you'l be able to view the auto-generated code in the version of Visual Studio Code that's built directly into the Katacoda interactive learning environment.

Scenario Contents

Here's a listing of the lessons in the scenario.

Lesson 1 - Get the example code

Lesson 2 - Install grpc-tools

Lesson 3 - Generate the gRPC messages and services

Lesson 4 - Work with the genereated code

To proceed, click the Start Scenario button.

You've crossed the finish line!

In this scenario you learned how to:

  • Get the example code
  • Install grpc-tools
  • Generate the gRPC messages and services
  • Work with the genereated code

Please be advised that although autogenerating Node.js code using grpc-tools reduces the amount of work that you need to do to get a fully functional gRPC API up and running, you will still need to create the actual gRPC server and client that will use the message and procedure JavaScript objects that are the result of auto-generation.

The gRPC community provides an example for integrating auto-generated code into a Node.js gRPC server and gRPC client. You can find the example here.

Auto-generating gRPC Code for Node.js

Step 1 of 4

Get the example code


The objective of this lesson is to demonstrate how to clone the source code for the example gRPC API from GitHub.

We'll use the .proto file in the API source code a when auto-generating message object on a language specific basis.

Once the code is cloned from GitHub we're going to create a directory in the source code directory. One directory will be named node_autogen. The directory, node_autogen will contain the auto-generated JavaScript code.


Step 1: Clone the source code for the demonstration gRPC API SimpleService from GitHub

git clone https://github.com/programmableweb/simple-node-grpc

Step 2: Navigate to gRPC API working directory

cd simple-node-grpc/1.0.1

In the next step we'll install the Node.js package, grpc-tools. We'll use grpc-tools to generate the JavaScript code for the gRPC API messages and procedures defined in the SimpleService .proto file.