Spellbook Browser extension
These are my latest notes about how to implement a bookmark manager browser extension. Maybe there is some interesting information for somebody thinking of implementing something similar.
The screenshots are from actual simple extension that I have developed in the past four days using a previous unfinished prototype.
It shows a list of filtered bookmark categories when you start to type in a category name, but there is still some usability problems.
This is implemented using Vue.js without Redux or Vuex, and uses Semantic UI as a CSS framework. I use RxJS version 6, even though it is a huge library even when trying to slim the build down using webpack.
I switched to Semantic UI from Element UI because the latter wrote styles with Javascript and used negative margins, and I see both as huge warning signs for not using that CSS framework!
The extension will be a quite simple one for now – it will not use a graph database or have syncing features.
I just want to have and use something better than the current Material UI bookmark manager that came with Google Chrome version 69, because UI wise it is not good for handling the 15.000 bookmarks and over thousand categories of bookmarks that I have.
Implementation plan for the bookmark manager
3.7.2018
In order to get something releasable done, this is the plan:
Use Redux and implement browser extension using some JS tech – if this can be used, then the bookmarks can be easily stored in IndexedDB.
JS tech
Implement a browser extension using:
Vue.js (React may make more sense with a reactive library)
Redux (is it really needed?)
Most.js, RxJS v6, Kefir, Highland.js or Bacon.js? (see perf comparison by Most)
maybe Ocaml/Reason, ClojureScript or at least ES6+?
Utility libraries:
Ramda
Nanoid
So options are:
React, Redux and Most.js with redux-most (See article 2 below)
Vue.js, Redux and Most.js with redux-vue or Vuedeux and redux-most?
Redux-observable, Redux, Vue/React ...
Redux and/or RxJS
Browser extensions operate in a very asynchronous manner, so maybe using RxJS would be a good idea?
Google Search: Redux and RxJS
Async actions in Redux with RxJS and Redux Observable
How to make your React app fully functional, fully reactive, and able to handle all those crazy… React + Redux + React-observable/react-cycles (comparable to redux-most!)
Example code:
https://dev.to/andrejnaumovski/async-actions-in-redux-with-rxjs-and--redux-observable-efg
Article https://ivanjov.com/reactive-redux-state-with-rxjs/ and Github https://github.com/IvanJov/react-rxjs-github-search
Alternative languages and tech
Vue vs React
comment on How and why we moved to Vue.js
Against using RxJS
RxJS: An object lesson in terrible good software | Isotoma: Our blog
On the other hand, see this comment on Why isn't RxJS more popular? Are there bad parts about it that's slowing adoption? : javascript ”One of the big problems with RxJS has actually been addressed in version 5, which is that it's really hard to debug. Version 4 uses a trampoline architecture, which essentially knocks over the call stack, and renders them pretty useless. You're also usually super deep into library code, which is not where you want to be. Version 5 uses a different approach, and is supposed to make the debugging situation much better.”
Why isn't RxJS more popular? Are there bad parts about it that's slowing adoption? : javascript
Unredux
This repo features a number of realistic apps built without (frontend) frameworks. We use a dataflow similar to CycleJS built on Kefir and React.
We weren't happy with clunky imperative architectures Redux, VueJS, MobX, and GraphQL apps end up with, so we decided to codify our own approach. Like CycleJS, it's 100% reactive (declarative in time!). Unlike CycleJS, it doesn't hide side-effects in drivers. See docs for more details about our motivations and design decisions.
Unredux
Unredux post edit example
ClojureScript (and core.sync like async/await in ES6)
Why I moved from RxJS to ClojureScript
Promises and Async/await in ES6+
Even with async/await, raw promises are still key to writing optimal concurrent javascript
Storage
Storage consists of:
Bookmarks
Categories
Category structure
Bookmark categories
Redux
Think and experiment about caching/indexes, read Using the Redux Store Like a Database – Hacker Noon!
Immediately after getting first version working, use large dataset to find out performance problems early!
IndexedDB
Mozilla
Google documentation
Chrome storage sync (asynchronous bulk read and write) has some severe limitations, however an extension can have unlimitedStorage permission for local storage (synchronous). Maybe another way to sync is needed?
IndexedDB with Redux
redux indexeddb - Startpage Web Search
prateekbh/redux-storage-engine-indexed-db: indexedDb engine for redux-storage
react-stack/redux-storage: Persistence layer for redux with flexible backends
Using the Redux Store Like a Database – Hacker Noon
reduxjs/reselect: Selector library for Redux
Normalizer | Redux without Profanity
javascript - How to integrate Redux with very large data-sets and IndexedDB - Stack Overflow
Best Practices for Using IndexedDB | Web Fundamentals | Google Developers
IndexedDB with promises and async/await – Filip Vitas – Medium
Offline-First Web Application Using Redux and PouchDB
Open questions
Validation
Validation on Redux store (and when syncing)?
Caching bookmark categories
into Redux store?
using binary trees?
Data synchronisation
How to synchronise bookmarks between different browsers?
GUN database could be one option, even though it’s graph API is not very developer friendly. But using that would spare me writing a CRDT algorithm.
Conflict free replicated data types (CRDTs)
Practical Demystification of CRDTs - Speaker Deck orbitdb/crdts: A library of Conflict-Free Replicated Data Types for JavaScript
dominictarr/crdt: Commutative Replicated Data Types for easy collaborative/distributed systems.
orbitdb/orbit-db: Peer-to-Peer Databases for the Decentralized Web
pfrazee/crdt_notes
Conflict-free Replicated Data Types
A Conflict-Free Replicated JSON Datatype | Hacker News
1201.1784.pdf
Conflict-free Replicated Data Types
Home - Postman Documentation
PsychoLlama/graph-crdt: Commutative graphs made for real-time, offline-tolerant replication
Automerge: JSON-like data structure for building collaborative apps | Hacker News














