Diff Stories

Diff Stories

1 Follower
Shape your pull requests the way you want them to be

Decisions 1

Slava Korolev

Senior Software Engineer at Diff Stories

SQL or NoSQL?

As a general rule, I would recommend using the SQL database over NoSQL because:

  • working with associations is way easier;
  • you can write complex queries;
  • rigid structure ensures data validation;
  • more developers know how to work with it properly;

But while working on Diff Stories, we choose DynamoDB, and that's why.

Associations

The core object of our product is a Pull Request. All other entities, such as diff blocks, code comments, reviews, etc. are all parts of a pull request. It works really well with document-based storage like DynamoDB because we can save everything as one document, and no associations are needed.

Data structure

Another useful feature for us — JSON as a first-level citizen in DB. We represent a pull request as a set of pages with blocks and additional objects. It is very convenient to save it as a JSON. You can have JSON columns in Postgres, but it's more natural in NoSQL databases.

Connections

Our backend is a Node app written in Typescript. It is deployed serverless on AWS Lambdas. You can say that it's unnecessarily, and you will be right :) But again, if you know how to use it properly, it might be useful. With DynamoDB, you don't have a limit of connections, and that's quite handy if you have serverless architecture.

Pricing (Bonus)

When you are just starting, you count every cent. DynamoDB is super cheap for small databases, and if you're building MVC or don't have many clients yet, it will be almost free for you. But be careful — once requirements for your DB increase, the price will increase too.

I'll be happy to discuss everything above in the comments :)

Meanwhile, you can visit us on Diff Stories

12 13.8K

Followers 1