What is RESTHeart?

The Backend Framework That Transforms MongoDB Into Instant APIs

Modern application development often requires rapid iteration and reduced architectural complexity. RESTHeart is a backend framework that provides automatic API generation for MongoDB databases, eliminating the need for manual endpoint implementation.

What is RESTHeart?

The Problem: MongoDB Needs a Backend

MongoDB is an excellent database, but exposing it through REST or GraphQL APIs traditionally requires writing significant backend code. You need to:

  • Build CRUD endpoints for each collection
  • Implement authentication and authorization
  • Handle request validation and error responses
  • Set up API documentation
  • Configure monitoring and logging
  • Deploy and scale your backend infrastructure

This boilerplate work represents significant development overhead that could be allocated to application-specific functionality.

The Solution: RESTHeart Turns MongoDB Into Instant APIs

RESTHeart is a Java backend framework that exposes MongoDB databases through REST, GraphQL, and WebSocket APIs without requiring custom backend code implementation.

Simply connect RESTHeart to your MongoDB instance, and you immediately get:

  • Full CRUD operations via REST
  • GraphQL queries and mutations
  • Real-time data streaming via WebSocket
  • Built-in authentication and authorization
  • Role-based access control
  • Request validation
  • Metrics and monitoring

Example: Querying MongoDB from the Browser

You can start querying your data right away, using any HTTP client — no SDKs or special libraries needed.

For example, you can fetch MongoDB documents directly from the browser with just a few lines of JavaScript:

const url = encodeURI('https://demo.restheart.org/messages?filter={"from":"Bob"}&pagesize=1');

fetch(url)
  .then(response => response.json())
  .then(json => JSON.stringify(json, null, 2))
  .then(docs => console.log(docs));

This simplicity enables rapid development: developers can build production-ready APIs in minutes, then extend them with custom business logic using the plugin system.

Build in Minutes, Extend Forever

RESTHeart follows a two-phase development approach:

Phase 1: Zero-Code APIs
APIs can be deployed in approximately 30 seconds by connecting RESTHeart to a MongoDB instance. This approach is suitable for prototypes, MVPs, and rapid validation scenarios.

Phase 2: Custom Extensions
Custom business logic can be implemented through RESTHeart's plugin system, which supports:

  • Custom services and endpoints
  • Request/response interceptors
  • Validators and transformers
  • Authentication mechanisms
  • Authorization logic

This architecture allows developers to implement only application-specific logic rather than repetitive infrastructure code.

Who Should Use RESTHeart?

RESTHeart is well-suited for:

Rapid Prototyping and MVPs
RESTHeart enables API deployment in minutes rather than days, allowing early validation of architectural decisions before implementing custom backend solutions.

Microservices Architectures
RESTHeart can serve as a data access layer for MongoDB databases within microservices architectures, providing secure, performant APIs without requiring repetitive CRUD code implementation.

Extending MongoDB with Custom Logic
For projects requiring MongoDB as a database with custom Java services, RESTHeart provides both automatic data APIs and extensibility through its plugin system.

Development Teams Prioritizing Velocity
RESTHeart reduces development time and architectural complexity for MongoDB-based projects, allowing teams to allocate resources to application-specific features.

What Makes RESTHeart Powerful?

🚀 Zero-Code APIs

Automatic API generation upon connection to MongoDB. No configuration files, code generation, or boilerplate implementation required.

🔐 Built-in Security

Production-ready authentication and authorization with support for multiple mechanisms including JWT, basic auth, and custom authenticators.

⚡ High Performance

Built on Undertow, the web server used in Wildfly Application Server. Utilizes Java Virtual Threads for efficient concurrency and high throughput.

🔌 Extensible Plugin Architecture

Support for custom services, interceptors, validators, and other extensions. Plugins integrate with the core framework and have access to all RESTHeart capabilities.

🌐 Polyglot Development

When deployed on GraalVM, plugins can be written in JavaScript, Python, or other supported languages in addition to Java, providing flexibility in technology stack choices.

📦 Production-Ready

Includes Docker support, native executable compilation, comprehensive metrics, monitoring integrations, and flexible deployment options for production environments.

Real-World Use Cases

SaaS Applications
Multi-tenant SaaS applications with MongoDB as the data layer. RESTHeart provides the API infrastructure while domain-specific logic is implemented through plugins.

Mobile Backends
Backend services for iOS and Android applications requiring REST and GraphQL endpoints to MongoDB, with authentication and real-time data streaming via WebSocket.

Internal Tools and Dashboards
Rapid exposure of MongoDB collections to internal tools, admin panels, and analytics dashboards without custom backend implementation.

IoT Data Collection
Collection and API exposure of sensor data, device telemetry, or event streams stored in MongoDB for subsequent analysis and visualization.

Getting Started

RESTHeart can be deployed with MongoDB using Docker Compose:

curl https://raw.githubusercontent.com/SoftInstigate/restheart/master/docker-compose.yml \
  --output docker-compose.yml && docker compose up

Test it:

curl localhost:8080/ping

This provides a running API server connected to MongoDB.

From Prototype to Production

RESTHeart supports progressive development:

Start Simple
Initial prototypes can utilize zero-code APIs for rapid iteration and feedback collection.

Add Custom Logic
Custom plugins can be added as requirements evolve to implement business logic, validation, or system integrations.

Scale Confidently
Deployment options include Docker, Kubernetes, or native executables. RESTHeart is designed to handle production workloads.

Extend the Platform
GraphQL, WebSocket, and custom authentication capabilities are either built-in or can be implemented through the plugin system.

The RESTHeart Ecosystem

RESTHeart Cloud
Fully managed RESTHeart service with infrastructure management handled by the platform provider.

RESTHeart CLI
Command-line tool for scaffolding and developing plugins with hot-reload support during development.

Comprehensive Documentation
Complete guides, tutorials, and API references at restheart.org/docs.

Open Source and Community-Driven

RESTHeart is open source software licensed under AGPL. Support channels include:

Summary

RESTHeart provides a framework for exposing MongoDB databases through REST, GraphQL, and WebSocket APIs without requiring manual backend implementation. The framework offers:

  • Automatic API generation without code
  • Production-ready security and performance characteristics
  • Extensibility through a plugin system
  • Reduced time-to-deployment for MongoDB-based applications

RESTHeart is suitable for projects requiring rapid API development or standardized MongoDB access patterns with optional custom logic extension.


Get Started:

RESTHeart is developed by SoftInstigate and maintained by a global community of contributors.