# 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);
} 
```

