The SKDB Book¶
You are reading the SKDB Book, your guide to all things SKDB! This book is in its early stages: we welcome all and any feedback on it!
SKDB is an embedded SQL database that keeps data synchronized across multiple machines, and that has built-in privacy. SKDB makes programming such applications easier and makes the end-user experience better!
Key features include:
Privacy: Fine-grained privacy controls are built in. Control who should see what data and who can modify it.
Reactivity: Build your app by simply querying and modifying local data. The latest state is always reflected in your UI, automatically.
Incremental Engine: Query results are updated as the data changes without re-running the query. Powered by a new purpose-built engine.
Offline Apps: Working with local data naturally makes your app work offline. SKDB reconnects are fast, transmitting only what has changed. Conflict resolution is supported.
Plain SQL: SKDB works with the SQL you know. There's nothing extra to learn or do.
Open source: SKDB is MIT licensed.
Consider a chat system which has globally accessible chat rooms and private chats, with users accessing the chat through a variety of browsers and mobile apps. The simplest solution is to house all chat data on a central server, but this causes a poor user experience as data is continually read and written over often slow or unreliable network connections. To solve this problem, one can cache data locally. However, this makes each app more complex, as it must have different code for global and local data access, and different devices can now have a slightly different view of chat data — coordinating concurrent updates and reconciling conflicts is fiendishly difficult and an almost endless source of user-visible bugs. Accurately restricting user's access to data adds a further layer of unwanted complexity.
SKDB provides a novel solution to these challenges, and does so in a way that imposes almost no extra burden on the programmer. Clients connect their devices to the SKDB server and mirror the chat tables on their local device: all subsequent interactions are done through normal SQL as if accessing a local database. Updates are transparently pushed/pulled to/from the device's mirrored tables in the background. Clients can register code in their normal programming language to be run when updates to a table are received, allowing them to instantly react to changes in the data. SKDB's built-in privacy model gives assurance that users only have access to the data they should.
These features not only make it easier to program the chat system, they make the chat system better to use. For example, mirroring tables simultaneously removes the burden of synchronizing changes from the programmer and makes switching chat rooms instantaneous, as the data is already available locally! Registering reactive handlers allows the chat system to immediately display new messages without polling. SKDB's privacy model guarantees that private chats are wholly restricted to those users involved in the chats.