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 (
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.