RESTHeart - a Java runtime for microservices 
Tags: java, microservices, mongodb, webdev
Published: 2020-11-23 14:20:16

In 2014 we had long realized that both Java application servers and frameworks force people to invest a lot of time in their configuration and maintenance, comparing to what is usually invested in the implementation of actual functionalities.

For these reasons, at [our company](https://www.softinstigate.com) we started developing an open-source product called [RESTHeart](https://restheart.org), in order to investigate more rational ways to build applications. It was born as a summer experiment and it became an increasingly focused and robust product in the following years.

## What RESTHeart actually does, in a minute

[RESTHeart](https://restheart.org) is a Java open source runtime for microservices. It leverages MongoDB to provide a instant persistence data API.

- Instant REST API with MongoDB;
- Built-in Authentication and Authorization;
- Elegant Java and Kotlin Framework to extend the API.

RESTHeart is tailored for JVM, Docker and Kubernetes, designed to radically simplify server-side development and deployment.

- Ready-to-run stateless Microservice;
- Available as binary and Docker container;
- Deploy both on Cloud and on-premises.

RESTHeart is a "low code" development platform: you can get most of the mandatory server-side functionalities usually required by any Web and Mobile application with just configuration.

RESTHeart allows to create REST Web Services in minutes: implement a simple Java interface and deploy the web service by copying its JAR file into the plugins directory.

```java
@RegisterPlugin(name = "greeterService", 
    description = "sends a greetings message",
    defaultURI = "/greetings")
public class GreeterService implements JsonService {
    @Override
    public void handle(JsonRequest request, JsonResponse response) {
        if (request.isGet()) {
            var content = new JsonObject();
            content.addProperty("message", "Hello World!");
            response.setContent(content);
        } else {
            response.setStatusCode(400);
        }
    }
}
```

The main advantage with RESTHeart is that you can immediately write and read data into a MongoDB database using just HTTP. Your JSON will travel untouched from the client to the database and back.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/v264vykowkqjljspi9ie.png)

## Specifications

- Written in Java 11
- Built on top of RedHat’s [Undertow](https://undertow.io) non-blocking HTTP server.
- Uses MongoDB and compatible databases for data persistence.
- Fully stateless.
- Can be packaged as a [Docker container](https://hub.docker.com/r/softinstigate/restheart).
- Can be easily deployed both on Cloud and on premises.

## Main features

RESTHeart unlocks all the capabilities of MongoDB.
It can also connect to Mongo Atlas Cloud, Amazon DocumentDB, Microsoft Azure CosmosDB and Percona Server for MongoDB.

For a complete list of features please go to [this page](https://restheart.org/features).

## Try online

You can try a simple Angular Web application [here](https://restheart.org/docs/try/).

## Examples 

[This repository](https://github.com/SoftInstigate/restheart-examples) provides examples on how to extend RESTHeart with Java or Kotlin plugins:

## Source code

The full source code is available on [GitHub](https://github.com/SoftInstigate/restheart).