Skip to main content

Quick Start

This guide walks you through enqueueing your first background job with Zeridion Flare.

Prerequisites

Don't have an API key yet?

Sign up at zeridion.com to create a free account. Your API key will be available in the dashboard immediately — no credit card required.

1. Install the NuGet package

dotnet add package Zeridion.Flare --prerelease

The package targets net10.0 and netstandard2.1, so it works on .NET 6 through .NET 10.

2. Add your API key

Add your key to appsettings.json:

{
"Zeridion": {
"ApiKey": "zf_live_sk_xxxxxxxxxxxxxxxxxxxx"
}
}

Your API key starts with zf_live_sk_ (production) or zf_test_sk_ (test).

3. Register in Program.cs

using Zeridion.Flare;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddZeridionFlare(options =>
{
options.ApiKey = builder.Configuration["Zeridion:ApiKey"]!;
});

var app = builder.Build();
app.UseZeridionFlare();
app.Run();

AddZeridionFlare scans your assemblies for job classes, registers the HTTP client, job client, and background worker into the DI container. UseZeridionFlare validates that everything is configured correctly at startup.

4. Define a job

Create a class that implements IJob<TPayload>:

public class SendWelcomeEmail : IJob<NewUserEvent>
{
private readonly IEmailService _email;

public SendWelcomeEmail(IEmailService email) => _email = email;

public async Task ExecuteAsync(NewUserEvent payload, JobContext ctx)
{
await _email.SendAsync(payload.Email, "Welcome!");
ctx.Logger.LogInformation("Welcome email sent to {Email}", payload.Email);
}
}

public record NewUserEvent
{
public string Email { get; init; } = "";
public string Name { get; init; } = "";
}
  • Jobs implement IJob<TPayload> where the payload is any JSON-serializable class.
  • Constructor injection works normally — the SDK resolves your job from your DI container.
  • JobContext gives you the job ID, attempt number, cancellation token, and a scoped logger.

5. Enqueue it

Inject IJobClient anywhere in your app and call EnqueueAsync:

app.MapPost("/register", async (RegisterRequest req, IJobClient jobs) =>
{
var user = await CreateUser(req);

await jobs.EnqueueAsync<SendWelcomeEmail>(
new NewUserEvent { Email = user.Email, Name = user.Name });

return Results.Ok(user);
});

That's it. The job is sent to the Zeridion Flare API and executed by the background worker running in your app.

Next steps