The Igniter Builder: Your Application's Foundation

Every Igniter.js application begins with the Igniter Builder. It is a fluent, chainable API designed to guide you through the process of composing and configuring your application's core components in a structured and fully type-safe manner.

Think of the builder as the master blueprint for your entire backend. It's where you define the application's context, integrate services like logging and caching, enable advanced features like background jobs, and extend functionality with plugins.

Philosophy

The Igniter Builder is designed around five core principles:

  1. Guided Configuration
    Each method guides you through the setup process with clear, type-safe APIs.
  2. Compile-time Safety
    All configurations are validated at compile time, catching errors before they reach production.
  3. Explicitness
    Every configuration is explicit and intentional, making your application's behavior predictable.
  4. Modularity
    Each adapter and service can be configured independently, allowing for flexible architectures.
  5. Testability
    The builder pattern makes it easy to create different configurations for testing, development, and production.

How It Works

The Igniter Builder uses a fluent interface pattern where each method returns a new builder instance with updated type information. This ensures that TypeScript can provide accurate autocompletion and type checking throughout your configuration process.

Code
const igniter = Igniter
  .context<AppContext>()
  .middleware([authMiddleware, loggingMiddleware])
  .store(redisAdapter)
  .logger(consoleLogger)
  .telemetry(openTelemetryProvider)
  .create();

Configuration Methods

What's Next?

Now that you have your Igniter instance configured, you can start building your application: