Join us
@pmartinoli ・ Mar 22,2023 ・ 6 min read ・ 952 views ・ Originally posted on blog.mia-platform.eu
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.
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.
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.
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 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:
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:
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.
Join other developers and claim your FAUN account now!
Technical Writer, Mia-Platfom
@pmartinoliInfluence
Total Hits
Posts
Only registered users can post comments. Please, login or signup.