INTRODUCTION
Softinstigate’s RESTHeart API for MongoDB simplifies development and frees you to focus on delivering great user experiences
Softinstigate is a highly specialized services company focused on the design and rapid development of cloud-native digital products. It develops new cloud-ready apps, migrates legacy apps, reengineers monolithic applications to microservices and serverless, and manages continuous software operability using DevOps best practices. SoftInstigate is a MongoDB Technology Partner and the company developing RESTHeart, a ready-to-use REST API for MongoDB. The company deploys the majority of its products and services on MongoDB Atlas running on AWS.
THE CHALLENGE
Overcoming the limitations of inflexible relational databases
Softinstigate’s CEO and Co-Founder Andrea Di Cesare and Co-Founder Maurizio Turatti have long-term experience with enterprise data products. That experience has shown them that relational databases are not flexible enough to meet today’s business requirements and can easily become a nightmare.
Legacy relational database limitations were their main technology challenge. Developing an effective go-to-market strategy to address their home market of Italy would be equally challenging.
Italy is home to literally millions of small to medium sized businesses (SMBs). Many of the core components used by German automotive industry giants are manufactured by small companies in Northern Italy; for example, approximately 70% of the braking systems for German motorcycles are made by smaller companies in Bergamo, Italy. Italy’s SMBs make their mark (and market) as small, highly effective companies that can move at the speed of business. While this can make Italy a target-rich environment for a technology solutions provider like Softinstigate, the urgency with which these companies operate can also make it extremely challenging to win contracts with them. A technology provider must build strong relationships first, usually with a company’s founders, and any opportunity it gets to deploy something is a make-or-break event.
Softinstigate’s ability to address this dynamic marketplace was constrained by its use of relational databases including MySQL and PostgreSQL combined with technologies such as Java app servers and IBM DB2. Di Cesare and Turatti spent a lot of time on technical fixes to keep servers and databases running instead of solving their clients’ business problems.
THE SOLUTION
RESTHeart microservices architecture built on MongoDB and AWS
Perhaps not surprisingly given the technology limitations they were trying to overcome, the founders “essentially had no customers early on,” said Turatti, which gave them time to set up their site and create a manifesto about the kind of company they wanted to be.”We decided to build something on our own using simpler technologies.”
Web and mobile apps were ascendant, and the founders knew they could easily manage data from those sources in a document database. They made the decision to build a Java app server on top of MongoDB.
RESTHeart: stateless REST API microservice that uses simple HTTP calls to unleash the power of MongoDB
Softinstigate began working with MongoDB under the AGPL open source license, then began receiving requests for technical support for commercial licenses, so it designed a commercial license allowing clients to directly map JSON content from their apps into the database, in most cases running Kubernetes clusters against MongoDB.
That commercial license, branded as RESTHeart, is a stateless REST API microservice for MongoDB, written in Java and embedding the Undertow HTTP server, that lets users access the full power of MongoDB using HTTP calls. No server-side coding frees developers to focus on developing innovative, value-adding apps.
Softinstigate’s RESTful design strategy was to model Sessions and Transactions as first-class REST resources. In MongoDB, an operation on a single document is always atomic and that is one of the reasons Softinstigate opted to model data using embedded documents instead of creating relationships between multiple documents and collections. Softinstigate gained more advantages with the launch of MongoDB 4.0, including atomicity and strong consistency across databases, collections, documents, and shards using transactions.
Figure 1 illustrates the RESTHeart architecture.
Virtually any device can send an HTTP request to MongoDB via the API. RESTHeart sends queries to MongoDB using the Java driver and sends back the HTTP response as a JSON message. (Softinstigate is quick to point out that In addition to JSON, RESTHeart can accommodate virtually any type of content.)
Turatti said it is easier to build MongoDB into this configuration than any other database: “If you want to have replication with other databases it is a much larger effort. Failover and upgrade are easy with MongoDB; to scale a single node up and down it’s a click of the mouse. We take this level of convenience for granted with MongoDB.” One of Softinstigate’s customers experiences extreme peak loads with its data traffic, and MongoDB’s Autoscale feature scales up to handle them. In addition to RESTheart, Softinstigate also offers GART and GAPP services to its customers and is implementing a GraphQL API that is slated to go live Q1 2021.
Use case: executing RESTful multi-document transactions to create Palettes of Colors
A simple use case shows the power of RESTful multi-document transactions to execute transactions using very little code.
The client is an Angular app that interacts with the server via simple HTTP requests. The server stack comprises MongoDB and RESTHeart. RESTHeart exposes the REST API, which meets all the client’s needs to read and write data, both normally and transactionally. All of this occurs with no server-side code. The backend is a standard installation of RESTHeart that provides the API out of the box.
Figure 2 is a user screen view in RESTHeart. At left are buttons to control the execution of the transaction step-by-step. On the right are request logs showing interactions between client and server describing each REST request.
For this use case, data is stored in two collections: Palettes and Colors. Each Palette is composed of five Colors and is implemented by a property in Colors that references the corresponding palette. Creation of the Palette requires writing six documents across the two collections, and the application writes them through a multi-document transaction to enforce data consistency. As reflected in Figure 3, creating this app required only 37 lines of code.
Check out the public Github repo for this use case.
THE RESULTS
Nearly 100% availability supporting Softinstigate's dual go-to-market strategy
Today, all Softinstigate customer deployments are on MongoDB-driven RESTHeart running in the cloud on AWS. Unprompted, Turatti echoed the two-word assessment of MongoDB we continue to hear from other customers: “MongoDB is rock-solid!” Followed by: “We haven’t touched a relational database for six years.” He continued, “With Atlas you deploy it and it just works. It requires much less maintenance than with other databases, saving a great deal of time and money — and for a small team like ours, that is essential.”




