• Stars
    star
    800
  • Rank 56,950 (Top 2 %)
  • Language
    Java
  • License
    GNU Affero Genera...
  • Created about 10 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Rapid API Development with MongoDB

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 provides:

  1. Out of the box data persistence on MongoDB and any compatible database, like AWS DocumentDB or Azure Cosmos DB, with REST, GraphQL and WebSocket APIs.
  2. Declarative authentication, authorization and user management for your applications.
  3. Polyglot development framework supporting Java, Kotlin, JavaScript and TypeScript.

With RESTHeart you can access 100% of MongoDB capabilities with plain HTTP calls, no programming is needed!

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

At startup, RESTHeart connects automatically to the configured MongoDB database and exposes it via a complete API. See the below example session that uses HTTPie for REST calls:

RESTHeart in action

Developers can save at least 80% of backend code to manage security and serve content to Mobile Apps, Angular, React, Vue or other 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 (at the moment from MongoDB 3.6 to 6.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 features

RESTHeart embeds Undertow, a flexible and performant web server written in Java, providing both blocking and non-blocking HTTP API’s based on NIO. Undertow is the underlying HTTP server of RedHat's Wildfly.

RESTHeart works out-of-the-box by merely installing and configuring it. It is particularly suitable to run as a Docker container, so it works perfectly in Kubernetes and AWS ECS clusters.

RESTHeart also supports GraalVM, a new Java Virtual Machine from Oracle that offers a polyglot runtime environment and the ability to compile Java applications to native binary images.

The internal architecture is based on plugins and exposes an API that allows to implement additional custom services in Java, Kotlin, JavaScript or TypeScript.

To extend the default behavior you can implement the following Java interfaces:

  • Service - extend the API adding Web Services.
  • Interceptor - snoop and modify requests and responses at different stages of the request lifecycle.
  • Initializer - execute initialization logic at startup time.
  • Providers - implement the Dependency Injection mechanism to provide objects to other plugins via the @Inject annotation.

The GraphQL default plugin works side by side with the already existing REST endpoints to get a managed, unified GraphQL API for modern applications.

The embedded WebSocket server can expose MongoDB's Change Streams, which allow applications to access real-time data changes.

For all these reasons, RESTHeart is the perfect "low code", self-contained backend for modern Web and Mobile apps, designed to radically simplify development and deployment.

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 <[email protected]>
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.

More Repositories

1

serverless-docker

A docker container for running serverless commands
Shell
29
star
2

graalvm-maven-docker

A docker image for GraalVM and Maven built with sdkman from debian:buster-slim
Dockerfile
21
star
3

restheart-notes-example

Example notes application built with RESTHeart, AngularJS and restangular
CSS
12
star
4

http-shell

HTTP Shell is a CLI tool based on the Kui framework that provides developers a modern alternative to http clients for interacting with APIs.
TypeScript
12
star
5

restheart-blog-example

Example blog application built with RESTHeart and AngularJS
JavaScript
9
star
6

restheart-security

Authorization and Authentication microservice for RESTHeart
Java
8
star
7

angular-restheart

AngularJS client module for RESTHeart
JavaScript
8
star
8

restheart-examples

Examples on how to extend RESTHeart with plugins.
Java
8
star
9

maven-aws-docker

A docker image for Maven with AWS and ECS CLI tools
Shell
5
star
10

restheart-vagrant

Vagrant box for RESTHeart + MongoDB
Shell
5
star
11

restheart-webchat

A web chat implemented in Angular leveraging RESTHeart change streams feature
HTML
5
star
12

lektor-docker

Docker container for running Lektor CMS https://www.getlektor.com
Dockerfile
5
star
13

restheart-mobile-example

a simple hybrid mobile app example with restheart and ionic
JavaScript
4
star
14

restheart-website

restheart.org main website
SCSS
4
star
15

restheart-gcloud

How to deploy RESTHeart, the REST API Server for MongoDB, on Google Cloud Container Engine.
4
star
16

classgraph-on-graalvm

This repo demonstrates how to build a native image of a java application that uses ClassGraph with GraalVM
Java
3
star
17

restheart-plugin-skeleton

Skeleton project for developing RESTHeart plugins
Java
2
star
18

ermes-mail

ErmesMail is a Java library and command line interface for sending e-mail messages asynchronously
Java
2
star
19

nginx-restheart

Example of NGINX as a SSL frontend for RESTHeart.
2
star
20

lektor-gulp

A simple Lektor CMS plugin for gulp
Python
1
star
21

restheart-python-test

A set of integration tests showing how to interact with RESTHeart's API via Python.
Python
1
star
22

restheart-gatsby

JavaScript
1
star
23

restheart-ng-demo

An example Angular 12 webapp that uses RESTHeart
TypeScript
1
star
24

restheart-customization-examples

RESTHeart's customization examples
Java
1
star