You can use TypeORM in connection with the cordova-sqlite-storage plugin in your Ionic app.
This project demonstrates how that would work.
- Install the ionic and cordova cli:
npm install -g cordova ionic - Install all dependencies:
npm install - Add a platform:
ionic cordova platform add <ios | android> - Run the app:
ionic cordova run <ios | android>. If you need help, you can read ionic's guide for running an app on your device
- Install the plugin:
ionic cordova plugin add cordova-sqlite-storage --save - Install TypeORM:
npm install typeorm --save - Install node.js-Types:
npm install @types/node --save-dev - Add
"typeRoots": ["node_modules/@types"]to yourtsconfig.jsonundercompilerOptions
Since Ionic make a lot of optimizations when building for productions, the following limitations occur
- Entities have to be marked with the table name (eg
@Entity('table_name')) - Date fields aren't supported
@Column()
birthdate: Date;