REST, GraphQL and WebSocket APIs for MongoDB
RESTHeart transforms MongoDB into a complete backend platform with automatically generated REST APIs, configurable GraphQL, WebSocket support for real-time data, and a plugin system for custom logic.
Built on Java with proven production deployments at scale.
Core capabilities:
- REST API β Full CRUD, aggregations, filtering, sorting, pagination
- GraphQL β Define schemas and map them to MongoDB queries
- WebSocket β Real-time change streams and data sync
- Authentication & Authorization β JWT, OAuth2, LDAP, MongoDB-based users, ACL rules
- Plugin system β Extend with Java, JavaScript, or Python when you need custom logic
No code required for standard database operations. Write plugins only for custom business logic.
Works with MongoDB, MongoDB Atlas, Percona, DocumentDB, Cosmos DB, and FerretDB.
# Start MongoDB + RESTHeart with Docker Compose
curl https://raw.githubusercontent.com/SoftInstigate/restheart/master/docker-compose.yml \
--output docker-compose.yml && docker compose up --attach restheart
# Test it
curl http://localhost:8080/pingDefault credentials: admin / secret (change in production)
More options: https://restheart.org/docs/foundations/quick-start
const url = encodeURI('https://demo.restheart.org/messages?filter={"from":"Bob"}&pagesize=1');
fetch(url)
.then(response => response.json())
.then(json => console.log(JSON.stringify(json, null, 2)));That's it. No Express routes, no Mongoose schemas, no middleware setup.
π Full documentation: https://restheart.org/docs/
RESTHeart sits between clients and MongoDB, providing:
- API layer β REST, GraphQL, WebSocket endpoints
- Security β Authentication, authorization, request validation
- Plugin runtime β Custom business logic in Java, JavaScript, or Python
- Observability β Metrics, logging, health checks
- π Zero-config API β Collections automatically become REST endpoints
- π Production-ready security β JWT, OAuth2, LDAP, role-based access control
- β‘ High performance β Undertow NIO + Java Virtual Threads, handles 10K+ concurrent connections
- π¬ Real-time β Native WebSocket support for MongoDB change streams
- π§© Extensible β Plugin system supports Java, JavaScript, TypeScript, Python
- π Stateless β Scales horizontally, runs on VMs, containers, Kubernetes, or as native binary
Battle-tested: 2M+ downloads, 10+ years in production at scale.
- API development without boilerplate β Skip CRUD code, focus on business logic
- Mobile and web backends β Get REST/GraphQL APIs immediately
- Real-time applications β WebSocket support for chat, notifications, live dashboards
- MongoDB Data API replacement β Self-hosted alternative to the deprecated Atlas Data API (migration guide)
- Legacy modernization β Add modern APIs to existing MongoDB databases
- PostgreSQL with MongoDB API β Use via FerretDB for PostgreSQL storage (tutorial)
Write custom logic only when you need it. RESTHeart handles the rest.
@RegisterPlugin(name = "greetings")
public class GreeterService implements JsonService {
@Override
public void handle(JsonRequest req, JsonResponse res) {
res.setContent(object()
.put("message", "Hello World!")
.put("timestamp", Instant.now()));
}
}export const options = {
name: "greetings",
uri: "/greetings"
}
export function handle(request, response) {
response.setContent(JSON.stringify({
message: 'Hello World!',
timestamp: new Date().toISOString()
}));
response.setContentTypeAsJson();
}Plugin capabilities:
- Services (custom REST endpoints)
- Interceptors (modify requests/responses, add validation)
- Initializers (run code at startup)
- Providers (dependency injection)
π Plugin development: https://restheart.org/docs/plugins/overview/
π§ Use restheart-cli for scaffolding, testing, and hot-reload.
docker pull softinstigate/restheart:latest
docker run -p 8080:8080 \
-v ./restheart.yml:/opt/restheart/etc/restheart.yml \
softinstigate/restheartStateless architecture supports horizontal scaling. Configure with ConfigMaps and Secrets.
Prebuilt binaries for macOS, Linux, Windows with faster startup and lower memory.
See docs/native-executables.md for download links.
Fully managed service: cloud.restheart.com
- Instant provisioning
- Automatic scaling
- Free tier available
- Premium plugins (Webhooks, Sophia AI, Facet)
| Database | Support Level | Notes |
|---|---|---|
| β MongoDB | Full | All versions 3.6+ |
| β MongoDB Atlas | Full | Cloud-native support |
| β Percona Server | Full | Drop-in MongoDB replacement |
| βοΈ FerretDB | Partial | PostgreSQL-backed (tutorial) |
| βοΈ AWS DocumentDB | Partial | Most features work |
| βοΈ Azure Cosmos DB | Partial | MongoDB API compatibility layer |
- π Documentation β API reference and guides
- π€ Ask Sophia β AI documentation assistant
- π¬ Slack β Community chat
- π GitHub Issues β Bug reports and feature requests
- π‘ Stack Overflow β Tag:
restheart
Contributions welcome. RESTHeart is open source (AGPL).
- Report bugs and request features via GitHub Issues
- Submit pull requests
- Improve documentation
- Share use cases
See CONTRIBUTING.md for guidelines.
Dual-licensed:
- AGPL v3 β Open source (free). Plugin development under Apache 2.0.
- Commercial β For proprietary applications.
Same features in both licenses.
Commercial inquiries: info@softinstigate.com
Built with β€οΈ by SoftInstigate | GitHub | Website | Cloud