LoginSignup
78
66

More than 5 years have passed since last update.

React Nativeで使えるデータベースを7種類比較【2018年5月版】

Last updated at Posted at 2018-05-26

React Nativeアプリの開発にあたって、データベースの選択肢を比べてみました。
私自身使ったことがないものばかりなので、気になる点はぜひお気軽にコメントしてください!

Realm

オープンソースのモバイル向けデータベース。RDBとKVSの両方をサポートしているそう。
標準でクライアント間をリアルタイムに同期することができる。
https://realm.io/jp/docs/javascript/latest

Firebase

Googleの提供するモバイルバックエンド。
Firebase Realtime Databaseを使ってローカル・リモート間をリアルタイムに同期できる。

React Native向けのSDKが提供されている
https://github.com/invertase/react-native-firebase

redux-offline

reduxのstateを永続化してデータベースとして用いるためのライブラリ。
redux-persistの機能に加え、ローカルのDBのデータを利用する裏側でリモートのAPIの呼び出し、リトライ、コミット、ロールバックなどが可能。

https://github.com/redux-offline/redux-offline
Introducing Redux Offline: Offline-First Architecture for Progressive Web Applications and React Native

redux-persist

reduxのstateを永続化してデータベースとして用いるためのライブラリ。
リモートとデータを同期する場合、自前でコードを書くかredux-optimistなどのライブラリを併用する必要がある。
https://github.com/rt2zz/redux-persist

AsyncStorage

React Nativeが公式で提供しているデータベース。
https://facebook.github.io/react-native/docs/asyncstorage.html

直接触らずにラッパー経由でアクセスしたほうがラクらしい。redux-persistもラッパーの一つ。
reduxとは無関係なラッパーもいくつかある。
https://github.com/sunnylqm/react-native-storage
https://github.com/jasonmerino/react-native-simple-store

リモートとデータ同期したければ、PouchDBとのアダプターを被せることでCouchDBと同期させる手段もある。

SQLite

React Native向けのSQLite。いくつか実装がある。
https://github.com/andpor/react-native-sqlite-storage
https://github.com/andpor/react-native-sqlite-storage
https://github.com/almost/react-native-sqlite

AsyncStorage同様、PouchDBとのアダプターの実装がある。

MongoDB

ドキュメント指向のNoSQLデータベース。React Nativeアプリのローカル上で利用可能。
https://github.com/antoniopresto/react-native-local-mongodb

その他

  • CoreData: iOS限定になってしまうため今回は除外しました。
  • Couchbase: 情報が少なかったので除外しました...すみません!

参考

How to select the right React Native database
Which Database should you choose for Your React Native Application?
https://github.com/jondot/awesome-react-native

78
66
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
78
66