Skip to content

SoftInstigate/restheart

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

RESTHeart - Ready to use backend for the modern Web.

REST, GraphQL and WebSocket APIs for MongoDB.

GitHub last commit Github stars Maven Central Docker Pulls Join the chat on Slack

RESTHeart offers the following features:

  1. Out-of-the-box data persistence on MongoDB as well as compatible databases such as AWS DocumentDB or Azure Cosmos DB, all accessible through REST, GraphQL, and WebSocket APIs.

  2. Declarative authentication, authorization, and user management for your applications.

  3. A polyglot development framework that supports Java, Kotlin, JavaScript, and TypeScript.

With RESTHeart, you can harness 100% of MongoDB's capabilities using simple HTTP calls, eliminating the need for programming!

Note: Schedule a free 1-to-1 demo and feel free to ask us anything!

During startup, RESTHeart automatically establishes a connection to the configured MongoDB database and provides comprehensive API access. Refer to the example session below, which employs HTTPie for making REST calls:

See RESTHeart in action

Developers can reduce backend code by at least 80% when managing security and delivering content to mobile apps, Angular, React, Vue, or other single-page application (SPA) frameworks.

RESTHeart use cases

Supported databases

RESTHeart works with any MongoDB compatible database. The actual features supported depend on the level of compatibility of the database with the official MongoDB Java driver.

Note: RESTHeart releases are tested in continuous integration with official MongoDB distributions only (from MongoDB 4.2 to 7.0).

  • MongoDB Community, Enterprise and Atlas Cloud are 100% supported in all their functionalities.
  • Azure Cosmos DB and Amazon DocumentDB offer partial support for the MongoDB API, but most common RESTHeart features work as expected.
  • FerretDB offers partial support for the MongoDB API on top of PostgreSQL, but its level of compatibility with MongoDB is growing daily. FerretDB plans to support more relational databases in the future.
  • Percona Server for MongoDB is, in general, fully compatible with MongoDB, so RESTHeart usually works perfectly with it.

Advanced Capabilities

RESTHeart incorporates Undertow, a versatile and high-performance web server crafted in Java. Undertow furnishes both blocking and non-blocking HTTP APIs built upon NIO. Notably, Undertow serves as the foundational HTTP server for RedHat's Wildfly.

Setting up RESTHeart is effortless, as it operates seamlessly after installation and configuration. It is exceptionally well-suited for deployment within a Docker container, making it a natural fit for deployment in Kubernetes and AWS ECS clusters.

RESTHeart additionally provides support for GraalVM, an innovative Java Virtual Machine developed by Oracle. GraalVM introduces a polyglot runtime environment and the ability to compile Java applications into native binary images.

The internal architecture relies on a system of plugins, exposing an API that empowers the implementation of custom services in Java, Kotlin, JavaScript, or TypeScript.

To enhance the default functionality, you can implement the following Java interfaces:

  • Service - Expands the API by introducing new web services.
  • Interceptor - Observes and modifies requests and responses at various stages of the request lifecycle.
  • Initializer - Executes initialization logic during startup.
  • Providers - Implements the Dependency Injection mechanism to supply objects to other plugins using the @Inject annotation.

The default GraphQL plugin seamlessly coexists with the existing REST endpoints, yielding a managed and unified GraphQL API tailored for modern applications.

Furthermore, the embedded WebSocket server can expose MongoDB's Change Streams, permitting applications to access real-time data alterations.

Given these considerations, RESTHeart emerges as the ideal "low code," self-contained backend solution for contemporary web and mobile applications. Its design is centered on streamlining development and deployment processes.

Download

Download prebuilt packages from releases

Find setup instructions at Setup documentation page.

Build from source

Note: Building RESTHeart from scratch requires at least Java 17 and maven 3.6.

$ ./mvnw clean package

You can then run it with (make sure to have mongod running on localhost:27017):

$ java -jar core/target/restheart.jar

Execute the integration tests suite

To execute the integration test suite:

$ ./mvnw clean verify

The verify goal starts the RESTHeart process and a MongoDB Docker container before running the integration tests.

To avoid starting the MongoDB Docker container, specify the system property -P-mongodb.

The integration tests use the MongoDB connection string mongodb://127.0.0.1 by default. To use a different connection string, specify the property test-connection-string.

The following example shows how to run the integration test suite against an instance of FerretDB running on localhost.

# run FerretDB
$ docker run -d --rm --name ferretdb -p 27017:27017 ghcr.io/ferretdb/all-in-one
# execute the integration tests
$ ./mvnw clean verify -DskipUTs -P-mongodb -Dtest-connection-string="mongodb://username:password@localhost/ferretdb?authMechanism=PLAIN" -Dkarate.options="--tags ~@requires-replica-set"

This example also specifies the karate options to skip tests tagged with requires-replica-set (FerretDB does not supports change stream and transactions) and -DskipUTs to skip the execution of unit tests.

Automatic snapshot builds

Snapshot builds are available from sonatype.org

Docker images of snapshots are also available:

$ docker pull softinstigate/restheart-snapshot:[commit-short-hash]

For commit short hash you need the first 7 digits of the hash, e.g.

$ git log

commit 2108ce033da8a8c0b65afea0b5b478337e44e464 (HEAD -> master, origin/master, origin/HEAD)
Author: Andrea Di Cesare <andrea@softinstigate.com>
Date:   Fri Oct 22 12:46:00 2021 +0200

    :bookmark: Bump to version 6.2.0-SNAPSHOT

...

The short hash is 2108ce0 and the docker pull command is therefore

$ docker pull softinstigate/restheart-snapshot:2108ce0

Documentation

The full documentation is available here.

You can also have a look at our introductory video on Youtube:

Watch the video!

Contacts and Support

Become a Sponsor

You can support the development of RESTHeart via the GitHub Sponsor program and receive public acknowledgment of your help.

Go and see available sponsor tiers.

Sponsors


Made with ❤️ by SoftInstigate. Follow us on Twitter.