The data-driven Web framework

One API, many facets

Decorate your APIs with HTML using path-based templates.
No backend coding required.

Get Started → GitHub (coming soon)

What is Facet?

Facet is a data-driven Web framework that transforms JSON documents into server-rendered HTML. Built on the production-grade RESTHeart runtime, it provides a hybrid approach where HTML is just another representation of your API.

  • No backend code required: Templates + JSON documents = HTML — no controllers.
  • Convention-based routing: Path-based template resolution maps files to REST endpoints automatically.
  • Progressive enhancement: Full rendering and HTMX fragments for dynamic but SEO-friendly UIs.

Why Facet?

Hybrid Architecture

One endpoint serves both JSON and HTML through content negotiation. Build APIs and web interfaces simultaneously, no duplicate logic.

Zero Backend Code

No controllers, service layers, or glue code. Just MongoDB collections, Pebble templates, and RESTHeart handles the rest.

Convention Over Configuration

File-based routing with automatic template resolution. Drop a template at the corresponding path and it just works.

Progressive Enhancement

Server-rendered, enhanced with HTMX for partial updates. Lightweight SPA-like interactions without heavy JavaScript frameworks.

Familiar Developer Experience

Pebble templates use Twig/Jinja syntax—instantly familiar to PHP and Python developers. No new templating language to learn.

Multiple Databases

Works with MongoDB, MongoDB Atlas, Percona Server, AWS DocumentDB, Azure Cosmos DB, and even PostgreSQL (via FerretDB compatibility layer).

Production-Ready

Built on Java for scaling, can be extended with JavaScript for flexibility. User management, RBAC, real-time Streams, and GraphQL included.

See It In Action

GET /products
Accept: application/json  →  JSON facet (API)
Accept: text/html         →  HTML facet (Browser)

# One source of truth. Multiple representations.
<!-- templates/products/index.html -->
{% extends "layout" %}

{% block content %}
  <h1>Products</h1>
  
  {% if documents %}
    {% for product in documents %}
      <div class="product-card">
        <h2>{{ product.name }}</h2>
        <p>{{ product.description }}</p>
        <span class="price">${{ product.price }}</span>
      </div>
    {% endfor %}
  {% endif %}
  
  <!-- Pagination automatically available -->
  {% if totalPages > 1 %}
    <nav class="pagination">
      {% for p in range(1, totalPages + 1) %}
        <a href="?page={{ p }}">{{ p }}</a>
      {% endfor %}
    </nav>
  {% endif %}
{% endblock %}
# Browser requests HTML
curl -H "Accept: text/html" \
    http://localhost:8080/products
→ Rendered HTML page

# API clients request JSON
curl -H "Accept: application/json" \
    http://localhost:8080/products
→ JSON response

# No template? Still returns JSON
curl http://localhost:8080/orders
→ JSON (SSR is opt-in per resource)

Perfect For

  Content Sites

Blogs, documentation, wikis. Documents in MongoDB render as SEO-friendly HTML. Fast initial page load, no JavaScript required.

  Headless CMS Alternative

Replace headless CMS + separate frontend with one system. Content authors use HTML forms, APIs remain available for mobile apps.

  Product Catalogs

E-commerce listings, directories, portfolios. Product data serves JSON for mobile apps and HTML for search engines.

  Search Interfaces

Browse and filter MongoDB collections through web forms. Query parameters map to MongoDB queries automatically.

  AI-Powered Search

Build semantic search applications using MongoDB Vector Search. Transform vector query results into interactive HTML interfaces.

  Admin & Back-Office

CRUD interfaces for internal teams. Forms map to document schemas. No separate admin framework needed.

  Data Explorers

Visual interface for MongoDB collections. View, edit, and manage data through HTML tables and forms.

The Stack

Built with proven technologies for reliability and developer productivity

MongoDB

Document database

RESTHeart

API engine

GraalVM

Polyglot runtime

Pebble

Twig/Jinja templates

HTMX

Progressive enhancement

Architecture

Facet leverages RESTHeart, the production-ready Backend Platform for MongoDB - like Express.js on Node.js. Facet adds SSR capability while keeping all RESTHeart features intact:

REST API

Complete MongoDB access via HTTP

Authentication

JWT, OAuth2, LDAP, and more

Authorization

Role-based access control (RBAC)

Change Streams

Real-time WebSocket updates

Aggregations

MongoDB aggregation pipeline

File Storage

GridFS for file management

Caching

Built-in caching for performance

GraphQL

GraphQL API support

Custom Plugins

Extend functionality with code

User Management

Manage users and roles

How Facet Compares

Many web frameworks require backend coding to connect REST APIs with HTML views. Facet eliminates this need through convention-based templates that map directly to REST endpoints. See how Facet stacks up against popular alternatives:

Feature WordPress Strapi + Next Rails Facet
Backend Code PHP Node Ruby None (*)
Native SSR Yes External Yes Yes
API + HTML Partial No Separate Same
Convention Routing No Partial Yes Yes
Hybrid SSR/SPA No Separate Turbo Yes
Deployment Moderate Two systems App server Single
Database MySQL Multiple PostgreSQL MongoDB (**)
Target Editors Full-stack Full-stack Web devs

(*) Backend code can be added via RESTHeart plugins if needed.
(**) Any MongoDB-compatible database can be used.

Ready to Build?

🚀 Start transforming your REST APIs into complete web interfaces.

Get Started → GitHub (coming soon)