1 unstable release

0.1.0 Dec 28, 2021

#12 in #local-first


Used in tlfs-api

MIT license

255KB
6.5K SLoC

The Local-First SDK

License dependency status

PRs welcome commits contributors

Philosophy

There is no cloud, it's just someone else's computer.

The Local-First SDK offers a stack to write applications as productively as when using state-of-the-art cloud-based architectures, while providing the Seven Ideals for Local-First Software 0 -- basically for free:

  • Software can respond near-instantaneously to user input. (No waiting on server round-trips, no spinners.)
  • Cross-device synchronization. (Pick up work on your mobile device just where you left off with your laptop.)
  • "Offline-First" as a subset of Local-First. (Connectivity is irrelevant when interacting with the application>0
  • Seamless collaboration with other peers. (Edit and sync shared data without fear of conflicts.)
  • Full data agency. (Do what you want with your data, it's yours only.)
  • Secure and private data management. (Everything is encrypted, only you have the keys.)
  • Full ownership and control over the application's data. (No one can take away a service from you.)

Components

The Local-First SDK comprises the following components:

  1. User and Access Control: ... (key management, acl)
  2. Multi-Device Support and Collaboration: ... (device auth, p2p, peer discovery (mdns and via cloud peer))
  3. Data Persistence ... (cloud peer or self-hosted)
  4. Multi device support and interoperability ... (browser, native, android/ios?)

Artifacts

The Local-First SDK comes in three flavours:

  1. An opinionated Javascript package (with Typescript bindings) to write Local-First applications targeting the browser.
  2. A library which can be embedded into other applications, either as a rust library or a C-compatible FFI.
  3. A native, permanent process shepherding the user's data. Applications can interface with this daemon via HTTP.

The Local-First Javascript SDK

As the browser's API guarantees are weak, its environment has to be considered ephemeral[^1]. This is why the optional Cloud-Peer supplemental services complement the browser environment very well (data persistence, peer discovery).

As of now, the SDK is just offered as an ES module, requiring asynchronous import:

import * as localFirst from 'local-first';

await localFirst.init();

[..]

[^1]: Most notably this is about persistence of user data (key material and application data). However, it's easy to lose one's browsing data by switching to another browser profile/container, etc.


Under the hood

Rust, libp2p, crdts, cambria, .. --> INSERT AWESOMENESS HERE <--


License

Licensed under either of

at your option.

Contributing

Be respectful. Check out our Contribution Guidelines for specifics. Any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~20–36MB
~610K SLoC