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:
- Guided ConfigurationEach method guides you through the setup process with clear, type-safe APIs.
- Compile-time SafetyAll configurations are validated at compile time, catching errors before they reach production.
- ExplicitnessEvery configuration is explicit and intentional, making your application's behavior predictable.
- ModularityEach adapter and service can be configured independently, allowing for flexible architectures.
- TestabilityThe 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.
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:
- Context - Learn how to work with application context
- Controllers & Actions - Create your API endpoints
- Procedures - Build reusable middleware and logic