Quick Start
Get a JasperFx-enabled application running in under a minute.
Minimal Setup
Create a new console application and install JasperFx:
bash
dotnet new console -n MyApp
cd MyApp
dotnet add package JasperFxReplace the contents of Program.cs:
cs
await Host
.CreateDefaultBuilder()
.ApplyJasperFxExtensions()
.RunJasperFxCommands(args);Running Commands
With this setup you immediately get access to built-in commands:
bash
# Show all available commands
dotnet run -- help
# Describe the application configuration
dotnet run -- describe
# Run environment checks
dotnet run -- check-envAdding Custom Commands
You can register your own commands by creating classes that extend JasperFxCommand<T> or JasperFxAsyncCommand<T>. See Writing Commands for details.
Adding Environment Checks
Register checks to verify your application's external dependencies at startup:
cs
public static void RegisterChecks(IServiceCollection services)
{
// Async check with IServiceProvider access
services.CheckEnvironment(
"Database is reachable",
async (IServiceProvider sp, CancellationToken ct) =>
{
// Throw an exception to indicate failure
await Task.CompletedTask;
});
// Synchronous check
services.CheckEnvironment(
"Configuration file exists",
(IServiceProvider sp) =>
{
if (!File.Exists("appsettings.json"))
{
throw new FileNotFoundException("Missing configuration file");
}
});
}What Next?
- Writing Commands -- Create custom CLI commands
- Environment Checks -- Validate your runtime environment
- Configuration -- Configure JasperFx options
