# Components

This page summarizes all the information about mandarine components and how & why they are used in Mandarine-powered applications.

## What are components?

Mandarine has the concept of "components", components help diversify your application in different layers such as&#x20;

1. Configuration Layer
2. Service Layer
3. ORM Layer
4. Others...

Components are used across Mandarine-powered applications mostly for dependency injection (**DI**) but its concept can go beyond, for example, Controllers are a type of component specifically created to handle HTTP requests (this if you are using Mandarine MVC).

### Declaration

Components are declared by using typescript decorators [(Click here to see more)](https://www.typescriptlang.org/docs/handbook/decorators.html). All Component decorators should target a *class.*

### *Injecting objects*

Most components accept the use of *DI*. *DI* can be achieved through class fields or by using constructor parameters.

## *Types of Components*

[See enum here](https://doc.deno.land/https/raw.githubusercontent.com/mandarineorg/mandarinets/master/main-core/Mandarine.ns.ts#Mandarine.MandarineCore.ComponentTypes)

* Controller
* Middleware
* Repository
* Component
* Service
* Configuration
* *Manual Component*


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mandarineframework.gitbook.io/mandarine-ts/mandarine-core/components.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
