Jazz: Build Real-Time, Local-First React Apps With Sync & Secure Collaborative Data

Rate this content
Bookmark

Users have come to expect real-time collaboration from best-in-class apps like Notion or Figma. But widely available tools and infrastructure for building multiplayer apps are only just emerging. In this talk, we’ll explore the open-source framework Jazz and the two new ideas powering it: Conflict-free Replicated Data Types (CRDTs) and verifiable permissions. By building a whole app with nothing but React and Jazz, we’ll see how this new approach radically simplifies building not only real-time multiplayer apps, but any kind of app in which users interact.

This talk has been presented at React Advanced Conference 2023, check out the latest edition of this React Conference.

Watch video on a separate page

FAQ

JAS is a new framework for building apps around sync and secure collaborative data. It provides features like cross-device sync, real-time multiplayer, automatic granular data fetching, local and cloud persistence, offline support, and fast UI.

Anson started building JAS because he found building apps overly complex, especially for real-time multiplayer. He wanted to simplify the process by reducing the need for multiple components like databases, backends, message queues, and web sockets.

JAS offers cross-device sync, real-time multiplayer, automatic granular data fetching, local and cloud persistence, offline support, and a fast UI. It also provides collaborative data structures like collaborative maps and lists, and supports user identities, permissions, and roles.

CoJSON stands for collaborative JSON. It implements multi-device co-editing, user identities and accounts, permissions and roles, sync and caching, and persistence. CoJSON makes collaboration and secure access control inherent properties of your app's data.

JAS uses a service called Global Mesh for global sync and storage infrastructure. Global Mesh is like S3 plus a CDN for collaborative data. It stores and caches data locally and syncs it between different nodes as needed.

Yes, JAS can be used with React through the Jazz React library. This library provides automatic subscriptions, allowing developers to reactively subscribe to a tree of core values that update whenever edited locally or by another participant.

Yes, Global Mesh can be self-hosted. There is an option called CodeJSON Simple Sync that can be run as a local sync server or on a single server.

JAS uses CRDTs (Conflict-free Replicated Data Types) for conflict resolution. CRDTs ensure that everyone eventually sees the same state. For more complex apps, developers can access the full edit history to build app-specific conflict resolution mechanisms.

CoValues are collaborative values in CoJSON that include collaborative maps, lists, and soon collaborative strings and text. They keep their full edit history, automatically resolve conflicts, and are eventually consistent.

Yes, JAS can be adopted incrementally with existing apps. JAS syncs multiplayer data back into your existing database, allowing you to build new multiplayer features while maintaining compatibility with your existing features.

Anselm Eickhoff
Anselm Eickhoff
29 min
20 Oct, 2023

Comments

Sign in or register to post your comment.

Video Summary and Transcription

JAS is a new framework for building apps around sync and secure collaborative data, promising to simplify app development by eliminating unnecessary complexity. CoJson is an abstraction that simplifies app development by implementing multi-device co-editing, user identities, permissions, sync, caching, and persistence. Jazz is an open source framework that provides idiomatic bindings for CoJSON, specifically in the browser. JAS provides powerful sync and storage capabilities, eliminating the need for external blob storage. Jazz React allows developers to use React and provides automatic subscriptions for reactive updates to core values. JAS offers instant interaction, offline sync, and the ability to rebuild Twitter with Jazz.

1. Introduction to JAS Framework

Short description:

I'm Anson and I'm here today to tell you about JAS, my new framework for building apps around sync and secure collaborative data. I'll talk about why I started making JAS, what it is, and give a demo app with a code walkthrough. JAS promises to simplify app development by eliminating unnecessary complexity and providing features like cross-device sync, real-time multiplayer, and fast UI. To understand how we got here, let's look at the history of computer architecture and the web. The complexity arises from the need to handle data transfer between different components. CRDTs offer an alternative model by embedding the internet into the data, allowing for collaborative editing.

Thanks so much for the intro. I'm Anson. I'm here today to tell you about JAS, my new framework for building apps around sync and secure collaborative data. Before I get into it, this is kind of the first time I'm talking about this publicly. So, if this is interesting to you guys, you could actually really help me out by checking out the homepage and joining the Discord, especially if you want to play around with JAS or have some questions. All feedback is just really helping me at this early stage.

