Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Sync-Gateway: Building offline-first and Data-Sensitive apps faster

Sync-Gateway: Building offline-first and Data-Sensitive apps faster

7ecbf760b7129f85ec8c8ba3ddf72b96?s=128

deniswsrosa

June 17, 2020
Tweet

Transcript

  1. SYNC GATEWAY Denis Rosa | Developer Advocate @deniswsrosa HOW TO

    BUILD OFFLINE-FIRST & DATA-SENSITIVE APPLICATIONS FASTER
  2. • +15 years as a Developer • NoSQL & Java

    Specialist • OSS contributor Denis Rosa deniswsrosa @deniswsrosa denis.rosa@couchbase.com
  3. 3 The app should work offline “ ”

  4. 4 “The app should work offline” means: • Equipment List;

    • Floor layout; • Maintenance history; • Maintenance Plan; • Work Order; • User data; • …
  5. 5 • Collaborative Database of Events; • SaaS • Public

    and Private events; • But …
  6. 6 • Collaborative Database of Events; • SaaS • Public

    and Private events; • But … We don’t want others to have access to our private events.
  7. 7 How to solve this issue? • Let them run

    their own instances • The main goal of the project is having a collaborative database of events • Synchronize Databases via XDCR (Federation); • Compromises the scalability of the project, if 200 companies are using it, I will need to allow my database to replicate to all of them. • Store private events locally and public events remotely • A lot of extra coding and complexity. It can also limit some features like reports.
  8. 8

  9. 9

  10. 10

  11. 11 Sync Gateway Synchronization • Synchronize data between Couchbase Lite

    and Couchbase Server • REST, Stream, Batch, and Event APIs • Pluggable authentication • Fine grained user/role-based access control • Elastically scalable in real-time
  12. 12 Lightweight embedded NoSQL database with full CRUD and query

    functionality. Secure web gateway with synchronization, REST, stream, batch and event APIs for accessing and synchronizing data over the web. Highly scalable, highly available, high performance NoSQL database server. Built-in enterprise level security throughout the entire stack includes user authentication, user and role based data access control (RBAC), secure transport (TLS), and 256-bit AES full database encryption. Couchbase Lite Sync Gateway Couchbase Server EMBEDDED DATABASE SYNCHRONIZATION DATABASE SERVER SECURITY
  13. 13 Couchbase Server Database Server • Performance at scale •

    Flexible JSON data model • Scale easily to hundreds of nodes • Multi-Document Transactions • Strong-Consistent
  14. 14 Couchbase Lite Embedded Database • Cross-platform support for all

    major operating systems and platforms • Built native from the ground up • 500kb for most platforms • 256-bit AES full database encryption
  15. Embedded Databases Realm

  16. 16

  17. 17

  18. 18

  19. 19 Confidential and Proprietary. Do not distribute without Couchbase consent.

    © Couchbase 2017. All rights reserved. Mobile App Couchbase Lite Native API Native Platform Bindings JSON Lite Core Engine Fleece Storage Engine Replication Protocol w/ Sync Gateway
  20. 20 Couchbase Lite Sync Gateway Couchbase Server

  21. 21

  22. 22

  23. 23 Couchbase Lite Sync Gateway Couchbase Server

  24. 24 • Web-Sockets while app is active and with connectivity

    • Exponential back off • Silent Notifications / Background App Refresh
  25. 25 Sync Gateway Couchbase Server

  26. 26

  27. 27 Couchbase Lite Sync Gateway Couchbase Server

  28. 28 2 1 2 1 or 2

  29. 29 • Automatically by picking latest one wins/Higher version wins

    • Merge documents on the mobile
  30. 30 Couchbase Lite Sync Gateway Couchbase Server

  31. 31 • The Sync Function allows you to decide which

    documents should be synchronized; • You can choose the direction of the synchronization: mobile-to- server, server-to-mobile or both
  32. 32

  33. 33 Couchbase Lite Sync Gateway Couchbase Server

  34. 34 • Authentication/Authorization; • Subscribe to public and private channels;

    • Dynamically add new channels; • Add “Command” documents that will be processed in the backend
  35. 35

  36. 36

  37. 37

  38. 38 Couchdraw: https://github.com/couchbaselabs/CouchDraw Chatbase: https://github.com/couchbaselabs/Chatbase

  39. 39 Travel Sample: https://docs.couchbase.com/tutorials/mobile-travel- sample/java/installation/travel-mobile-app.html

  40. 40 • couchbase.com • https://blog.couchbase.com/api-testing-postman/

  41. Thank You! deniswsrosa @deniswsrosa denis.rosa@couchbase.com