SlideShare a Scribd company logo
Electron, Databases,
and RxDB
An overview of Electron data storage options,
and a new observable object store.
@bengotow
I want to build Evernote with Electron.

How should I store user’s data?
“Notes”
Recent Notes
Full-text Search Edit Note
• One user, their persistent filesystem
• For small datasets (<1,000 items), loading /
saving JSON and filtering it in memory is fine.
Do I need a database?
• Chrome has great key-value storage options,
and we can manually maintain indexes.
Do I need a relational
database?
KEY VALUE
A {“name”:”My first document..
B {“name”:”Another note…
C {“name”: “Favorite note…
RECENT_IDS [“B”, “C”]
LocalStorage
• Synchronous
• Strings only
• Retrieve keys
• <10MB (#8337)
Key Value Storage
IndexedDB
• Sync or async
• Strings, JSON
• Retrieve keys, ranges
• Indexed scan for key
• < 1/3 free disk space
Or use the Filesystem!
• But… I need full-text search
• But… I want to query and sort by arbitrary fields
• But… I want to support millions of notes
• But… I may need more than 1/3 of the available
disk space. (IndexedDB limit)
🤔
• De-facto standard for relational storage in client-
side applications (macOS, iOS, Android, etc.)
• Builds everywhere, no dependencies
• Simple, fast, reliable
• Open source, great documentation
SQLite + ORM
SQLite + ORM
But… for Electron?
• Most JavaScript database wrappers were built
for server-side NodeJS.
• Heavy focus on querying, connection pools,
etc., limited APIs for connecting models to
views.
• CoreData (iOS): NSFetchedResultsController
• YapDatabase (iOS): YapDatabaseView
• AndroidSQLite (Android): View “Cursors”
“Give me the notes matching this query, and let
me know if the results change.”
Electron-RxDB
• Observable object store built on SQLite:
CoreData for Electron
• Built to power the Nylas N1 mail client,
tuned for performance
Define a Note
Save a Note
Query for Notes
Create a Notes view
Create a Notes view
• Database is an EventEmitter, broadcasts events
when transactions are committed.
• Queries return RxJS Observables that emit new
result sets as transactions are committed.



• Optimizations prevent RxDB from re-running SQL
queries in common cases
SQLite 💖 RxJS
Nylas N1
• RxDB provides live “slices” of 1GB+ of mail data
• Views bind to Flux / Redux stores for application
state, RxDB queries for data.
• Many features (mail rules, notifications, etc.)
implemented with database listeners.
Built for Electron
• Multi-window support
• Always builds SQLite for Electron
• Example Electron app: “Notes”
Thanks!
bengotow/electron-RxDB
@bengotow

More Related Content

PPTX
PPTX
Presence of Pesticides in Fruits and vegetables
DOCX
Wheatstone Bridge
PPT
Acids and bases ppt notes
PDF
Manual de practicas de soldadura
ODP
PDF
Vue.js 0.12 to 2.0.0 gotanda.js #5
PDF
Rethink Async With RXJS
Presence of Pesticides in Fruits and vegetables
Wheatstone Bridge
Acids and bases ppt notes
Manual de practicas de soldadura
Vue.js 0.12 to 2.0.0 gotanda.js #5
Rethink Async With RXJS

Viewers also liked (20)

PDF
Get that Corner Office with Angular 2 and Electron
PDF
Importance of creating strategy for your organization
PPTX
大学図書館の役割を考える  ~地域貢献・図書館連携~
PPTX
Regional Anesthesia in the Prevention of Persistent Postsurgical Pain
PDF
でんでんコンバーターによるEPUB制作
PPTX
Grafeno,una revolución a la energía sustentable.
PPT
Literature for ALL LW2017 Nottingham-March 2017
PPTX
RAD Studioで始めるマルチデバイス・クロスプラットフォーム開発ワークショップ
PDF
The art of decomposing monoliths
PPTX
MySQLの運用でありがちなこと
PPTX
Influence is All About Trust
PDF
Equipos de Alto Desempeño
PDF
Vietnam_ The most Important Clause in Any Commercial Contract in Vietnam - Ge...
PPTX
La neurociencia y educación
PDF
Brand Positioning Development Workshop
PDF
How I Learnt to Stop Worrying and Love my Agile Team
PPTX
helicopter maintenance services worldwide
PDF
Función pública en los gobiernos locales
PPTX
Developing high content image analysis software for biologists
PPTX
Link Building Strategies That Increase Monthly Revenue by $240,740 #EngagePDX
Get that Corner Office with Angular 2 and Electron
Importance of creating strategy for your organization
大学図書館の役割を考える  ~地域貢献・図書館連携~
Regional Anesthesia in the Prevention of Persistent Postsurgical Pain
でんでんコンバーターによるEPUB制作
Grafeno,una revolución a la energía sustentable.
Literature for ALL LW2017 Nottingham-March 2017
RAD Studioで始めるマルチデバイス・クロスプラットフォーム開発ワークショップ
The art of decomposing monoliths
MySQLの運用でありがちなこと
Influence is All About Trust
Equipos de Alto Desempeño
Vietnam_ The most Important Clause in Any Commercial Contract in Vietnam - Ge...
La neurociencia y educación
Brand Positioning Development Workshop
How I Learnt to Stop Worrying and Love my Agile Team
helicopter maintenance services worldwide
Función pública en los gobiernos locales
Developing high content image analysis software for biologists
Link Building Strategies That Increase Monthly Revenue by $240,740 #EngagePDX
Ad

Similar to Electron, databases, and RxDB (20)

PPTX
Exploring MongoDB & Elasticsearch: Better Together
PPTX
Meetup#2: Building responsive Symbology & Suggest WebService
PPTX
Azure DocumentDB
PPTX
NoSql Data Management
PDF
Introduction to SharePoint for SQLserver DBAs
PPTX
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
PPTX
Spring Data - Intro (Odessa Java TechTalks)
PDF
WebObjects Optimization
PPTX
A Presentation on MongoDB Introduction - Habilelabs
PPTX
Why databases cry at night
PDF
ElasticSearch: Distributed Multitenant NoSQL Datastore and Search Engine
PPTX
Inside sql server in memory oltp sql sat nyc 2017
PPTX
PASS_Summit_2019_Azure_Storage_Options_for_Analytics
PDF
No sq lv1_0
PPTX
C* Summit 2013: Cassandra at eBay Scale by Feng Qu and Anurag Jambhekar
PPT
JavaOne_2010
PDF
Asp.Net 3.5 Part 2
PPTX
Clustrix Database Percona Ruby on Rails benchmark
PDF
The Data Mullet: From all SQL to No SQL back to Some SQL
PDF
CosmosDB for DBAs & Developers
Exploring MongoDB & Elasticsearch: Better Together
Meetup#2: Building responsive Symbology & Suggest WebService
Azure DocumentDB
NoSql Data Management
Introduction to SharePoint for SQLserver DBAs
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
Spring Data - Intro (Odessa Java TechTalks)
WebObjects Optimization
A Presentation on MongoDB Introduction - Habilelabs
Why databases cry at night
ElasticSearch: Distributed Multitenant NoSQL Datastore and Search Engine
Inside sql server in memory oltp sql sat nyc 2017
PASS_Summit_2019_Azure_Storage_Options_for_Analytics
No sq lv1_0
C* Summit 2013: Cassandra at eBay Scale by Feng Qu and Anurag Jambhekar
JavaOne_2010
Asp.Net 3.5 Part 2
Clustrix Database Percona Ruby on Rails benchmark
The Data Mullet: From all SQL to No SQL back to Some SQL
CosmosDB for DBAs & Developers
Ad

Recently uploaded (20)

PDF
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
PDF
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
Fundamentals of safety and accident prevention -final (1).pptx
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
PPTX
Safety Seminar civil to be ensured for safe working.
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
Artificial Intelligence
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PPTX
Current and future trends in Computer Vision.pptx
PPTX
Construction Project Organization Group 2.pptx
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Embodied AI: Ushering in the Next Era of Intelligent Systems
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
UNIT-1 - COAL BASED THERMAL POWER PLANTS
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Fundamentals of safety and accident prevention -final (1).pptx
R24 SURVEYING LAB MANUAL for civil enggi
Foundation to blockchain - A guide to Blockchain Tech
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
Safety Seminar civil to be ensured for safe working.
CYBER-CRIMES AND SECURITY A guide to understanding
Artificial Intelligence
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
Current and future trends in Computer Vision.pptx
Construction Project Organization Group 2.pptx

Electron, databases, and RxDB

  • 1. Electron, Databases, and RxDB An overview of Electron data storage options, and a new observable object store. @bengotow
  • 2. I want to build Evernote with Electron.
 How should I store user’s data?
  • 4. • One user, their persistent filesystem • For small datasets (<1,000 items), loading / saving JSON and filtering it in memory is fine. Do I need a database?
  • 5. • Chrome has great key-value storage options, and we can manually maintain indexes. Do I need a relational database? KEY VALUE A {“name”:”My first document.. B {“name”:”Another note… C {“name”: “Favorite note… RECENT_IDS [“B”, “C”]
  • 6. LocalStorage • Synchronous • Strings only • Retrieve keys • <10MB (#8337) Key Value Storage IndexedDB • Sync or async • Strings, JSON • Retrieve keys, ranges • Indexed scan for key • < 1/3 free disk space Or use the Filesystem!
  • 7. • But… I need full-text search • But… I want to query and sort by arbitrary fields • But… I want to support millions of notes • But… I may need more than 1/3 of the available disk space. (IndexedDB limit) 🤔
  • 8. • De-facto standard for relational storage in client- side applications (macOS, iOS, Android, etc.) • Builds everywhere, no dependencies • Simple, fast, reliable • Open source, great documentation
  • 11. But… for Electron? • Most JavaScript database wrappers were built for server-side NodeJS. • Heavy focus on querying, connection pools, etc., limited APIs for connecting models to views.
  • 12. • CoreData (iOS): NSFetchedResultsController • YapDatabase (iOS): YapDatabaseView • AndroidSQLite (Android): View “Cursors” “Give me the notes matching this query, and let me know if the results change.”
  • 13. Electron-RxDB • Observable object store built on SQLite: CoreData for Electron • Built to power the Nylas N1 mail client, tuned for performance
  • 15. Save a Note Query for Notes
  • 18. • Database is an EventEmitter, broadcasts events when transactions are committed. • Queries return RxJS Observables that emit new result sets as transactions are committed.
 
 • Optimizations prevent RxDB from re-running SQL queries in common cases SQLite 💖 RxJS
  • 19. Nylas N1 • RxDB provides live “slices” of 1GB+ of mail data • Views bind to Flux / Redux stores for application state, RxDB queries for data. • Many features (mail rules, notifications, etc.) implemented with database listeners.
  • 20. Built for Electron • Multi-window support • Always builds SQLite for Electron • Example Electron app: “Notes”