Skip to content

Create STRATO DApp

Create STRATO DApp

Although developing a dApp from scratch allows for maximum flexibility, many platform users may find it helpful to start with a basic framework. BlockApps has developed a tool to instantiate a basic STRATO dApp, based on common application patterns that have been requested by enterprise users. To access this tool, you will need to clone the STRATO dApp respository from Github:

Create-strato-dapp Tool

This utility instantiates a STRATO application. It performs the following steps: - Sets up the OAuth configuration - Initializes a backend skeleton - Initializes a frontend REACT-based UI - Sets up Docker packaging

Usage

For prerequisites and usage please refer to README here: https://github.com/blockapps/create-strato-dapp

Configuration Parameters Asked when Generating an Application

  • Your STRATO node's URL;
  • OAuth: Cookie Name;
  • OAuth: OpenID discovery URL;
  • OAuth: Client ID and Client Secret;

  • Callback URLs.

Assumptions

This utility makes the following assumptions:

  1. The application will execute on localhost by default
  2. STRATO is running on a remote node with OAUTH_ENABLED and the user has OAuth details for the relevant identity server

It is possible to set up the application for a different environment by modifying the config that is generated at project-name-server/config/localhost.config.yaml.

Structure of Generated Application

The create-strato-dapp will bootstrap a project inside the <project-name> directory. This directory has the following major components:

  1. The server - This is a node js application that houses an express API that can be expanded to create a domain specific API for your application. This API will interact with the middleware, that in turn will use ba-rest to interact with the smart contracts. The server also contains a library of commonly used smart contracts (blockapps-sol), which provide smart contracts for commonly used patterns like collections, authentication, identity management for STRATO DApps.
  2. The frontend - This is a ReactJS frontend that will provide the user interface that interacts with the express API exposed by the server
  3. Nginx Proxy - This contains a sample dev and production nginx configuration and proxy to enable both the frontend and backend to be available at the same endpoint to ease OAuth integrations

For detailed configuration/deployment information please refer to the README.md file generated in your <project-name> directory after the bootstrap.

You can also look at our sample application to get a better idea of how to go about building your own app