Get Started with RESTHeart
RESTHeart is a modern, JVM/GraalVM based, platform for building cloud-native HTTP microservices
Note
|
An HTTP microservice is a server-side, lightweight component that exposes an HTTP API. Clients interact with it only through HTTP requests, usually - but not exclusively - using JSON payloads, decoupling the client from the underlying technology and completely separating the presentation from the business logic. |
RESTHeart is designed from ground for speed and simplicity and crafted from few, best of breed libraries.
The philosophy of RESTHeart is to provide developers with a pleasant framework on one side and the common features required by any application, on the other.
This makes RESTHeart a low code platform, since it comes with ready-to-use, yet extensible APIs.
RESTHeart features set
What makes RESTHeart different from other frameworks?
RESTHeart is a framework for building HTTP microservices comparable to others, like Undertow (that is actually internally used by RESTHeart), Vert.x, Quarkus, Spring Boot, Node.js, etc.
However RESTHeart does not only comprises a framework, but also a set of application level features that allow developers to build their applications without the need to reinvent the wheel.
RESTHeart modular architecture
restheart-core
is the foundation of the platform, the runtime process responsible for handling the core services, parsing the configuration, registering the plugins, enforce the security policy, route requests to the correct Services
, executing Interceptors
and Initializers
.
If you look at the restheart installation directory structure, you will notice a directory called plugins
:
plugins
├── restheart-graphql.jar
├── restheart-mongodb.jar
├── restheart-polyglot.jar
└── restheart-security.jar
Those plugins implement application level functionalities that help building applications.
For instance, the plugin restheart-mongodb
implements the REST API for MongoDB and restheart-security.jar
implements the ready-to-use Authentication and Authorization features.
A developer can easily deploy a custom plugin, by just adding it into the plugins
directory. The plugin is just a JAR file, in case of Java or Kotlin and a directory with its package.json
file in case of JavaScript.
Built for developers
RESTHeart is built for developers by developers and evolved by implementing dozens of real world projects and following one golden rule: if it is complex, it is wrong.
-
Only four, simple yet powerful building blocks:
Services
,Intreceptors
,Providers
andInitializers
. -
Starts in 100~ msecs, so code-deploy-test cycles are smooth and fast.
-
Each request is handled in a dedicated thread, so all code is thread-safe, simple to write and maintain and scales well.
-
Custom code can consume properties from the
yml
configuration file. -
The framework is polyglot and supports Java, Kotlin, JavaScript and Typescript.
-
Well documented with many examples and tutorials available. Check plugin examples.
Here you have the Hello World example in Java:
@RegisterPlugin(name = "greetings", description = "just another Hello World")
public class GreeterService implements JsonService {
@Override
public void handle(JsonRequest request, JsonResponse response) {
response.setContent(object().put("message", "Hello World!"));
}
}
And the same in Javascript
export const options = { name: "greetings", description: "just another Hello World" }
export function handle(request, response) {
response.setContent(JSON.stringify({ msg: 'Hello World' }));
response.setContentTypeAsJson();
}
Note
|
Javascript is executed in a thread safe, multi-threading concurrency environment. So you don’t need to deal with async/await, promises, observable or any other fancy stuff. Just clean and simple code. |
Features
RESTHeart provides developers with the features required by most applications: authentication/authorization and data management:
-
Declarative Authentication and Authorization.
-
Instant REST, GraphQL and WebSocket API for MongoDB.
-
SDK to easily develop custom features.
Note
|
Most applications just require this. Then you just run a stock RESTHeart. Really, no code! |
Tip
|
Check the demo Web Chat application. It requires zero lines of backend code. |
The perfect MongoDB’s companion
RESTHeart is the best API for MongoDB (and AWS DocumentDB and Azure CosmosDB)
-
It exposes full database’s capabilities via REST, GraphQL and WebSocket APIs.
-
Developers don’t need to write a single line of backend code to handle data and wit Mobile Apps, Web Apps or Integration Middleware.
-
The Instant Data API cuts development complexity and costs up to 90%.
MongoDB features supported by RESTHeart
Extreme Performances
Hundreds of thousands TPS
RESTHeart parallel architecture provides superior performances. Read More
Horizontal scaling
RESTHeart is fully stateless and allows clustering, to reach demanding requirements. Read More
Even faster on GraalVM
RESTHeart on GraalVM provides a native solution with instant startup time and smaller memory footprint. This is perfect when deploying to Kubernetes clusters, where regular Java applications usually consume too many resources.
Deploy at rest
RESTHeart is tailored for the JVM, GraalVM, Docker or Kubernetes, designed to radically simplify microservices development and deployment.
-
Ready-to-run Runtime.
-
Available as a standalone JAR file, native binary or Docker image.
-
Deploy it on Cloud and On-Premises.
Dual licensed
RESTHeart is dual-licensed under the AGPL and a Business Friendly Enterprise License
-
Enjoy the free AGPL distribution without feature restrictions.
-
Rely on the Enterprise License for production-grade support and to use RESTHeart in closed source products or services Read More.