> For the complete documentation index, see [llms.txt](https://mandarineframework.gitbook.io/mandarine-ts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mandarineframework.gitbook.io/mandarine-ts/mandarine-core/components.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
