> ## Documentation Index
> Fetch the complete documentation index at: https://brushysuite.gfrancodev.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Documentation

> Concepts, installation, and API index for @brushy/di.

`@brushy/di` is a powerful and flexible dependency injection system for JavaScript/TypeScript applications, with special support for React.

## On this page

* [Introduction](#introduction)
* [Installation](#installation)
* [Getting Started](/di/getting-started)
* [Basic Concepts](#basic-concepts)
* [API Reference](#api-reference)
  * [Container](#container)
  * [React Hooks](#react-hooks)
  * [Component Injection](#component-injection)
  * [Utility Functions](#utility-functions)
  * [Server Utilities](#server-utilities)
* [Advanced Guides](#advanced-guides)
  * [Best Practices](#best-practices)
* [Examples](#examples)

## Introduction

`@brushy/di` is designed to facilitate dependency management in modern applications, enabling:

* Strongly typed dependency injection
* Instance lifecycle management (singleton, transient, scoped, immutable)
* React component support
* Asynchronous dependency resolution
* Monitoring and observability
* Smart promise caching

## Installation

```bash theme={null}
npm install @brushy/di
```

Stack-specific installs and setup recipes: **[Getting Started](/di/getting-started)**.

## Basic Concepts

The DI (Dependency Injection) system is based on some fundamental concepts:

* **Container**: Stores and manages dependencies
* **Token**: Unique identifier for each dependency
* **Provider**: Configuration that defines how a dependency should be created
* **Lifecycle**: Defines the lifecycle of an instance:
  * **singleton**: A single instance is created and reused across the application
  * **transient**: A new instance is created each time the dependency is resolved
  * **scoped**: An instance is created per scope, typically per HTTP request
  * **immutable**: A single instance is created and never invalidated or garbage collected

## API Reference

### [Container](/di/container)

The Container is the central component of the dependency injection system. It is responsible for registering, resolving, and managing the lifecycle of dependencies.

### [React Hooks](/di/react-hooks)

React hooks to facilitate dependency injection in functional components, including `useInject` and `useInjectLazy`.

### [Component Injection](/di/component-injection)

Specific functionalities for React component injection, enabling the creation of modular and extensible UI systems.

### [Utility Functions](/di/utilities)

Utility functions to facilitate the use of the dependency injection system in different contexts.

### [Server Utilities](/di/server)

Specific utilities for managing dependency injection on the server side, especially useful in Node.js applications and frameworks like Next.js, Express, NestJS, etc.

## Advanced Guides

### [Best Practices](/di/best-practices)

Best practices guide for using `@brushy/di` efficiently and in an organized way.

## Examples

Check out the complete examples in each section of the documentation to see how to use `@brushy/di` in different scenarios.
Consult the specific guides for more details about each concept.
