Quickstart: State Management
In this quickstart, you'll run a stateful order application on Diagrid Cloud. You will learn how to:
- Provision a Diagrid project with a managed KV store using the Diagrid CLI.
- Save and retrieve state items using the Dapr State API.
- Inspect stored data in the Diagrid Web Console.
1. Prerequisites
Before you proceed, ensure you have the following prerequisites installed.
- Python
- .NET
- JavaScript
- Java
2. Log in to Diagrid
Authenticate to Diagrid using the following command:
diagrid login
This command opens a new browser window where you'll be shown a confirmation code that should match the code in your terminal. Confirm the code, and if you're not logged into Diagrid, you'll be redirected to login.
Confirm your user details are correct using the following command:
diagrid whoami
The expected output contains the name of the organization, your user name, and the Diagrid API endpoint.
3. Clone Quickstart Code
Clone the quickstart code from GitHub:
git clone https://github.com/diagridio/catalyst-quickstarts
Navigate to the quickstart directory:
- Python
- .NET
- JavaScript
- Java
- macOS/Linux
- Windows
cd catalyst-quickstarts/state/python
cd catalyst-quickstarts\state\python
- macOS/Linux
- Windows
cd catalyst-quickstarts/state/csharp
cd catalyst-quickstarts\state\csharp
- macOS/Linux
- Windows
cd catalyst-quickstarts/state/javascript
cd catalyst-quickstarts\state\javascript
- macOS/Linux
- Windows
cd catalyst-quickstarts/state/java
cd catalyst-quickstarts\state\java
4. Install Dependencies
Install the dependencies for the state management application.
- Python
- .NET
- JavaScript
- Java
Install Python dependencies:
uv sync --all-packages
Install .NET dependencies:
dotnet restore
Install Node dependencies:
npm install
Install Maven dependencies:
mvn clean install
5. Run the application with Diagrid Cloud
The diagrid dev run command creates your Diagrid project, provisions resources (apps, Diagrid KV Store service), configures environment variables, and launches your application connected to Diagrid Cloud.
- Python
- .NET
- JavaScript
- Java
uv run diagrid dev run -f state-quickstart.yaml --project state-quickstart --approve
diagrid dev run -f state-quickstart.yaml --project state-quickstart --approve
diagrid dev run -f state-quickstart.yaml --project state-quickstart --approve
diagrid dev run -f state-quickstart.yaml --project state-quickstart --approve
Wait a few seconds until you see application logs in the terminal to ensure the application is up and running and connected to Diagrid.
6. Call the State API
With the quickstart running, test the State API by storing, retrieving, and deleting state items.
6.1 Store state
Open a new terminal and execute the following command to save a state item to the Diagrid KV store:
- macOS/Linux
- Windows
curl -i -X POST http://localhost:5001/order -H "Content-Type: application/json" -d '{"orderId":1}'
Invoke-RestMethod -Method Post -Uri "http://localhost:5001/order" -ContentType "application/json" -Body '{"orderId":1}'
The expected response is:
HTTP/1.1 201 Created
The application logs in the diagrid dev run terminal should show an order was saved.
6.2 Retrieve state
Confirm the state item was saved successfully by retrieving it:
- macOS/Linux
- Windows
curl -i -X GET http://localhost:5001/order/1
Invoke-RestMethod -Method Get -Uri "http://localhost:5001/order/1"
The expected response body is:
{"orderId":1}
6.3 View in the Diagrid Web Console
Open the Diagrid Cloud web console and navigate to the KV Store data explorer to (Resources > Managed KV store) view stored state items. The data explorer displays the key-value pairs saved by your application.

7. Clean Up
Press CTRL+C in the terminal that runs diagrid dev run to stop the application and disconnect from Diagrid Cloud.
To delete the entire project and all provisioned resources:
diagrid project delete state-quickstart
Summary
In this quickstart you:
- Logged in to Diagrid and provisioned a managed state store project with a single CLI command (
diagrid dev run). - Saved and retrieved state items using the Dapr State API.
- Inspected stored data using the Diagrid KV Store data explorer.
Diagrid handled state persistence and key-value storage automatically — no infrastructure to manage.
Next steps
- Use state management in your own app with the Dapr API SDK guides.
- Try the other building blocks: the Service Invocation quickstart and the Pub/Sub quickstart.
- Swap the managed services for your own infrastructure with components.
- Run your app outside
diagrid dev runwith Deploy to Kubernetes.