Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nolanlawson/hello-electron-with-pouchdb
Electron "hello world" with PouchDB
https://github.com/nolanlawson/hello-electron-with-pouchdb
Last synced: 13 days ago
JSON representation
Electron "hello world" with PouchDB
- Host: GitHub
- URL: https://github.com/nolanlawson/hello-electron-with-pouchdb
- Owner: nolanlawson
- Fork: true (dougnukem/hello-atom)
- Created: 2014-09-06T16:00:49.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2019-03-19T20:48:57.000Z (over 5 years ago)
- Last Synced: 2024-08-02T11:24:37.115Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 489 KB
- Stars: 104
- Watchers: 7
- Forks: 23
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Hello Electron with Pouchdb
This is a demo app that integrates PouchDB with Electron.
It shows how to use any of the following PouchDB adapters:
* IndexedDB (browser-style)
* WebSQL (browser-style)
* LevelDB (Node-style)
* SQLite (Node-style)The app looks like this:
![screenshot](screenshot2.png)
## Install and run
Check out the code:
git clone https://github.com/nolanlawson/hello-electron-with-pouchdb
cd hello-electron-with-pouchdbThen npm install:
npm install
And run:
npm start
If it doesn't work, you might not have the latest version of Node/npm. Try installing the latest using [nvm](https://github.com/creationix/nvm).
## Browser vs Node
In order to get LevelDB to work propertly, we use [electron-rebuild](https://github.com/electron/electron-rebuild) to rebuild LevelDB for Electron.
If this step doesn't work for you (e.g. because you are using an older version of Node, you're using Windows, etc.), you can remove the `postinstall` script from `package.json`, replace the `pouchdb` dependency with `pouchdb-browser`, and just use the browser adapters (IndexedDB/WebSQL) rather than the Node.js adapter (LevelDB).
See [pouchdb-electron](https://github.com/nolanlawson/pouchdb-electron) for more installation instructions.
## node-websql (sqlite3) adpater
If you want to run PouchDB in "Node.js style" but using SQLite, then you should use `pouchdb-adapter-node-websql`, as demonstrated in this project.
Like LevelDB, this requires reinstalling a native module (in this case, [SQLite3](https://github.com/mapbox/node-sqlite3)). If this fails, you can just remove the `pouchdb-adapter-node-websql` dependency from `package.json` and also the `postinstall` script.