Speed, reliability, and accessibility of your applications across geographically distributed customers is easier than you think with edge computing architecture. Fastly’s high-scale, globally distributed edge computing network, paired with Fauna’s geographically distributed, low-latency, and strongly consistent database, gives you the power to easily build and operate REST APIs that offer speed, reliability, and scale with extremely low operational overhead. This article demonstrates how easy it is to build a distributed REST API with Fastly’s Compute@Edge and Fauna.
If you want to follow along quickly, you can find the complete code for this tutorial here on GitHub.
Building with Fauna and Fastly Compute@Edge enables you to create a geographically distributed, strongly consistent, fully serverless REST API in a single code repository. You can develop your application as if it were a monolith but gain the resilience and reduced latency of a distributed application running at the edge.
Fauna is particularly well-suited for applications running on edge computing platforms – such as Fastly Compute@Edge – due to its low latency, strong consistency, distributed architecture and API delivery model. Fauna provides a powerful yet easy TypeScript-inspired query language called FQL – pairing well with Fastly’s excellent support for application code written in JavaScript.
To get started, make sure you have a Fastly account. Then, simply clone the Fastly Compute@Edge Starter Kit for Fauna:
git clone <https://github.com/fauna-labs/fastly-compute-at-edge-starter-kit.git>
“cd” into the project directory and install dependencies
npm install
Next, you’ll need to obtain a Fauna database access token to configure the project.
Head over to dashboard.fauna.com and create a new database. You can create a new database by selecting the ‘Create Database’ option.
Give your database a name, select the global Region Group, and then select ‘Create’. You can turn off backups for this particular sample application.