# Repositories

## Main

Along with Mandarine's built-in ORM framework, Mandarine offers you the ability to work with Repositories. As mentioned [here](https://mandarineframework.gitbook.io/mandarine-ts/mandarine-data/orm#concepts), repositories serve as a bridge between your database & your code, they execute tasks such as bringing information from the database to your code, deleting & saving, and more. In a nutshell, repositories allow you to execute queries *programmatically*, this means, you do not have to *necessarily* write the SQL query.

## Declaring a repository

Repositories are declared by using the decorator `@Repository()` . The `@Repository` decorator targets an **abstract class.**

The *abstract class* that will represent your repository must be extended [**MandarineRepository** ](https://doc.deno.land/https/raw.githubusercontent.com/mandarineorg/mandarinets/master/orm-core/repository/mandarineRepository.ts#MandarineRepository). *MandarineRepository* is a generic class that will take **T** as your model's instance.

Syntax

```
@Repository()
```

Example

```typescript
import { Repository, MandarineRepository, CustomQuery } from "https://deno.land/x/mandarinets/mod.ts";

@Repository()
abstract class MyRepository extends MandarineRepository<MyModel> {

    constructor() {
        super(MyModel);
    }
    
}
```

**Note** that all repositories must have a *constructor* with a *super* call. This super call will take your model's instance as shown above.

```typescript
constructor() {
     super(MyModel);
} 
```


---

# 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-data/orm/repositories.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.
