Is Fauna The Next Big Database Technology?
Tags: database, webdev, programming, discuss
Published: 2022-04-15 12:03:00

If you call yourself a builder, whether that means working on a startup, open source, or personal projects, you need to keep up to date with the latest tech. Innovation in software development is only accelerating,  with paradigm shifts happening more and more often. 

In the world of Databases, [Fauna](https://fauna.com/) has generated a lot of buzz by creating one of the most versatile, scalable, and intuitive database technologies out there.

Today, we’ll explore how Fauna works and create and use our first Fauna database.

---
###What is Fauna?

Fauna is a serverless, multi-region database that is accessible through a cloud API. That means that Creating, Reading, Updating and Deleting data can all be done within a standard api call.

For the more technically minded, Fauna is what’s called a transactional database. In layman’s terms, this means that you can get the flexibility of a noSQL database like Mongo, without sacrificing the speed and accuracy you get from a SQL Database.

This makes Fauna an amazing option for startups and personal projects that want to build quickly without incurring a ton of technical debt.

---
###Creating a Fauna Account

To get started, first visit the [signup page and create a free fauna account](https://dashboard.fauna.com/accounts/register). This will direct the user to the fauna dashboard.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h03wxit47unga48nzrw6.png)

Click on CREATE DATABASE to create a database. Next, provide the database name and the region where the database will be created.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hv7zplnh9johib9z3ueb.png)

We will need the access key to interact with the database. Navigate to the security section from the database view. Here, you can create the access key that will be used to communicate with the Fauna API.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ym19a86zegjtnguv1zd9.png)

---
###Integrating Fauna with an Application

Now that we have created a Fauna database and obtained the access key, we can utilize Fauna in an application. In this section, we will look at how we can communicate with Fauna using Python. Of course, since this is all API based, implementations will be nearly identical in every language.

Let’s first setup a python environment with:

`pipenv shell`


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n4jlfaseldyorhjgq5rx.png)

Now let’s install the dependencies. This is the Python driver for Fauna.

`Pipenv install faunadb`



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gxu2p40ko4rxiql02bvt.png)

---

###Create the Application

In the following code, we connect to our database and perform all four CRUD operations that we expect from a database:
* Create
* Read
* Update
* Delete

{% embed https://gist.github.com/LiorB-D/9f35ca9abb0475047f0279d491b260c2 %}

If the program is successfully executed, you should see the following output for each respective function:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nh7kx7idi9q9qy3knvwl.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lx4w6p45nntlufrm4z2n.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5vdoafsonsf0lj74l4ke.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/26vakdo37nknddjf5ijk.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hqn63if3a9624tqeu4iz.png)

---

There you have it! We’ve setup our own Fauna project and performed all the standard database technologies in less than 100 lines of code. The simplicity of this implementation isn’t a result of us cutting corners – it’s actually that easy!

So what do you think? Are you going to be using Fauna for your next project? Let us know down below!

Happy coding from your good friends at [Codesphere](https://link.codesphere.com/KS), the Swiss army knife every software developer needs.