How I Built my SaaS MVP With Fauna ($150 in Revenue so far) 
Published: 2021-02-19 17:58:39

## Are you a beginner coder trying to implement to launch your MVP?

I've just finished my MVP of [ReviewBolt.com](http://reviewbolt.com), a competitor analysis tool. And it's built using React + Fauna + Next JS. It's my first paid SaaS tool so earning $150 is a big accomplishment for me.  

In this post you'll see why I chose Fauna for ReviewBolt and how you can implement a similar set up.

I'll show you why I chose [Fauna](https://dashboard.fauna.com/accounts/register?utm_source=DevTo&utm_medium=referral&utm_campaign=WritewithFauna_ReviewBolt_CYarish) as my primary database. It easily stores massive amount of data and gets it to me fast. 

By the end of this article, you'll be able to decide on creating whether you also want to create your own serverless website with [Fauna](https://dashboard.fauna.com/accounts/register?utm_source=DevTo&utm_medium=referral&utm_campaign=WritewithFauna_ReviewBolt_CYarish) as your backend.

## What is ReviewBolt?
![ReviewBolt](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vtz9y0i4eemb4n1rwi9h.png)
The website allows you to search any website and get a detailed review of a companies ad strategies, tech stack, and users' experiences.

Reviewbolt currently pulls data from 7 different sources to give you an analysis of any website in the world. It will estimate Facebook Spend, Google Spend, Yearly Revenue, Traffic Growth Metrics, User Reviews, and more!

## Why Did I Build It?

I've dabbled in entrepreneurship and I'm always scouting for new opportunities. I thought building ReviewBolt would help me (1) determine how big a company is... (2) determine their primary distribution channel. Which is super important because if you can't get new users than your business is pretty much dead.

Some cool tidbits about it:

- You get a large overview of everything that's going on with a website.
- What's more, every search you make on the website creates a page that gets saved and indexed. So ReviewBolt grows a tiny bit bigger with ever user search.

## And how successful is ReviewBolt?

It's made $150, 50 users, analysed over 3000 websites and helped 5000+ people with their research. So a good start for a solo dev indiehacker like myself.

It was featured on Betalist and it's quite popular in entrepreneur circles.

You can see my real-time statistics here: [reviewbolt.com/stats](https://reviewbolt.com/stats) 

## I'm not a coder... All self taught (which is why I chose Fauna)

Building it so far was no easy feat! 

Originally I graduated as an english major from McGill University in Canada with zero tech skills. I actually took one programming class in my last year and got a 50%... the lowest passing grade possible.

But between then and now a lot has changed... For the last two years I've been learning web and app development. This year my goal was to make a profitable SaaS company but to also to make something that I would find useful.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0wkjwln8urvbz46ofyfn.jpg)
I built ReviewBolt in my little home office in London during this massive Lockdown.

The project works and that's one step for me on my journey. And luckily I chose Fauna because it was quite easy to get a fast, reliable database that actually works with very low costs.

## Why did I pick Fauna?

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jchox5s0iwfnfjyccw65.png)

[Fauna provides a great free tier](https://dashboard.fauna.com/accounts/register?utm_source=DevTo&utm_medium=referral&utm_campaign=WritewithFauna_ReviewBolt_CYarish) and as a solo dev project, I wanted to keep my costs lean to see first if this would actually work.

WARNING: I'm no Fauna expert. I actually still have a long way to go to master it. However, this was my setup to create the MVP of [ReviewBolt.com](http://reviewbolt.com) that you see today. I made some really dumb mistakes like storing my data objects as strings instead of objects... But you live and learn.

## I didn't start off with Fauna...

ReviewBolt first started as just one large google sheet. Every time someone made a wesbite search, it pulled the data from the various sources and saved it as a row in a google sheet.

Simple enough right? 

But there was a problem... 

After about 1000 searches Google Sheets started to break down like an old car on a roadtrip.... It was barely able to start when I loaded the page. 

So I quickly looked for something more stable.

## Then I found Fauna 😇

And finding it was a relief. I discovered that it was really fast and quite reliable. I started out using their GraphQL feature but realized the native FQL language had much better documentation.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e901ps131vqx02hi3vxb.png)

There's a great dashboard that gives you immediate insight for your usage.


## How Do I Use Fauna specifically?

I primarily use Fauna in the following ways:

1. Storage of 110,000 company bios that I scraped.
2. Storage of Google Ads Data
3. Storage of Facebook Ad Data
4. Storage of Google Trends Data
5. Storage of Tech Stack
6. Storage of User Reviews

The 110k companies are stored in one collection and the live data about websites is stored in another. I could have probably created created relational databases within fauna but that was way beyond me at the time 😅 and it was easier to store everything as one very large object.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8tuwm1bcxft18ybyo29e.png)

