Skip to content

Latest commit

 

History

History
83 lines (55 loc) · 5.98 KB

RUNBOOK.md

File metadata and controls

83 lines (55 loc) · 5.98 KB

Overview

The Flow Playground is a web-based interactive IDE for running Cadence code. It also provides an environment for the Cadence intro tutorials.

The overall project consists of the web app (this) and an API backend.

The Playground Web App is implemented in React. The major components are as follows:

GraphQL / Apollo Client

  • All HTTP communication with the Playground API is done via GraphQL using the Apollo client.
  • The GraphQL schema is defined by the Playground API in schemal.graphql
    • This project uses Apollo Client's localStorage interface as well.
    • You can view the local GraphQL schema in local.graphql.
  • CRUD methods (wrapped Apollo client) are implemented in projectMutator.ts.
  • TypeScript typings and CRUD methods for Apollo are auto-generated using GraphQL Code Generator.
  • After making changes to the schema.local you will need to run npm run graphql:codegen to auto-generate new typings and methods for Apollo Client.

Monaco Editor

Cadence Language Server

Deployment

The Playground Web App is deployed to Vercel. You will see a link to join the Flow Vercel team when you open your first PR. You must be a member of the team to trigger deployments.

Staging Deployment

URL: https://play.staging.onflow.org

The Playground Web App is deployed to https://play.staging.onflow.org each time a new commit is pushed to the staging branch on this repository.

  1. Open a new pull request and select staging as the base branch. Vercel will trigger a new deployment once the PR is approved and merged.

  2. Vercel will then report the deployment status on the staging branch:

vercel-deployment

Production Deployment

URL: https://play.onflow.org

Once a staging deployment has been verified, you can promote the changes to production.

The Playground Web App is deployed to https://play.onflow.org each time a new commit is pushed to the production branch on this repository.

  1. Open a new pull request and select production as the base branch and staging as the source branch. Production deployments should always deploy the same code that is already live in staging. Vercel will trigger a new deployment once the PR is approved and merged.

  2. Vercel will then report the deployment status on the production branch:

vercel-deployment

Important Gotcha: User Sessions & Project "Forking"

The Playground will not function in browsers where cookies or localStorage are disabled.

How It Works

The Playground determines what content to load into the UI based on a url query param named projectId.