Join us

Mia-Platform launches open-source MongoDB CRUD Service

Mia-Platform MongoDB CRUD Service

Databases are the core component of every application. Modern cloud applications have to manage significant traffic loads and need a high‑performance database to handle a huge amount of data in a reasonable time. In this scenario, databases like MongoDB have emerged, and offer a wide range of solutions for almost every industry and use case.

Data stored on the database often must be shared among various services and applications. This communication is usually performed by a dedicated service that reads data on the database and exposes it in different ways, e.g. via APIs. Such services are generally called CRUD services and will be explained in more detail below.

In Mia‑Platform, we have relied on MongoDB for several years, and so we created a CRUD Service specifically tailored to communicate with MongoDB. Our CRUD service for MongoDB has been well received by our entire customer base, and over the years we’ve continued to improve it. Now, after several years of running successfully in production environments in various industries, we decided to release it open-source, so that everyone can benefit from it.

In this blog post, you will gain a general understanding of CRUD services, the main features and advantages of our CRUD Service developed by Mia‑Platform, and why the partnership with MongoDB was key for this project.

Mia-Platform and MongoDB

Connecting Mia‑Platform to MongoDB enables users to quickly build modern cloud‑native applications while ensuring the best possible experience. Both of them are built by developers for developers. While Mia‑Platform Console provides you with all tools needed to design, develop, and deploy your application, MongoDB takes care of everything related to data and data management.

MongoDB provides a high-performance database that enables us to build amazing and powerful tools like Mia‑Platform Fast Data. We highly recommend MongoDB to our customers because of its reliability and speed and for helping companies from different industries to scale and evolve quickly.

What is a CRUD Service?

As mentioned, a CRUD service exposes data from a database, usually via APIs. The acronym CRUD stands for Create, Read, Update, and Delete, which are the actions that can be performed on the resources using, for example, the respective HTTP methods (POST, GET, PUT, DELETE). Thanks to CRUD services, other services within the organization can access a specific database without knowing the database specification.

Without a CRUD service, all services that need the data should be equipped with all the details required to connect to the database (e.g. the URL, the ID key, etc.). This can introduce complexity, as some services may need to access only a subset of data, and they should be instructed accordingly. Moreover, if you want to change the database (e.g. switching from an on‑premise instance of MongoDB to MongoDB Atlas), you have to update the information on each service.

Thanks to a CRUD service, the database is effectively decoupled from the services and applications. Instead of having complex instructions to interact directly with the database, the services just have to perform a simple HTTP call to the CRUD service, which will forward the correct request and return the results. This also enables using tools like Rönd, which allows you to perform security checks and query definition before the request arrives at the CRUD service. Rönd is an open‑source project released and maintained by Mia-Platform that distributes security enforcement over APIs. It also enables filtering records or properties of returned responses: in this way, you can easily customize the subset of data each service can access, simply by assigning each service to a particular role or group.

For security reasons, to expose data outside the organization, it is recommended to do so through an API Gateway. Below you will find a visual representation of a CRUD service within a sample architecture.

The main characteristics of our CRUD Service

Now that it is clear what CRUD services are, we can better explain the unique features of the service we built.

Our CRUD Service is specifically designed to interact with MongoDB, and it is written in JavaScript and TypeScript. The purpose is to abstract MongoDB collections (i.e. a set of documents) and to expose them via RESTful APIs in an easy, scalable, and secure way. Given its high flexibility, the CRUD Service can be implemented in every kind of product.

The advantages of our CRUD Service

The CRUD Service offers a wide range of benefits and advantages, which is one of the main reasons we decided to release it open‑source. Some of its major features are detailed below:

  • Tailored for MongoDB collections: as mentioned before, our CRUD Service is specifically designed for MongoDB collections. So, if you already have a MongoDB instance, you can seamlessly integrate the CRUD Service into your application.
  • Support for different MongoDB versions: our CRUD Service is designed to support the latest three major releases, i.e. MongoDB 4.0, MongoDB 5.0, and MongoDB 6.0.
  • You can add a schema on MongoDB collections. As in a relational database, thanks to our CRUD Service you can define and apply a schema, as needed.
  • You can leverage aggregation pipelines: with our CRUD Service, you can define aggregation pipelines to create MongoDB views, which are queryable objects that do not persist on the disk and are the result of data aggregation from other sources.
  • Client‑side encryption: our CRUD Service can be configured to enhance the privacy of your data, encrypting data before saving it on the database.
  • Sanytizitation of MongoDB queries: before sending a query to MongoDB, the CRUD Service verifies that the query will not corrupt the database.
  • Log audit support: our CRUD Service can create logs for every single document, ensuring high-level governance.
  • Support for autoscaling: the CRUD Service can be configured to scale automatically as needed.
  • Collection indexes enforcement policy: you can configure the index on the collection, and the CRUD Service will create it on MongoDB if it is not yet present.
  • Automatic query pagination: there is no need to manually manage the query pagination, as the CRUD Service will do it automatically.
  • Easy integration with other open‑source tools: our CRUD Service is already integrated with Prometheus for easy monitoring, and thanks to its composable design, you can easily integrate it also with tools like Rönd, to protect the API you expose through it.
  • It is production‑ready and tested over years of deployment in different industries.
  • Since it is a core component of the Mia‑Platform Console, it is constantly maintained and updated by a team of professionals.

Conclusion

If any of the above sounds interesting to you, we would be delighted to hear from you! Our CRUD Service is the best solution you can find for working with MongoDB, and now that it is open‑source everyone can try it out.

Take a look at the official GitHub repository: the full documentation is available at this link. Also, we strongly encourage you to actively contribute to the project and participate in the community. Here’s a brief list of how you can contribute:

  • Check out the Open Issues: feel free to solve one of them, or to open new ones if you don’t find what you were looking for.
  • If you have any questions, ask them on GitHub Discussions: we will try to respond as quickly as possible, and potentially the answer can be useful for a lot of other users.
  • Improve the documentation: you can correct typos, expand the examples, and rewrite for clarity. Any help is appreciated and welcome!
  • Last but not least, if you like the project, give it a star on GitHub!

From now on, the CRUD Service joins the other open‑source projects maintained and supported by Mia‑Platform. If you are curious about what they are, take a look at this page.


Only registered users can post comments. Please, login or signup.

Start blogging about your favorite technologies, reach more readers and earn rewards!

Join other developers and claim your FAUN account now!

Mia-Platform

The simplest way to develop and operate modern applications on Kubernetes

Avatar

Paolo Martinoli

Technical Writer, Mia-Platfom

@pmartinoli
Tech Writer @mia-platform; Contributor @rond-authz; CNCF glossary 🇮🇹 l10n Reviewer
User Popularity
107

Influence

11k

Total Hits

9

Posts