TypeORM - data-mapper ORM for TypeScript and JavaScript (ES7, ES6, ES5). Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, WebSQL databases. Works in Node.JS and Browser.

Use TypeORM in the browser

TypeORM has experimental support of WebSQL.


  1. Install module:

    npm install typeorm-browser --save
  2. Install reflect-metadata shim:

    npm install reflect-metadata --save

    and include it in your app:

    <script src="./node_modules/reflect-metadata/Reflect.js"></script>

    in your app's entry point (for example index.html).

How to setup system.js config

TypeORM in browser works with system.js. Here is example how your index.html and systemjs config should look like:

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>using TypeORM in the browser</title>

    <script src="./node_modules/reflect-metadata/Reflect.js"></script>
    <script src="./node_modules/systemjs/dist/system.src.js"></script>

            defaultJSExtensions: true,
            map: {
                "typeorm": "node_modules/typeorm-browser/typeorm-browser.min.js"
            packages: {
                "typeorm": {
                    format: "register"
    <script>System.import("./src/index").catch(function(err){ console.error(err); });</script>


How to configure connection

Here is how you need to configure your connection:

    driver: {
        type: "websql",
        database: "test",
        extra: {
            version: 1,
            description: "test database",
            size: 2 * 1024 * 1024
    entities: [
    autoSchemaSync: true


Take a look on this example to learn more about how TypeORM works in the browser.

Fork me on GitHub