Introduction to RESTHeart RESTHeart Cloud
What is RESTHeart?
RESTHeart is a framework for building cloud-native HTTP microservices. It’s designed for the JVM and optimized for GraalVM, using Java Virtual Threads for high-performance concurrent processing.
The key insight: RESTHeart has two faces, and understanding this distinction is crucial:
RESTHeart as a Ready-to-Use Platform
Out of the box, RESTHeart provides complete MongoDB APIs that work immediately:
-
REST API - Full CRUD operations, queries, aggregations, transactions
-
GraphQL API - Flexible queries with automatic MongoDB integration
-
WebSocket API - Real-time data with change streams
-
Security - Built-in authentication and authorization
No coding required. You can build complete applications using just HTTP requests and configuration.
RESTHeart as an HTTP Framework
RESTHeart is also a powerful framework for building custom services:
-
Develop plugins in Java, Kotlin, JavaScript, or TypeScript
-
Four simple building blocks: Services, Interceptors, Providers, Initializers
-
Starts in ~100 milliseconds for fast development cycles
-
Each request runs in a dedicated virtual thread (simple, scalable code)
-
Powerful dependency injection
Write custom code when you need functionality beyond the standard MongoDB APIs.
RESTHeart features set
How RESTHeart Works
Architecture
RESTHeart consists of:
-
restheart-core - The runtime process that:
-
Parses configuration
-
Registers plugins
-
Enforces security policies
-
Routes requests to services
-
Executes interceptors
-
-
Standard Plugins - Pre-built functionality in the
pluginsdirectory:
plugins
├── lib/ # Plugin dependencies
├── restheart-graphql.jar # GraphQL API
├── restheart-metrics.jar # Metrics and monitoring
├── restheart-mongoclient-provider.jar # MongoDB connection
├── restheart-mongodb.jar # REST API for MongoDB
├── restheart-polyglot.jar # JavaScript/TypeScript support
└── restheart-security.jar # Authentication & Authorization
-
Your Custom Plugins (optional) - Add JAR files or JavaScript directories
RESTHeart modular architecture
Who Should Use RESTHeart?
You Need a MongoDB API (No Coding)
Use case: Build mobile apps, web apps, or integrations that need to access MongoDB.
What you’ll use: - Part 2: MongoDB REST API - Part 3: GraphQL & WebSocket APIs - Part 4: Security - Part 5: Configuration & Deployment
Example: A mobile app that needs CRUD operations, user authentication, and real-time updates.
You’re Building Custom HTTP Services
Use case: Build microservices with custom business logic.
What you’ll use: - Part 6: Framework (Plugin Development) - Part 7: Security Plugins (if needed)
Example: An HTTP API that processes payments, sends emails, or integrates with third-party services.
You Need Both
Use case: Use the MongoDB API for data operations, plus custom services for business logic.
What you’ll use: Everything!
Example: An e-commerce platform using the MongoDB API for products/orders, plus custom services for payment processing and inventory management.
Why RESTHeart?
Speed and Ease
RESTHeart prioritizes speed and simplicity. It’s built with high-quality libraries to provide a seamless developer experience.
Virtual Threads for Superior Performance
RESTHeart fully embraces virtual threads, the groundbreaking feature introduced in Java 21. Virtual threads deliver remarkable performance and efficiency improvements:
-
Faster execution
-
Lower memory footprint
-
Simpler concurrent code
-
Better resource utilization
This keeps RESTHeart at the forefront of high-performance, scalable frameworks.
Instant APIs Out of the Box
For many applications, you just need: - Data access - REST/GraphQL/WebSocket APIs for MongoDB - Security - Authentication and authorization - Configuration - Connect to your database
Most applications require exactly this. Run a stock RESTHeart instance with zero code!
|
Tip
|
Check the demo Web Chat application. It requires zero lines of backend code. |
Built for Developers
When you need custom functionality, RESTHeart makes plugin development simple:
Hello World 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!"));
}
}
Hello World 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 runs in a thread-safe, multi-threading environment. No async/await, promises, or callbacks required. Just clean, simple code. |
Key Features
-
Declarative Security - Configure authentication and authorization without code
-
Instant MongoDB APIs - REST, GraphQL, and WebSocket
-
Polyglot - Java, Kotlin, JavaScript, TypeScript
-
High Performance - Hundreds of thousands of requests per second
-
Cloud-Ready - Docker, Kubernetes, GraalVM native images
-
Fully Extensible - Simple plugin system
What Makes RESTHeart Different?
RESTHeart is similar to frameworks like Undertow (which RESTHeart uses internally), Vert.x, Quarkus, Spring Boot, and Node.js.
The difference: RESTHeart includes application-level features, not just framework primitives.
-
Other frameworks require you to implement authentication, database access, API design, security
-
RESTHeart provides these features ready to use, and lets you customize when needed
Deployment Options
RESTHeart runs anywhere Java runs:
-
Standalone JAR -
java -jar restheart.jar -
Docker -
docker run softinstigate/restheart -
Kubernetes - Deploy with standard manifests
-
GraalVM Native - ~40MB native binary, instant startup
-
Cloud Platforms - AWS, GCP, Azure
Licensing
RESTHeart is dual-licensed:
-
AGPL - Free and open source (no feature restrictions)
-
Enterprise License - Business-friendly license for closed-source products
What’s Next?
Ready to get started?
Or continue reading:
-
Installation Guide - Detailed setup instructions
-
Core Concepts - Understanding RESTHeart’s architecture
-
Security Fundamentals - How security works