For testing I actually you the built-in web shell. This is really useful, because I can follow the tutorials and try them in real-time on the website without load visual studio. 

## What frameworks does the website use?

The website works using React and Next JS. To load a review of a website you just type 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mr4dpscbe8u694yb5pg2.png)

Every search looks like this: reviewbolt.com/r/[website.com]

The first thing that happens on the backend is that uses a Fauna Index to see if this search has already been done.

Fauna is very efficient to search your database. Even with a 110k collection of document it still works really well because of its use of Indexing.

So when a page loads... Say [reviewbolt.com/r/fauna](http://reviewbolt.com/r/fauna) it first checks to see if there's a match. If a match is found then it loads the saved data and renders that on the page.

If there's no match then the page brings up a spinner and in the backend it queries all these public APIs about the requested website. As soon as it's done it loads the data for the user. 

And when that new website is analyzed it saves this data into my Fauna Collection. So then the next user won't have to load everything but rather we can use Fauna to fetch it.

So the basic premise of Fauna. My use case is to index all of ReviewBolt's website searches and then being able to retrieve those searches easily.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h7dxve4rhuyt9wd9dmwx.png)

When you sign up to ReviewBolt you get a custom dashboard to track and follow your favourite companies. Using custom Fauna functions in React makes this super easy.

## What else can Fauna do?

The next step is to create a charts section. So far I built a very basic version of this just for Shopify's top 90 stores.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sgsu55e0x41qrt04igs6.png)

But ideally I have one that works by the category using Fauna's index binding to create multiple indexes around: Top Facebook Spenders, Top Google Spenders, Top Traffic, Top Revenue, Top CRMs by traffic. And that will really be interesting to see who's at the top for competitor research. Because in marketing, you always want to take inspiration from the winners.

## What does the Fauna code look like?

So for Fauna, what does the [Fauna Query Language (FQL)](https://docs.fauna.com/fauna/current/api/fql/) actually look like in implementation?

Here's a few basic code blocks from my website.

After you've initialised the client. You can simply do this:

```jsx
export async function findByName(name){

    var data = await client.query(Map(
      Paginate(
        Match(Index("rbCompByName"), name)
      ),
      Lambda(
        "person",
        Get(Var("person"))
      )
    ))
    return data.data//[0].data
      }
```

This queries Fauna to paginate the results and return the found object.

I run this function when searching for the website name.

And then to create a company I use this code:

```jsx
export async function createCompany(slug,linkinfo,trending,googleData,trustpilotReviews,facebookData,tech,date,trafficGrowth,growthLevels,trafficLevel,faunaData){

    var Slug = slug
    var Author = linkinfo
    var Trends = trending
    var Google = googleData
    var Reviews = trustpilotReviews
    var Facebook = facebookData
    var TechData = tech
    var myDate = date
    var myTrafficGrowth = trafficGrowth
    var myGrowthLevels = growthLevels
    var myFaunaData = faunaData

 
  client.query(
      Create(Collection('RBcompanies'), {
        data: {
            "Slug": Slug,
            "Author": Author,
            "Trends": Trends,
            "Google": Google,
            "Reviews": Reviews,
            "Facebook": Facebook,
            "TechData": TechData,
            "Date": myDate,
            "TrafficGrowth":myTrafficGrowth,
            "GrowthLevels":myGrowthLevels,
            "TrafficLevels":trafficLevel,
            "faunaData":JSON.parse(myFaunaData),
        }
      })
    ).then(result=>console.log(result)).catch(error => console.error('Error mate: ', error.message));
    
  }
```

Which is a bit longer because I'm pulling so much information on various aspects of the website and storing it as one large object.

The Fauna FQL language is quite simple once you get your head around. Especially since for what I'm doing at least I don't need to many commands.

I followed (this tutorial)[https://css-tricks.com/rethinking-twitter-as-a-serverless-app/] on building a twitter clone and that really helped. 

This will change when I introduce charts and I'm sorting a variety of indexes but luckily it's quite easy to do this in Fauna.

## What's the next step to learn more about Fauna?

{% youtube 2CipVwISumA %}

I highly recommend watching the video above and also going through the tutorial on [fireship.io](https://fireship.io/lessons/fauna-db-quickstart/). It's great for going through the basic concepts. It really helped get to the grips with the fauna query language.

## Conclusion

Fauna was quite easy to implement as a basic CRUD system where I didn't have to worry about fees. The free tier is currently 100k reads and 50k writes and for the traffic level that ReviewBolt is getting that works. So I'm quite happy with it so far and I'd recommend it for future projects.

Any questions reach out to via Twitter or the ReviewBolt website.