Create a Sample Application That Uses ScalarDB GraphQL
ScalarDB GraphQL Server is now deprecated, and consequently, this sample code is also deprecated. To use the ScalarDB GraphQL interface, you need to use ScalarDB Cluster, which is available only in the Enterprise edition. For more information, see ScalarDB Cluster.
This tutorial describes how to create a sample electronic money application that uses the ScalarDB GraphQL interface.
Overview
In the sample, you will use Cassandra as the database, and the Cassandra server and the ScalarDB GraphQL Server will run in Docker. Then, you will build a Node.js client application that will communicate with the ScalarDB GraphQL Server.
The sample client application is just one example of what you can create. Since GraphQL is a communication pattern, many tools in various programming languages exist for building applications.
What you can do in this sample application
The sample application supports the following types of transactions:
- Credit an amount to a user.
- Send an amount from one user to another user.
- Show a user's balance.
Prerequisites
- Docker 20.10 or later with Docker Compose V2 or later
- Node.js 16+
In addition, you need access to the Docker image for ScalarDB GraphQL in the GitHub Container registry, which is private. The registry is available only those who are using ScalarDB Enterprise. If you need a license for ScalarDB Enterprise, please contact us.
After confirming that you have access to the ScalarDB GraphQL repository and its packages in the GitHub Container registry, you will need to set your GitHub username and your personal access token. To specify these properties as environment variables, run the following commands, replacing <YOUR_GITHUB_USERNAME>
with your GitHub username and <YOUR_PERSONAL_ACCESS_TOKEN>
with your personal access token:
$ export USERNAME=<YOUR_GITHUB_USERNAME>
$ export TOKEN=<YOUR_PERSONAL_ACCESS_TOKEN>