Looking for Cloud Services or Professional Support? Check restheart.com


Download Read the Docs Try Online

Low code platform for building cloud-native HTTP microservices

With Polyglot Development Framework, Declarative Access Control
and Instant Data APIs on MongoDB

Blazing fast Instant REST, GraphQL and WebSocket API on MongoDB Develop custom Web Services Handle Users and Permissions with no code Extensible with Java, Kotlin, JavaScript & TypeScript Deliver any content to the Web Available as a Docker image Run and build it with java or as a native binary Proxy External Resources Notify clients with Hooks Threat protection at every layer

Featured on MongoDB.com

RESTHeart API for MongoDB simplifies development and frees you to focus on delivering great user experiences


Build modern apps

RESTHeart connects automatically to MongoDB or any compatible database (e.g. Percona Server for MongoDB, AWS DocumentDB and Azure Cosmos DB) exposing all database's features through a comprehensive set of web services.

  • Instant REST, GraphQL and WebSocket API
  • Built-in Authentication and Authorization
  • Java, Kotlin, JavaScript and TypeScript Framework to extend the API

Setup in minutes

RESTHeart fully supports GraalVM, a new virtual machine from Oracle that offers a polyglot runtime environment and the ability to compile Java applications to native images. RESTHeart is also available as a Docker image, so it works perfectly in Kubernetes and AWS ECS.

  • Ready-to-run stateless Microservice
  • Available as JAR, native binary and Docker image
  • Deployable both on cloud and on premises

Ready to use data API for MongoDB

Query documents from the command line with httpie.

The GET request has two query parameters: filter to apply a query and pagesize to limit the response to one document.
Here we use the brilliant httpie, a modern command line HTTP client.

More examples
$ http -b GET https://demo.restheart.org/messages'?filter={"from":"Bob"}&pagesize=1'

        "_id": {
            "$oid": "5c50963e477870eb8258fa68"
        "from": "Bob",
        "message": "was here"

Query documents from the command line with cURL.

The GET request has two query parameters: filter to apply a query (that needs to be encoded with --data-urlencode option since it contains the curly brackets) and pagesize to limit the response to one document.
Here we use the immortal cURL!

More examples
$ curl -G --data-urlencode 'filter={"from":"Bob"}' https://demo.restheart.org/messages?pagesize=1

        "_id": {
            "$oid": "5c50963e477870eb8258fa68"
        "from": "Bob",
        "message": "was here",

Query documents with JavaScript.

The GET request has two query parameters: filter to apply a query and pagesize to limit the response to one document.
Here we use the fetch API.

Run it
const url = encodeURI('https://demo.restheart.org/messages?filter={"from":"Bob"}&pagesize=1');

  .then(response => response.json())
  .then(json => JSON.stringify(json, null, 2))
  .then(docs => console.log(docs));

Query documents with Java.

The GET request has two query parameters: filter to apply a query and pagesize to limit the response to one document.
Here we use the unirest java http library.

More examples
public void printOutMessages() throws UnirestException {
    var resp = Unirest.get("https://demo.restheart.org/messages")
            .queryString("filter", "{'from':'Bob'}")
            .queryString("pagesize", "1")

    // print out each message
    resp.getBody().getArray().forEach(msg -> System.out.println(msg.toString()));

Query documents with Swift.

The GET request has two query parameters: filter to appy a query and pagesize to limit the response to one document.
Here we use the JSONSerialization to parse the response body.

More examples
import UIKit
import PlaygroundSupport

var urlComponents = URLComponents(string: "https://demo.restheart.org/messages")

// set the query parameters
var queryItems = [URLQueryItem]()
queryItems.append(URLQueryItem(name: "pagesize", value: "1"))
queryItems.append(URLQueryItem(name: "filter", value: "{\"from\":\"Bob\"}"))
urlComponents?.queryItems = queryItems

var urlRequest = URLRequest(url: (urlComponents?.url)!)

// set request method
urlRequest.httpMethod = "GET"

URLSession.shared.dataTask(with: urlRequest) { (data, response, error) in
    guard let dataResponse = data, error == nil
    else {
        print(error?.localizedDescription ?? "Response Error")

    do {
        let jsonResponse = try JSONSerialization.jsonObject(with: dataResponse, options: [])
    } catch let jsonError {

// only needed in playground
PlaygroundPage.current.needsIndefiniteExecution = true

Java, Kotlin and JavaScript framework to extend the API

Implement web services in minutes.

Implement a simple interface and deploy the web service by copying its jar file into the plugins directory.

See it on GitHub More examples
@RegisterPlugin(name = "greetings", description = "just another Hello World")
public class GreeterService implements JsonService {
    public void handle(JsonRequest req, JsonResponse res) {
        switch(req.getMethod()) {
            case GET -> res.setContent(object().put("message", "Hello World!"));
            case OPTIONS -> handleOptions(req);
            default -> res.setStatusCode(HttpStatus.SC_METHOD_NOT_ALLOWED);

Implement plugins in Kotlin.

You can use Java and Kotlin to implement plugins.

Kotlin Service example
@RegisterPlugin(name = "kotlinGreeterService", description = "just another Hello World in Kotlin")
class GreeterService : JsonService {
    override fun handle(request: JsonRequest, response: JsonResponse) {
        if (request.isGet) {
            var greetings = JsonObject()
            greetings.addProperty("msg", "Hello World")
            response.content = greetings;
        } else {
            response.statusCode = 400;

Snoop and modify requests at different stages of their lifecycle.

This interceptor applies to requests of the hello web service adding a timestamp to the response content.
Interceptor can be executed at different points of the request as defined by the interceptPoint parameter of the annotation RegisterPlugin

More examples
@RegisterPlugin(name = "helloInterceptor",
    description = "add a timestamp to the response of /greetings",
    interceptPoint = InterceptPoint.RESPONSE)
public class HelloInterceptor implements JsonInterceptor {
    public void handle(JsonRequest request, JsonResponse response) {
            .addProperty("timestamp", Instant.now().toString());

    public boolean resolve(JsonRequest request, JsonResponse response) {
        return request.isHandledBy("greetings");

Implement plugins in JavaScript.

This is yet another Hello World web service.
Running RESTHeart on the GraalVM allows you to deploy JavaScript Services and Interceptors.

More examples
export const options = {
    name: "helloWorldService",
    description: "just another Hello World",
    uri: "/hello"

export function handle(request, response) {
    response.setContent(JSON.stringify({ msg: 'Hello World' }));

Introducing HTTP Shell

A modern CLI alternative for developers for interacting with APIs and the perfect companion for RESTHeart.

A new Open Source gem from SoftInstigate


Trusted by Startups and Corporations

Widely Adopted

RESTHeart Docker image's pulls

Our speech about RESTful MongoDB Transactions at MongoDB Live 2020