Strise API Demo

This repository contains an example React app using the Strise Process API for streaming updates about companies. Most of the code can be used in a server application as well.

A deployed version of the app can be found here.

GraphQL WebSocket Protocol

The Strise Process API adheres to the graphql-transport-ws protocol and clients must follow this specification. The graphql-ws NPM package supports this out of the box.

Authentication

The client authenticates against the API using a JSON Web Token. The token must be included in the payload of the initial message.

{
  "type": "connection_init",
  "payload": {
    "Authorization": "Bearer token"
  }
}

When using Apollo this the token is provided as in the example src/utils/client.tsx.

API documentation

The API documentation can be viewed in the hosted GraphQL Playground, or with any other GraphQL client / documentation explorer.

Codegen

One advantage of using a strongly typed API is that it is possible to generate custom types based on the current integration.

In this example graphql-codegen is used to generate TypeScript types based on the GraphQL operations specified in the files in src/graphql. The configuration can be found in codegen.yml.

graphql-codegen also has plugins for generating types in other languases such as Java or C#. Alternative codegen tools might also support other languages.

Development

  1. Install dependencies npm install
  2. Start the development server npm run dev:stage