Skip to content

tma-comms/restheart

 
 

Repository files navigation

RESTHeart

The leading REST API Server for MongoDB.

Build Status Join the chat at https://gitter.im/SoftInstigate/restheart

Table of contents

Summary

RESTHeart connects to MongoDB and opens data to the Web: Mobile and JavaScript applications can use the database via RESTful HTTP API calls.

For an example, check our AngularJs Notes Example Application.

Note: RESTHeart has been tested against MongoDB v 2.6, 3.0 and now is mainly tested with 3.2 and 3.4.

Built on strong foundations

  • The API strictly follows the RESTful paradigm.
  • Resources are represented with the HAL+json format.
  • Built on top of Undertow web server.
  • Makes use of few, best of breed libraries, check the pom.xml!

Rapid Development

  • No server side development is required in most of the cases for your web and mobile applications.
  • The Setup is simple with convention over configuration approach; Docker Container and Vagrant Box are available.
  • Access Control and Schema Check are provided out of the box.

Production ready

  • High quality Documentation and active development community.
  • Severe Unit and Integration test suite, Code Check and Continuous Integration process.
  • Commercial Support available from SoftInstigate, the company behind RESTHeart.

Fast & Light

  • High throughput check the performance tests.
  • Lightweight ~10Mb footprint, low RAM usage, starts in ~1 sec.
  • Horizontally Scalable with Stateless Architecture and full support for MongoDB replica sets and shards.
  • µService: it does one thing and it does it well.

Test with Docker

If you have a Docker service running locally, you can be up and running with RESTHeart and MongoDB in few minutes. The POM includes a build configuration with the docker-maven-plugin and there's a docker folder with a Dockerfile and a docker-compose.yml file.

by default the MongoDB instance started by docker-compose does not use any named storage, please read carefully all comments within the docker-compose.yml file to enable a named data volume. Read Manage data in containers for more.

Steps:

$ mvn clean package docker:build
$ cd Docker
$ docker-compose up -d && docker-compose logs -f

The above steps will:

  1. Package the RESTHeart's JAR and invoke the docker plugin build process, which uses the included Dockerfile
  2. Start both RESTHeart and MongoDB as dockerized instances
  3. Tail the logs

Then you can open the HAL Browser at http://localhost:8080/browser

If you have cloned from master branch, you should notice that RESTHeart's running version is the same as the POM's version (e.g. 3.1.0-SNAPSHOT).

Properties

{
  "_size": 0,
  "_total_pages": 0,
  "_returned": 0,
  "_restheart_version": "3.1.0-SNAPSHOT",
  "_type": "ROOT"
}

This allow for a quick test cycle of new releases. Remember to cleanup things and remove all containers before exiting:

$ docker-compose stop
$ docker-compose rm

Documentation References

An Example

RESTHeart enables clients to access MongoDB via a HTTP RESTful API

In the following example, a web client sends an HTTP GET request to the /blog/posts URI and gets back the list of blog posts documents.

what restheart does

For more examples, check the API tutorial

Manual Installation

RESTHeart can be installed on any OS supporting Java.

Complete instruction at Installation and Setup documentation section.

Docker container and Vagrant box are also available.

How to run it

Running RESTHeart requires Java 8

Download the latest release from github releases page, unpack the archive and just run the jar.

$ java -server -jar restheart.jar

You might also want to specify a configuration file:

$ java -server -jar restheart.jar etc/restheart.yml

the restheart.yml configuration enables authentication: users, roles and permission are defined in etc/security.yml

How to build it

Building RESTHeart requires Maven.

Clone the repository and update the git submodules (the HAL browser is included in restheart as a submodule):

$ git submodule update --init --recursive

Build the project with Maven:

$ mvn clean package

Integration tests

Optionally you can run the integration test suite. Make sure mongod is running on localhost on default port 27017 without authentication enabled, i.e. no --auth option is specified.

$ mvn verify -DskipITs=false

Maven Dependencies

RESTHeart's releases are available on Maven Central.

Stable releases are available at:

https://oss.sonatype.org/content/repositories/releases/org/restheart/restheart/

If you want to embed RESTHeart in your project, add the dependency to your POM file:

<dependencies>
    <dependency>
        <groupId>org.restheart</groupId>
        <artifactId>restheart</artifactId>
        <version>2.0.2</version>
    </dependency>
</dependencies>

Snapshot builds

Snapshots are available at:

https://oss.sonatype.org/content/repositories/snapshots/org/restheart/restheart/

If you want to build your project against a development release, first add the SNAPSHOT repository:

 <repositories>
    <repository>
         <id>restheart-mvn-repo</id>
         <url>https://oss.sonatype.org/content/repositories/snapshots</url>
         <snapshots>
             <enabled>true</enabled>
             <updatePolicy>always</updatePolicy>
         </snapshots>
    </repository>
 </repositories>

Then include the SNAPSHOT dependency in your POM:

<dependencies>
    <dependency>
        <groupId>org.restheart</groupId>
        <artifactId>restheart</artifactId>
        <version>3.0.0-SNAPSHOT</version>
    </dependency>
</dependencies>

Development releases are continually deployed to Maven Central by Travis-CI.


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

About

RESTHeart, the automatic REST API Server for MongoDB

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%