DEV Community

Joachim Zeelmaekers
Joachim Zeelmaekers

Posted on • Updated on

Implement a free no-effort database for your next side-project.

Ever wanted to start a side-project where you needed a database?

Of course, everyone has. Most of the time, when we are trying out a new framework or language, one of the key things is data.

In this short example, you will notice how easy it is to create a secure database which can be accessed via a simple and straight forward Javascript SDK. The service we will be using is named Fauna.

So what is Fauna?

Fauna is a data API which creates a global data store for your application in a couple of minutes. The database has GraphQL support. Using FaunaDB will help you focus on your application and will handle scaling, sharding, provisioning, latency and correctness for you and maybe the most important part, it has a free tier!

How to set up your database

  1. Create an account at Fauna.
  2. Press new database.
  3. Choose a database name.
  4. (optional) toggle the Pre-populate with demo data toggle.
  5. Go to the security tab and create a new key.
  6. Secure the secret in a separate file (we will use this secret).

Code time already?

Yes! As you can see, there were 6 simple steps to create a data API for our application. Now we can start using the faunaDB javascript client.

In the code snippet below you can find a simple example of fetching a User object from the user collection by id.

index.js
code

config.js
key

Interesting links

  1. Source code on Github.
  2. FaunaDB.
  3. Plugin for the code snippets from VS code Polacode

Consider using this service in your next side project and let me know your thoughts on FaunaDB.

Top comments (0)