Create secure, real-time applications with Fauna event streaming
Shashank Golla|Mar 8th, 2022
We’re excited to announce the general availability of event streaming, which simplifies listening for real-time changes in your database at both the document and collection levels! Fauna’s event streaming is a secure, open, push-based stream that sends changes in the database to subscribed clients as soon as they occur – all while maintaining Fauna’s intrinsic serverless nature.
Automate receiving real-time data updates
Consumers today expect that information presented to them in any application is accurate. To meet this consumer need, developers need to ensure changes in their database are streamed to clients in real-time.
Traditionally, for clients (i.e., browser, phone, etc.) to receive changes in a database you implemented polling. Polling is when your client code repeatedly issues queries to your database at a chosen interval to discover document or collection changes. As you can see in the diagram below the results from polling are dependent on how often you query your database and hence are not real time. Writing code to poll for data changes not only requires dev cycles from your team, but it also adds operational overhead in hosting and maintaining polling.
Fig 1: Polling approach to query for changes in your database
Fauna’s event streaming employs an open, push-based streaming method to automatically stream real-time data updates to your clients when there is a change in your database. Unlike polling, in event streaming the subscription from the client side happens once and changes are automatically broadcast to the client whenever the subscribed document or collection is updated. This means you can now stream real-time changes in your database to your clients without spinning up or maintaining any infrastructure – consistent with Fauna’s no-ops promise to developers.
Fig 2: Event streaming approach to identify changes in your database
Reduce time to market with Fauna’s no-ops database
If you’re building a consumer facing application today presenting users real-time data in your UIs isn’t a choice, it’s a requirement. Think about the expectation you have when using an e-commerce platform to order the latest tech, playing a video game, or are in a group chat with your best friends – you expect the information to be accurate and real-time.
One of Fauna’s event streaming users, Accentuate, has served the Shopify community since 2016 and is trusted by more than 10,000 merchants worldwide including more than 3,000 high-traffic Shopify Plus stores.
“Accentuate helps our customers optimize their Shopify businesses by customizing how their products are presented to their users. It’s critical that our application is able to respond to the changes our customers make in their product offerings in real-time. We were able to get Fauna’s event streaming up and running quickly without managing any database infrastructure and it enables us to easily process and stream thousands of product updates in real-time." - Ole Thorup, Co-Founder & CEO
Ensure clients have least privilege access with ABAC
Fauna’s ABAC, an extension of traditional role-based access control (RBAC) is a fine-grained strategy for managing identity-based operations within Fauna. It allows you to define privilege for roles that can be dynamically determined based on any attribute of the actor attempting to modify or read data.
Streaming allows you to build real-time applications, but it’s important to ensure that direct read access to the database comes with some guardrails. Let's take the example of a video game where some users play for free, and others subscribe to get access to special offers within the game. When these specials are posted to the database, it’s critical that only the subscribed users are presented with the updates specials. With ABAC, you can implement least privilege access using streaming and provide real-time changes to only the users who should be receiving the updates.
Get started with event streaming today
Event streaming will be available to all of our users (Free, Individual, Team, and Business). To understand pricing implications, please checkout our billing FAQs.
If you’re building real-time applications, sign up for free and start implementing streaming in your applications.
If you enjoyed our blog, and want to work on systems and challenges related to globally distributed systems, serverless databases, GraphQL, and Jamstack, Fauna is hiring!
Subscribe to Fauna's newsletter
Get latest blog posts, development tips & tricks, and latest learning material delivered right to your inbox.