An enterprise-grade ORM for Node.js written in typescript. Works with MySQL, PostgreSQL, SQLite and more.
TypeScript JavaScript
Latest commit 07c1da8 Feb 20, 2017 @RWOverdijk RWOverdijk 1.3.0


Build Status npm version Gitter chat Donate

Wetland is a modern, and enterprise grade object-relational mapper (ORM) for node.js. It allows you to get started quickly, without losing flexibility or features.


Some of the major features provided include:

  • Unit of work
  • Migrations
  • Transactions
  • Entity manager
  • Cascaded persists
  • Deep joins
  • Repositories
  • QueryBuilder
  • Entity mapping
  • Optimized state manager
  • Recipe based hydration
  • More...


To install wetland run the following command:

npm i --save wetland

Typings are provided by default for TypeScript users. No additional typings need installing.


  • All operating systems
  • Node.js 6.0+


  • When using sqlite3, foreign keys are disabled (this is due to alter table not working for foreign keys with sqlite).


The following is a snippet to give you an idea what it's like to work with wetland. For a much more detailed explanation, head to the documention..

const Wetland = require('wetland').Wetland;
const Foo     = require('./entity/foo').Foo;
const Bar     = require('./entity/foo').Bar;
const wetland = new Wetland({
  stores: {
    simple: {
      client    : 'mysql',
      connection: {
        user    : 'root',
        database: 'testdatabase'
  entities: [Foo, Bar]

// Create the tables. Async process, only here as example.
// use .getSQL() (not async) in stead of apply (async) to get the queries.
let migrator = wetland.getMigrator().create();
migrator.apply().then(() => {});

// Get a manager scope. Call this method for every context (e.g. requests).
let manager = wetland.getManager();

// Get the repository for Foo
let repository = manager.getRepository(Foo);

// Get some results, and join.
repository.find({name: 'cake'}, {joins: ['candles', 'baker', 'baker.address']})
  .then(results => {
    // ...