website/src/docs/nitro/nitro-services.md
Nitro can be smoothly integrated into your HotChocolate server, enabling utilization of the Persisted Operation Storage found within the client registry, to report operations and collect open telemetry. Your server will establish a connection with Nitro, retrieving persisted operations based on their unique hashes. Additional information on the client registry can be found here.
To get started, follow these steps:
Set up a client registry as instructed here.
Install the Nitro package from NuGet using the following command:
dotnet add package ChilliCream.Nitro
var builder = WebApplication.CreateBuilder(args);
builder
.AddGraphQL()
.AddQueryType<Query>()
.AddInstrumentation() // if you want to use telemetry
.AddNitro(x =>
{
x.ApiId = "VGhpcyBpcyBub3QgYSByZWFsIGFwaSBpZA==";
x.ApiKey = "Tm9wZSwgdGhpcyBpcyBhbHNvIG5vIHJlYWwga2V5IDspIA==";
x.Stage = "dev";
})
.UseOnlyPersistedOperationAllowed() // optional
.UsePersistedOperationPipeline(); // if you want to use persisted operations
var app = builder.Build();
app.MapGraphQL();
app.Run();
nitro api list and nitro api-key create commands respectively. Instructions for these commands can be found here.Congratulations! You have successfully integrated Nitro into your HotChocolate server. You can now publish new versions of your clients and your server will automatically retrieve the latest persisted operations.
<!-- spell-checker:ignore Ghpcy, Bpcy, ZWFs -->