Core Components
The AdonisJS architecture consists of several key components that work together:Ignitor
The entry point for bootstrapping your application in different environments
Application
Manages the application lifecycle from initialization to termination
Container
IoC container for dependency injection and service management
Service Providers
Modular units for registering and bootstrapping services
Architecture Flow
The following diagram illustrates how these components interact during application startup:Application Environments
AdonisJS applications can run in different environments, each optimized for specific use cases:Web Environment
Web Environment
Used for HTTP server processes. This is the most common environment for production applications.
Console Environment
Console Environment
Used for CLI commands and Ace operations. Provides access to the application without starting the HTTP server.
Test Environment
Test Environment
Optimized for running tests with utilities for creating test contexts and factories.
REPL Environment
REPL Environment
Interactive shell environment for exploring your application at runtime.
Dependency Injection
AdonisJS uses constructor-based dependency injection powered by the IoC container:The
@inject() decorator enables automatic dependency resolution from the container. The container will instantiate UserService and inject it into the controller.Service Registration
Services are registered with the container through service providers. There are three types of bindings:Configuration System
AdonisJS uses a type-safe configuration system with support for lazy loading:Next Steps
Ignitor
Learn how the Ignitor bootstraps your application
Application Lifecycle
Understand the application states and lifecycle hooks
Container
Deep dive into the IoC container and dependency injection
Service Providers
Create custom service providers for your modules