Today, I'll talk about these things. Why did I start making JAS? What is it really? We'll have a look at a small demo app and do a detailed code walkthrough to give you a quick impression of what it feels like to build an app with JAS. If we have some time, we'll do a little bonus demo app and I'll talk some more about what's next for JAS.

So, why did I decide to start building JAS? I build a lot of apps and basically every time I'm like, hey, let's build an app, but then you have to worry about like all of this stuff, like choose a database, deploy it, how do you build the backend and especially if you want to do multiplayer in real time, it just adds more complexity. Suddenly you need message queues, web sockets, and I'm like, why is everything so difficult? And more interestingly, what if it didn't have to be? What if we could just kind of get rid of almost all of that and be left with only the things that really make our app, our app, right? Wouldn't that be nice? That's kind of the promise of JAS, sounds nice, right? And it gets even better. What if I told you that you also get cross-device sync, real-time multiplayer, automatic granular data fetching that you don't have to worry about, local and cloud persistence, offline support, and really fast UI for free? That sounds great, right? That's kind of roughly the dream that I had when I started with that, but how can we get there?

And I think to answer that question, it really helps. And that's what I started with, is to ask ourselves, how did we get into this mess in the first place? So really quick history, let's start from first principles. This is like kind of my mental model of a computer, right? And it turns out it's not my mental model of a computer, it's actually this guy's mental model, and he just willed it into existence, and that's what we have now. And it's pretty much unchanged since, except in the 60s and 70s, these guys added one box to it, which is the internet, and we're still kind of recovering from that. For the web itself, this guy was super influential. He basically saw this computer architecture and was like, hey, you know what, we should kind of build hypertext on that, and he created some of the first graphical user interfaces, but hypertext didn't really catch on until much later when this guy was like, research collaboration at CERN is kind of a mess, maybe we should build hypertext, and the problem with his implementation of hypertext, of course, is that it was good enough, and that's what we're stuck with now, that's the web. But later, in 95, this guy was like, hey, that's some nice hypertext you got there, how about we build a computer architecture on top of that? And also my boss gave me ten days to do so. And similarly, the problem with JavaScript was that it was good enough, so that's what we have now, right? So we're now in a situation where basically this is the most popular computer architecture, the JavaScript VM in the browser as we know it. But actually, there's nothing really wrong with that. The complexity is really inherent in the more generic model of the computer here because if we want to build an app, we have to worry about way too many of these boxes. Basically the reason we have all of these questions is because every time we want to build an app, we need to think about these arrows and shuffling data between the memory, the disk, the internet, other computers. That's where I think most of the complexity comes from. When I first heard about CRDTs, I got really excited because CRDTs promise an alternative model to that. I don't really have much time to explain CRDTs. There's a really good blog post called Data Laced with History. That's a very good mental model to think about CRDTs as well. So definitely check that out. A simple way of thinking about CRDTs that I like is, instead of trying so hard to put your data onto the internet and having that in different places, you basically put the internet into your data and your data is now aware that it exists in different places. Many people are editing it at once.

2. Introduction to Collaborative Data and CoJson

Short description:

When I started looking into CRDTs, I realized that on their own, they're not enough. You need permissions, sync, and storage solved as well. That's why I created CoJson, a powerful abstraction that simplifies app development. It implements multi-device co-editing, user identities, permissions, sync, caching, and persistence. With CoJson, collaboration and secure access control become inherent properties of your app's data.

When I started looking into CRDTs, I realized that on their own, they're not really enough. What you really want in addition to them is permissions and you want to have sync and storage solved for you as well. If you have this package of things, you actually have a really powerful abstraction. So powerful that it lets you go from this quite complicated situation to a much, much simpler one that looks like this.

And this new abstraction is what I'm calling collaborative data. I think that explains my motivation pretty well. So how do we actually build this? And this is where I'll start talking about what Jazz actually is. We want to build this somehow and how do we implement this in today's world? My particular take on it I'm calling CoJson, which stands for collaborative JSON. And basically you just hook up some JavaScript to that and you render stuff into the DOM and that's all you need to do to build an app. To be more precise, CoJson implements multi-device co-editing, user identities and accounts as a first-class concept. Permissions and roles, sync and caching and persistence for you so you don't have to worry about any of that when building an app. Most importantly, it basically makes collaboration and secure access control feel like inherent properties of your app's data. And that means that you can build your app as if all you had was local state. You don't have to worry about anything else anymore.

QnA