Skip to main content

Connect via Diagrid CLI for Dev/Test

Whether you have an application written with the Dapr SDKs, or you just want to test out a few capabilities, there are ways for you to try out the platform and get a feel for its capabilities and features. Building on the connectivity concepts, this guide shows you how to connect to Catalyst using the Diagrid CLI.

Prerequisites

Before connecting locally, ensure you have the Diagrid CLI installed and authenticated (diagrid login)

Connect an Existing Dapr Application

If you already have a Dapr application—whether it's a workflow, agent, or microservice—you can connect it to Catalyst with minimal changes. Your application code using Dapr SDKs will work as-is; you just need to point it to Catalyst's endpoints instead of a local Dapr sidecar.

Run a Single Application

The diagrid dev run command is compatible with dapr run and connects your local application to Catalyst by:

  • Injecting environment variables (project endpoints and App ID API token) for Dapr SDKs
  • Creating a local application connection tunnel for outbound requests
  • Running your application with the proper configuration

For applications that only make requests to Catalyst APIs:

diagrid dev run --app-id my-app <your-startup-command>

Example:

diagrid dev run --app-id publisher "java -jar target/app.jar"

For applications that receive outbound requests (subscriptions, bindings, invocations), specify the local port:

diagrid dev run --app-id subscriber --app-port 9001 "java -jar target/app.jar --port=9001"

The CLI creates a tunnel from Catalyst to your local port, routing all traffic to your local application.

Run Multiple Applications with a Multi-App File

If you're using a Dapr multi-app run file to manage multiple applications, diagrid dev run is compatible with this format. You can use your existing multi-app run file directly:

diagrid dev run -f my-apps.yaml

This command will:

  • Connect to your Catalyst project (or create it if it doesn't exist)
  • Create App IDs, components, and subscriptions as needed
  • Launch all local applications
  • Inject environment variables for Catalyst connectivity
  • Establish tunnels for apps receiving outbound requests
How-to: Generate a Multi-App File from existing Catalyst Resources

If you have an existing Catalyst project with resources already configured, you can scaffold a multi-app run file:

diagrid dev scaffold

This creates dev-<project-name>.yaml with all App IDs, components, and subscriptions from your project. Update the file with:

  • Local application directories (appDirPath)
  • Startup commands (command)
  • Local ports (appPort) for apps receiving requests

Then run it with diagrid dev run -f dev-<project-name>.yaml.

Manage Local Connections

Start a connection tunnel without running an app (useful for debugging):

diagrid dev run --app-id my-app --app-port 9001

Check active connections:

diagrid dev status

Stop a local connection:

diagrid dev stop -a my-app

Smoke Testing via CLI

If you don't have an application yet, you can quickly test Catalyst capabilities using the Diagrid CLI. This is useful for:

  • Validating component configurations
  • Testing subscriptions and bindings
  • Verifying infrastructure connectivity
  • Exploring Catalyst APIs

Prerequisites for Testing

You'll need a Project and at least one App ID in your project. Create if needed:

diagrid project create my-test-project
diagrid appid create my-test-app --project my-test-project

Making API Calls

Use diagrid call to invoke Catalyst APIs directly from the CLI. See diagrid call command reference ->

Receiving Outbound Requests

Use diagrid listen to receive outbound requests from Catalyst (pub/sub messages, input bindings, service invocations) without deploying application code. See diagrid listen command reference ->

Setting Connection Details

To connect your local environment to Catalyst, you need two pieces of information:

  1. Project Endpoints: The HTTP and gRPC endpoints for your Catalyst project
  2. App ID API Token: The authentication token for your App ID

The diagrid dev run command automatically handles these for you. If you're using Dapr SDKs directly (without diagrid dev run), you can retrieve and set these manually:

# Get project endpoints
diagrid project get <your-project-id>

# Get App ID API token
diagrid appid get <your-app-id> --project <your-project-id>

# Set environment variables
export DAPR_GRPC_ENDPOINT=<your-project-grpc-url>
export DAPR_HTTP_ENDPOINT=<your-project-http-url>
export DAPR_API_TOKEN=<your-appid-api-token>