Image for post
Image for post

Today we’ll be building a small API to see a quick overview on how to use Fauna in Node.js.

For reference, here’s a Github repository with the finished project that you can use to follow along: https://github.com/PierBover/getting-started-fauna-nodejs

Any recent version of Node will do. If you don’t have it installed already, I recommend downloading the LTS installer from the official website. This will also install NPM which you need to manage your dependencies.

For our server we’ll be using Fastify which is easy to use and offers a great developer experience. Also, as its name implies, it’s very fast.

One last thing. If you’ve never used Fauna or FQL before, it would be a good idea to at least take a quick look at this introductory article. …


Image for post
Image for post

Fauna and DynamoDB are both serverless databases, but their design goals, architecture, and use cases are very different. In this post, I will overview both systems, discuss where they shine and where they don’t, and explain how various engineering and product decisions have created fundamentally different value propositions for database users.

DynamoDB’s design philosophy: availability and predictability

AWS DynamoDB was developed in response to the success of Apache Cassandra. The Cassandra database was originally open sourced and abandoned by Facebook in 2008. My team at Twitter contributed extensively to it alongside the team from Rackspace that eventually became DataStax.

However, in an odd twist of history, Cassandra itself was inspired by a 2007 paper from Amazon about a different, internal database called Dynamo-an eventually-consistent key-value store that was used for high-availability shopping cart storage. Amazon cared a lot about shopping carts long before they had a Web Services business. Within Amazon, the Dynamo paper, and thus the roots of DynamoDB, predate any concept of offering a database product to external customers. …


Image for post
Image for post

It’s been a busy few months here at Fauna, and we’re very excited to share what we’ve been working on with you! Today, we released a slew of new capabilities to help Fauna developers collaborate more efficiently on shared databases, secure their accounts with multi-factor authentication, secure their applications with third-party identity providers, and improve application responsiveness with real-time document streaming. Using these features, development teams will be able to more easily and securely build sophisticated business applications with Fauna.

Team management

With team management, multiple members of your organization are now able to log into a shared team account with their own credentials. Team members can be assigned different roles including admin, developer, and billing, with a single user having the owner role. …


Image for post
Image for post

Real-time application features have silently become omnipresent in our everyday life in the form of instant messaging, real-time statistic updates, or collaborative editing. They have moved from a ‘nice to have’ feature to, in some cases, the determining factor whether my new application will be perceived better than the one from a competitor.

That said, Fauna has always had a strong story to keep applications in sync or retrieve updates since temporality is a first-class citizen. The standard temporality features already provided you with the means to travel back in time, change history, and functionality to easily retrieve events. …


Image for post
Image for post

In the previous part of this tutorial, we set up a Single Page Application (SPA) that authenticates with Auth0 and uses the Auth0 access token to connect with Fauna. Until now, we received access to the whole ‘dinosaurs’ collection when we logged in, regardless of the identity or type of user that was logged in. However, since Auth0 provides you with full control of the content of the Auth0 token and Fauna has the powerful FQL to interpret the token contents, anything is possible. In this follow-up tutorial, we dive into multiple approaches for more advanced role-based access patterns.

Each of these approaches will be a new commit in a separate ‘extras’ branch of the same repository which we have cloned in the previous part of this…


Image for post
Image for post

Offering users alternative ways to authenticate, such as social login, is valuable for both the end-user and for you the developer since it has the potential to reduce the amount of support cases around lost passwords or blocked accounts.

Although you could implement these flows on top of Fauna, it’ll require some work and when it comes to security, it makes sense to let libraries of experts in the field handle that work for us. Identity providers, such as Auth0, do a great job at providing libraries for this functionality out-of-the-box. …


Image for post
Image for post

Community Contribution

Today, in the final article of the Core FQL series, we’re going to take an in-depth look at the Join() function and its multiple uses.

This series assumes you have a grasp on the basics. If you’re new to FaunaDB and/or FQL here’s my introductory series on FQL.

In this article:

  • Introduction
  • Which robot parts are manufactured on Vulcan?
  • What is a SetRef?
  • Using Join() with Lambda()
  • Using multiple joins
  • Using Join() with Range()
  • Replicating SQL joins in…

Image for post
Image for post

I briefly introduced Range() in a previous article and, as promised, we’re going to take a deeper look at it today.

This series assumes that you have a grasp on the basics. If you’re new to FaunaDB and/or FQL here’s my introductory series on FQL.

In this article:

  • Introduction to range queries
  • Multi-items boundaries
  • Range and then filter
  • Index and then range
  • Combine indexes
  • Range with index bindings

The idea of range queries is to be able to filter results by providing two boundaries, expressed as start and end values. Since FaunaDB needs to be able to compare values to determine when a result should be included, these boundaries have to be scalar values such as numbers, strings, or dates, but not other FQL types such as booleans. …


Image for post
Image for post

Today we’re going to explore some of the aggregate functions of FQL and a number of techniques for data aggregation.

This series assumes you have a grasp on the basics. If you’re new to FaunaDB and/or FQL here’s my introductory series on FQL.

In this article:

  • Introduction
  • Basic aggregate functions
  • Retrieving data for aggregation
  • Grouping results
  • Ultimate robots report

The basic idea of data aggregation is to perform one or more calculations over a set of values. Common aggregation tasks include computing the total, average, range, standard deviation, etc. In other words, you can answer questions such as “How many spaceships are currently stationed in our Moon base?” …


Image for post
Image for post

In this episode of the Build Fearlessly podcast, Fauna’s frontend developer, Ryan Harris, talks to the very talented 12 year old, Rishab Kattimani and his father Sanjay. Rishab has not only used his time in quarantine the past few months to get more acquainted with programming, but has also given back to the developer community through his YouTube channel, Rishab Teaches Tech, where he’s created video tutorials for other beginner programmers.

LINK TO PODCAST EPISODE

Show Notes

Tools discussed:

Other resources:

Heroes:

Date: September 30, 2020
Originally published at
https://fauna.com.

About

Fauna Inc

The data API for modern applications.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store