# jeffijoe/awilix

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/jeffijoe-awilix).**

4,088 stars · 144 forks · TypeScript · mit

## Links

- GitHub: https://github.com/jeffijoe/awilix
- awesome-repositories: https://awesome-repositories.com/repository/jeffijoe-awilix.md

## Topics

`awilix` `dependency-injection` `ioc` `javascript` `lifetime-management` `nodejs`

## Description

Awilix is a JavaScript dependency injection framework and inversion of control container. It provides a centralized system for registering and resolving services, decoupling application components by automating how dependencies are created and passed to the functions or classes that require them.

The framework features an automatic module loader that scans the filesystem using glob patterns to register dependencies based on filenames and exports. It supports parameter-name-based injection and proxy-based resolution to manage how dependencies are delivered to constructors and functions.

The system manages object lifecycles through singleton and transient patterns, including hierarchical container scoping for request-specific state. It includes capabilities for resource disposal, dependency lifetime validation, and registration verification to ensure resolution correctness.

## Tags

### Software Engineering & Architecture

- [Dependency Injection Containers](https://awesome-repositories.com/f/software-engineering-architecture/dependency-injection-containers.md) — Provides a centralized inversion of control container to decouple components and automate service resolution. ([source](https://github.com/jeffijoe/awilix/blob/master/package.json))
- [Dependency Injection](https://awesome-repositories.com/f/software-engineering-architecture/integration-extensibility/dependency-injection.md) — Decouples application components by automating how services are created and passed to the classes or functions that need them.
- [Automatic Dependency Discovery](https://awesome-repositories.com/f/software-engineering-architecture/automatic-dependency-discovery.md) — Implements an automatic module loader that scans the filesystem using glob patterns to register dependencies based on filenames and exports. ([source](https://github.com/jeffijoe/awilix/blob/master/README.md))
- [Constructor Injection](https://awesome-repositories.com/f/software-engineering-architecture/constructor-injection.md) — Injects required dependencies into constructors and functions using parameter parsing or proxy objects. ([source](https://github.com/jeffijoe/awilix#readme))
- [Dependency Injection](https://awesome-repositories.com/f/software-engineering-architecture/dependency-injection.md) — Maps identifiers to values, functions, or classes to be managed and injected across the application. ([source](https://github.com/jeffijoe/awilix/blob/master/CHANGELOG.md))
- [Dependency Injection Frameworks](https://awesome-repositories.com/f/software-engineering-architecture/dependency-injection-frameworks.md) — Implements a framework for decoupling components by registering and resolving services through a central registry.
- [Dependency Resolution](https://awesome-repositories.com/f/software-engineering-architecture/dependency-resolution.md) — Retrieves registered dependencies by name while utilizing type inference to ensure correct object shapes. ([source](https://github.com/jeffijoe/awilix/blob/master/CHANGELOG.md))
- [Automatic Dependency Loaders](https://awesome-repositories.com/f/software-engineering-architecture/dynamic-module-loaders/automatic-dependency-loaders.md) — Ships a utility that scans the filesystem using glob patterns to automatically register classes and functions.
- [Filesystem Scanning](https://awesome-repositories.com/f/software-engineering-architecture/integration-extensibility/extensibility/plugin-architectures/developer-authoring-interfaces/custom-module-implementations/module-functionality-extenders/module-based-extensions/namespace-based-module-auto-discovery/filesystem-scanning.md) — Provides an automatic module loader that scans the filesystem using glob patterns to register dependencies.
- [Inversion-of-Control Containers](https://awesome-repositories.com/f/software-engineering-architecture/inversion-of-control-containers.md) — Manages object lifecycles and dependencies via constructor injection and hierarchical scoped containers.
- [Object Lifetime Management](https://awesome-repositories.com/f/software-engineering-architecture/object-lifetime-management.md) — Controls whether objects are recreated on every request, cached within a scope, or maintained as a singleton. ([source](https://github.com/jeffijoe/awilix#readme))
- [Parameter-Name Injection](https://awesome-repositories.com/f/software-engineering-architecture/parameter-name-injection.md) — Resolves dependencies by parsing constructor or function parameter names and matching them to registered keys.
- [Automatic Dependency Registrations](https://awesome-repositories.com/f/software-engineering-architecture/service-instance-managers/automatic-service-registrations/automatic-dependency-registrations.md) — Automates the discovery and registration of services within the dependency injection container via filesystem scanning.
- [Service Lifetime Scopes](https://awesome-repositories.com/f/software-engineering-architecture/state-management-architectures/singleton-service-stores/service-lifetime-scopes.md) — Manages object instantiation cycles through singleton, scoped, and transient lifetimes.
- [Scoped State Containers](https://awesome-repositories.com/f/software-engineering-architecture/state-management/scoped-state-containers.md) — Supports hierarchical container scoping to maintain private instance caches for request-specific state.
- [Proxy-Based Resolution](https://awesome-repositories.com/f/software-engineering-architecture/proxy-based-resolution.md) — Provides a proxy object to modules that dynamically resolves requested dependencies on demand.
- [Recursive Dependency Resolution](https://awesome-repositories.com/f/software-engineering-architecture/recursive-dependency-resolution.md) — Implements recursive resolution to construct complex dependency graphs for service instantiation.
- [Resource Lifecycle Managers](https://awesome-repositories.com/f/software-engineering-architecture/rpc-cancellation/asynchronous-operation-cancellation/context-aware-cancellation/resource-lifecycle-managers.md) — Tracks instantiated dependencies and executes cleanup functions when a scope is destroyed.

### Data & Databases

- [Dependency Lifecycle Management](https://awesome-repositories.com/f/data-databases/resource-management/resource-lifecycle-managers/dependency-lifecycle-management.md) — Manages whether services are created as singletons or recreated on every request. ([source](https://github.com/jeffijoe/awilix/blob/master/CHANGELOG.md))
- [Dependency Resource Disposal](https://awesome-repositories.com/f/data-databases/resource-management/resource-lifecycle-managers/dependency-resource-disposal.md) — Provides mechanisms to execute registered cleanup functions and clear resolver caches to close connection pools and other system resources. ([source](https://github.com/jeffijoe/awilix#readme))

### DevOps & Infrastructure

- [Dependency Scoping](https://awesome-repositories.com/f/devops-infrastructure/dependency-management/environment-scoping-controls/dependency-scoping.md) — Generates child containers with private caches to allow for request-specific state scoping. ([source](https://github.com/jeffijoe/awilix#readme))

### Development Tools & Productivity

- [Lifetime Consistency Validation](https://awesome-repositories.com/f/development-tools-productivity/dependency-configuration-tools/dependency-consistency-validators/lifetime-consistency-validation.md) — Validates that dependencies do not have shorter lifetimes than the modules they are injected into to prevent stale data. ([source](https://github.com/jeffijoe/awilix#readme))
- [Modular Architecture](https://awesome-repositories.com/f/development-tools-productivity/modular-architecture.md) — Organizes large codebases by separating service definitions from their instantiation and wiring logic.

### Programming Languages & Runtimes

- [Resolution Integrity Enforcement](https://awesome-repositories.com/f/programming-languages-runtimes/dependency-resolution-engines/resolution-integrity-enforcement.md) — Throws runtime errors when dependencies have shorter lifetimes than their ancestors or when singletons are registered in child scopes. ([source](https://github.com/jeffijoe/awilix/blob/master/README.md))
