Ensuring Rocket.Chat database consistency (GSoC 2018)

Gabriel Engel
June 5, 2018
·
min read

Project 1: Ensuring Rocket.Chat database consistencyby Chuan De Sheng

This series of blog posts will share the Google Summer of Code projects that our 2018 cohort of students are working on. Community memebers are encouraged to join them in creating and testing these exciting new areas of features.
Each project will have their open source repository listed. Please feel free to drop in and say hello, or join in the action with your own issue or code contribution.

Mentors: Diego Sampaio, Rodrigo Nascimento, Sing Li

The first installment of this blog series features Chuan de Sheng’s database schema builder that will ensure database integrity across all versions of Rocket.Chat.

Consistency of database structure over time can be an ongoing problem

With NoSQL databases, the structure (or schema) of a database is not enforced by the database engine. Rocket.Chat uses the leading NoSQL database, MongoDB, for its data storage requirements. Different versions of Rocket.Chat have slightly different database schemas. When users try to upgrade their version of Rocket.Chat to a newer one, data migration is performed automatically. However, there are currently no checks to ensure that the old database schema is completely consistent with the new database, and its integrity can therefore become compromised over time. This is especially true if the user has attempted any kind of custom modifications or development during the lifetime of a Rocket.Chat server.

On the road to enforcing NoSQL database consistency

You can find Chuan de Sheng’s work here. This project first defines a base schema for Rocket.Chat’s current database and creating a mechanism to validate any new entry prior to its inclusion in the database. The mechanism must also be dynamic, so that users are able to add or modify fields, while ensuring that all data in the current base schema of Rocket.Chat is consistent, and avoids application breakage or data corruption due to an inconsistent / unexpected schema elements.

The second aim of this project is to use data relations between the field types to double-check data, especially after migration of data in an existing Rocket.Chat instance.

A Rocket.Chat database schema builder – WIP

Chuan’s has created a database schema builder. This database schema builder will help community users access and keep track of the schema, despite having architectural database changes. Subsequently, code and output from the schema builder may be incorporated into Rocket.Chat itself for ongoing enforcement of database consistency.

An immediate benefit for community users

One immediate benefit of this project is the feature for an administrator of a Rocket.Chat instance to view the current structure/schema (not the data itself) of his/her Rocket.Chat database. The schema is displayed in an easy-to-understand format for the administrator.

About the creator: Chuan De Sheng

Chuan is a fourth year Material Sciences undergraduate from Singapore who balances his studies with his passion for coding. He was interested in Rocket.Chat as he had worked with Meteor.JS for a long time and wanted to give something back to the community. Chuan recently worked on a forum/chat platform as a side project with friends and is looking forward to applying what he learnt from it to a meaningful project during GSOC, with the added bonus of getting experience using MongoDB and of gaining insight into how the open source contribution process works.

Chuan De Sheng

Rocket.Chat looks forward to working with you Chuan!

For a full list of all the 2018 GSOC projects, check out our Docs!

Get started with Rocket.Chat’s secure collaboration platform

Talk to sales

Frequently asked questions about <anything>

Gabriel Engel is the CEO and co-founder of Rocket.Chat, the leading open source communications platform.
Gabriel Engel
Related Article:
Team collaboration: 5 reasons to improve it and 6 ways to master it
Want to collaborate securely with your team?
Deploy Rocket.Chat on-premise or in the cloud and keep your conversations private.
  • Digital sovereignty
  • Federation capabilities
  • Scalable and white-labeled
Talk to sales
Looking for a HIPAA-ready communications platform?
Enable patients and healthcare providers to securely communicate without exposing their data.
  • Highly scalable and secure
  • Full patient conversation history
  • HIPAA-ready
Talk to sales
The #1 communications platform for government
Deploy Rocket.Chat on-premise, in the cloud, or air-gapped environment.
  • Secure data governance and digital sovereignty
  • Trusted by State, Local, and Federal agencies across the world
  • Matrix federation capabilities for cross-agency communication
Talk to sales
Want to customize Rocket.Chat according to your own preferences?
See behind the engine and change the code how you see fit.
  • Open source code
  • Highly secure and scalable
  • Unmatched flexibility
Talk to sales
Looking for a secure collaboration platform?
Keep your conversations private while enjoying a seamless collaboration experience with Rocket.Chat.
  • End-to-end encryption
  • Cloud or on-prem deployment
  • Supports compliance with HIPAA, GDPR, FINRA, and more
Talk to sales
Want to build a highly secure in-app chat experience?
Use Rocket.Chat’s APIs, frameworks, and managed backend to build a secure in-app or live chat experience for your customers.
  • Supports compliance with HIPAA, GDPR, FINRA, and more
  • Highly secure and flexible
  • On-prem or cloud deployment
Talk to sales

Our best content, once a week

Share this on:

Get your free, personalized demo now!

Build the most secure chat experience for your team or customers

Book demo