Skip to content

SoftInstigate/restheart

Repository files navigation

RESTHeart - Low-Code API Server and Framework

✅ Develop your backend in minutes
✅ Instant REST, GraphQL, and Websockets APIs for MongoDB
✅ Declarative security with no code required
✅ Powered by Java Virtual Threads
✅ Based on the super-fast Undertow HTTP engine
✅ Designed for Docker and Kubernetes Microservices

GitHub last commit Build snapshot release Github stars Maven Central Version Docker Pulls Join the chat on Slack

RESTHeart is solution for developing microservices, offering a robust and efficient framework built on top of Undertow, a high-performance web server written in Java providing both blocking and non-blocking API’s based on NIO. RESTHeart leverages Java Virtual Threads, which are lightweight threads designed to simplify the writing, maintaining, and debugging of high-throughput concurrent applications.

RESTHeart simplifies and accelerates the development process by exposing the full capabilities of MongoDB through REST, GraphQL, and Websockets APIs, all without requiring backend code. This significantly reduces development time. It supports MongoDB, Mongo Atlas, Percona Server, FerretDB, AWS DocumentDB, and Azure CosmosDB.

RESTHeart also provides comprehensive authentication and authorization services, supporting various security schemes. It enables the management of users, roles, and permissions directly within MongoDB collections, eliminating the need for backend code and further streamlining the development process.

Documentation

The full documentation is available on restheart.org/docs.

If you want to play with the APIs, you can start from:

Installation

Refer to the documentation sections Setup or Setup with Docker.

One-liner to run RESTHeart with Docker:

curl https://raw.githubusercontent.com/SoftInstigate/restheart/master/docker-compose.yml --output docker-compose.yml && docker compose up --attach restheart

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.

Software Development Framework

RESTHeart offers a SDK to develop custom plugins. A plugin in RESTHeart is a software component that enhances the API by adding new features and capabilities. RESTHeart supports creating plugins in Java, Kotlin or any language supported by the JVM and JavaScript or any language supported by GraalVM.

There are four types of plugins in RESTHeart:

  1. Service: These plugins add new web services to the API.
  2. Interceptor: These plugins monitor and modify requests and responses at various stages of the request lifecycle.
  3. Initializer: These plugins run initialization logic during system startup.
  4. Provider: These plugins supply objects to other plugins using the @Inject annotation.

Additionally, security plugins can be developed to customize the security layer.

Build from source

Build the thin JAR:

$ ./mvnw clean package

Build the fat JAR:

$ ./mvnw clean package -Pshade

Then you can check the build version:

$ java -jar core/target/restheart-core.jar -v
RESTHeart Version 8.0.7-SNAPSHOT Build-Time 2024-07-17

Run

Start MongoDB on localhost:27017 and then run RESTHeart with:

$ 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

Community Support

Sponsors


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