Edit Page

Get Started with RESTHeart v8

RESTHeart is a cutting-edge platform for building cloud-native HTTP microservices, leveraging Java Virtual Threads for enhanced performance and scalability. It is built for the JVM and GraalVM.

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.

Speed and Ease

RESTHeart prioritizes speed and simplicity, carefully crafted with top-notch libraries for a seamless developer experience.

Embraces Virtual Threads for Superior Performance

RESTHeart is the first framework to fully embrace the use of virtual threads, a groundbreaking feature introduced in Java 21. By leveraging virtual threads, RESTHeart achieves remarkable improvements in performance and efficiency. This innovative model makes RESTHeart faster, more lightweight, and simplifies the development of concurrent code. Virtual threads allow for better resource utilization and significantly reduce the complexity associated with concurrent programming, ensuring that RESTHeart remains at the forefront of high-performance, scalable frameworks.

Empower Developers, Streamline Applications

RESTHeart aims to empower developers with an intuitive framework encompassing essential features. This approach positions RESTHeart as a true low-code platform, offering developers customizable APIs that are ready to go.

Plug-and-Play, Extendable APIs

Save time and effort with RESTHeart’s pre-configured APIs, covering a broad range of functionality. These APIs are highly customizable to fit your specific application needs.

RESTHeart features set

What makes RESTHeart different from other frameworks?

RESTHeart is a framework for building HTTP microservices comparable to others, like Undertow (internally used by RESTHeart), Vert.x, Quarkus, Spring Boot, Node.js, etc.

However, RESTHeart does not only comprise 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, enforcing the security policy, resolving dependency injections with the available Providers, routing 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-mongoclient-provider.jar
├── restheart-mongodb.jar
├── restheart-polyglot.jar
└── restheart-security.jar

Those plugins implement application-level functionalities that help build 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 the case of Java or Kotlin and a directory with its package.json file in the case of JavaScript.

Built for developers

RESTHeart is built for developers by developers and evolved by implementing dozens of real-world projects.

  • Only four, simple yet powerful building blocks: Services, Providers Interceptors and Initializers.

  • Starts in 100~ milliseconds, 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.

  • Powerful Dependency Injection via @Inject annotation and Provider plugin.

  • 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.

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 any compatible database (like FerretDB, AWS DocumentDB and Azure CosmosDB).

  • It exposes the 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 with Mobile Apps, Web Apps or Integration Middleware.

  • The Instant Data API cuts development complexity and costs by up to 90%.

MongoDB features supported by RESTHeart

Extreme Performances

Hundreds of thousands TPS

RESTHeart parallel architecture provides superior performance. 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 a 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.

Open-source and business-friendly licenses

RESTHeart is dual-licensed under the AGPL and a Business Friendly Enterprise License.

  • Use 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.