# Supported platforms

* [NodeJS](#nodejs)
* [Browser](#browser)
* [Cordova / PhoneGap / Ionic apps](#cordova--phonegap--ionic-apps)
* [NativeScript](#nativescript)

## NodeJS

TypeORM was tested on Node.js version 4 and above. 

## Browser

You can use [sql.js](https://github.com/kripken/sql.js) in the browser.

**Webpack configuration**
    
In the `browser` folder the package also includes a version compiled as a ES2015 module. If you want to use a different loader this is the point to start. Prior to TypeORM 0.1.7, the package is setup in a way that loaders like webpack will automatically use the `browser` folder. With 0.1.7 this was dropped to support Webpack usage in Node.js projects. This means, that the `NormalModuleReplacementPlugin` has to be used to insure that the correct version is loaded for browser projects. The configuration in your webpack config file, for this plugin looks like this:

```js
plugins: [
    ..., // any existing plugins that you already have
    new webpack.NormalModuleReplacementPlugin(/typeorm$/, function (result) {
        result.request = result.request.replace(/typeorm/, "typeorm/browser");
    }),
    new webpack.ProvidePlugin({
      'window.SQL': 'sql.js/js/sql.js'
    })
]
```

**Example of configuration**

```typescript
createConnection({
    type: "sqljs",
    entities: [
        Photo
    ],
    synchronize: true
});
```

**Don't forget to include reflect-metadata**
    
In your main html page, you need to include refllect-metadata:

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

## Cordova / PhoneGap / Ionic apps

TypeORM is able to run on Cordova, PhoneGap, Ionic apps using the
[cordova-sqlite-storage](https://github.com/litehelpers/Cordova-sqlite-storage) plugin
You have the option to choose between module loaders just like in browser package. 
For an example how to use TypeORM in Cordova see [typeorm/cordova-example](https://github.com/typeorm/cordova-example) and for Ionic see [typeorm/ionic-example](https://github.com/typeorm/ionic-example). **Important**: For use with Ionic, a custom webpack config file is needed! Please checkout the example to see the needed changes.

## React Native
TypeORM is able to on React Native apps using the [react-native-sqlite-storage](https://github.com/andpor/react-native-sqlite-storage) plugin. For an example see [typeom/react-native-example](https://github.com/typeorm/react-native-example).

## NativeScript

In the next releases we are planning to support NativeScript platform as well.

Please feel free to join a community and help us with new features and supporting a new platform!
