<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/repository-pattern-with-typescript-and-node-js-llwgw87yb" -->

---
title: Repository Pattern with Typescript and Node.js | daily.dev
description: In Node.js you probably interact with the database (MongoDB, Postgres, etc) via ORM. But sometimes typical ORM does not cover our needs. Repository pattern...
canonical: https://daily.dev/posts/repository-pattern-with-typescript-and-node-js-llwgw87yb
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Repository Pattern with Typescript and Node.js | daily.dev
og:description: In Node.js you probably interact with the database (MongoDB, Postgres, etc) via ORM. But sometimes typical ORM does not cover our needs. Repository pattern...
og:url: https://daily.dev/posts/repository-pattern-with-typescript-and-node-js-llwgw87yb
og:image: https://api.daily.dev/og/posts/LlwGW87YB.png
og:image:alt: Repository Pattern with Typescript and Node.js
og:image:width: 1200
og:image:height: 630
og:locale: en
---

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

# Repository Pattern with Typescript and Node.js

**[DEV](https://daily.dev/sources/devto)** · 6 min read · 13 upvotes · 0 comments

## Summary

In Node.js you probably interact with the database (MongoDB, Postgres, etc) via ORM. But sometimes typical ORM does not cover our needs. Repository pattern will give to us this abstract Data Layer to interact with any database. Knex is a cross between ORM and pure SQL queries. It provides excellent migrations API with TypeScript support.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://dev.to/fyapy/repository-pattern-with-typescript-and-nodejs-25da>

---

Tags: [#nodejs](https://daily.dev/tags/nodejs), [#typescript](https://daily.dev/tags/typescript)

[View this post on daily.dev](https://daily.dev/posts/repository-pattern-with-typescript-and-node-js-llwgw87yb)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Repository Pattern with Typescript and Node.js","url":"https://daily.dev/posts/repository-pattern-with-typescript-and-node-js-llwgw87yb","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/repository-pattern-with-typescript-and-node-js-llwgw87yb"},"datePublished":"2021-10-25T16:41:14.247Z","dateModified":"2021-10-25T16:41:14.248Z","description":"In Node.js you probably interact with the database (MongoDB, Postgres, etc) via ORM. But sometimes typical ORM does not cover our needs. Repository pattern...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ae017ecfe0aded27439f50ef86a7f75d","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ae017ecfe0aded27439f50ef86a7f75d","isAccessibleForFree":true,"articleSection":"DEV","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"DEV","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/devto","url":"https://daily.dev/sources/devto"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/repository-pattern-with-typescript-and-node-js-llwgw87yb","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":13},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"nodejs,typescript","timeRequired":"PT6M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"DEV","item":"https://daily.dev/sources/devto"},{"@type":"ListItem","position":3,"name":"Repository Pattern with Typescript and Node.js"}]}
```

