CASE STUDY

Banking

Building a scalable neobank platform from scratch on CockroachDB

How Fi is using CockroachDB as a financial ledger for India’s first neobanking platform for millennials

  • 1M+ users

  • 400 transactions per second

  • 1TB per node

  • 50 engineers

  • 3.2K queries per second

  • 2 years of development

About Fi

In early 2019, a group of ex-Google, Netflix and PayPal employees came together to change the way millennials experienced banking in India. They decided to pursue neobanking which re-imagines traditional banking using a digital-first approach. 

Millennials make up 34% of the Indian population, and a sizable chunk of the banking population, so it seemed like they would be the perfect target group for their neobank to tap into. 

However, millennials in India aren’t particularly fluent with their finances. Money management is not taught formally unless you’re majoring in finance, and a lot is down to the individual’s willingness to self-educate. But what they lack in financial awareness, they make up for with tech-savviness.

So, a year and a half later, Fi was born. A neobank that’s tailor-made for salaried professionals. It offers a zero-balance savings account and helps users know their money, grow their money, and organize their funds. 

The idea was simple: to bring banking to users’ fingertips. Everything from opening an account to making payments is completed online. Fi offers features that automate savings and payments, give insights into spending, and help users with goal-based saving. Users also get a debit card that has zero foreign exchange charges and can be controlled through the app. All this is coupled with the security and privacy you could expect from a traditional, brick-and-mortar bank.

To support this digital-first banking platform, the Fi team needed to build their application on a scalable and reliable software layer that could scale with them as their business grows. Prior to releasing their app to the public, they started to evaluate database solutions, and ultimately chose CockroachDB.

“We know that the startup mentality is to move fast and break things. But we are in fintech and we are handling people’s money! We needed to build for the long term in order to keep up with the competition. We felt comfortable making an investment in CockroachDB and trust that it will grow with us on this journey.” - Prasanna Ranganathan, Founding Team

Requirements for a digital-first bank

Building a payment system from scratch is not an easy task. Prasanna Ranganathan (Fi’s Founding Engineer) knew that they needed to choose the right database from the start. One that would support their business in the long term. Since neo-banking was rising in popularity and there were lots of new companies coming to market, Prasanna understood that the technology they chose to build their application on could separate them from the rest. 

In addition to building a unique offering, they had a lot of other technical challenges to overcome as well. They needed to be able to easily scale their platform across multiple regions as their customer base started to grow, without causing latency. They also needed to ensure that their transactions were consistent at scale. They did not want to use a traditional system that would require manual sharding and unnecessary operations for their team. 

India is in the process of adopting a similar data protection policy as the EU’s GDPR. But, it is even more complex since it treats data generation by its citizens as a national asset that needs to be stored within national boundaries. This means that the Fi team needed the ability to pin data close to its customers in order to comply with these pending regulations. 

Finally, as a startup at the time, they needed an affordable solution that could grow with them in the future. Their developer team had a background in Postgres, so an SQL compatible database that offers a similar experience would be a huge benefit since it would reduce the learning curve.

To summarize, the Fi team required a database that would allow them to: 

  • Build for the long term
  • Scale across multiple regions
  • Guarantee consistent transactions
  • Reduce latency 
  • Pin data to a location 
  • Get up and running quickly

When searching for a distributed solution, they came across Spanner, TiDB and Yugabyte. Spanner came the closest to meeting all of their requirements. However, it would require them to be locked into a single cloud provider which might have limited them from expanding into certain regions in the future. 

They continued their search and came across CockroachDB which checked all of their boxes. In the summer of 2020, they finished their evaluations and selected CockroachDB as their technology of choice to build Fi.

“Coming from Postgres, it really was such a simple transition to CockroachDB. We didn’t have to jump through any technical hoops and the whole process was fairly predictable. If we ever did need help, the CockroachDB team was always readily available to give us guidance and support.” - Prasanna Ranganathan, Founding Team

Building a banking application on CockroachDB

Since the team was used to working with Postgres, they hit the ground running with CockroachDB. They set up a development environment until the company passed several audits and certifications. Once the MVP application was ready in October 2020, they moved into production. 

Today, CockroachDB serves as a financial ledger for Fi, and stores all its core banking data. On the database side, they also use Amazon RDS for Postgres to handle non-core financial data. 

They use other AWS services such as S3 (cloud storage), ElastiCache (in-memory data store/cache), EMR (data processing), and Rekognition (machine learning) to support their infrastructure. On the automation side, they use several open-source tools such as Terraform, Jenkins and Ansible to build & test their software.

Right now, the CockroachDB cluster spans 3 AZs and is configured to be resilient to AZ outages. The data is backed up to S3 as well as a second copy is stored in GCP which improves the overall resiliency from a DR perspective. The Fi team is working on further enhancing the setup and extending the entire architecture to a multi-region setup.

As their customer base has continued to grow, Fi has been very pleased with CockroachDB’s ability to scale. Here’s a glance of their growth over the past year:

  • Grew from 1.5K queries per second to 3.2K queries per second 
  • Started with 200 transactions per second and grew to 400 transactions per second

Each of their nodes currently holds around 1TB of data. As they onboard new customers, they can simply add more nodes to their cluster and the data will automatically rebalance across these nodes.

What’s Next

The team knows how challenging it will be to change millennials’ behavior when it comes to financial services. When asked about their future, the team at Fi remarked that they have plenty to keep them busy within India for the next several years! However, international expansion is never out of the question. While the technology might transfer, the regulations will not, which is a challenge for a different day. 

Today, they have over 1 million people using Fi and are seeing an ever increasing volume of new accounts opened per week. In the immediate future, they are focused on continuing to innovate on the product which is centered around their customers. They expect that as Fi’s interface continues to improve, their customers will grow organically. Fi wants to deliver the best product possible to India’s millennials and are glad that they are building on CockroachDB.

Ready To Get Started?