About Facet
A data-driven web framework for hybrid web applications
Why Facet?
Facet is designed for Web developers who need to build web applications quickly without sacrificing performance or SEO. By leveraging server-side rendering directly from MongoDB, Facet enables you to create dynamic, data-driven websites with minimal effort.
Facet is meant to avoid the complexity of traditional web frameworks that require extensive backend coding to connect REST APIs with HTML views. With Facet you focus on building your application rather than writing boilerplate code.
Common Questions
What "hybrid" means?
Hybrid means the same endpoint serves both JSON APIs and HTML pages. Request
/products with different Accept headers and get JSON (for APIs) or HTML (for browsers). One data source, multiple representations—no duplicate
logic.
Why not just use Next.js?
Next.js is great for building React applications. Facet is different: it's server-side rendering without a separate API layer. Your MongoDB collections become web pages through templates—no controllers, no frontend framework required. Perfect if you want conventions over configuration.
What about SPA frameworks like React or Vue?
SPA frameworks are powerful but add complexity, impact SEO, and require client-side rendering. Facet focuses on data-driven server-side rendering for fast, SEO-friendly pages. You can still enhance pages with JavaScript as needed, but the core rendering is done on the server. However, the hybrid nature of Facet allows to serve JSON APIs for SPA clients together with server-rendered HTML. So it can resemble Astro data islands architecture in that sense.
Why not just use RESTHeart directly?
You can! RESTHeart is the runtime that Facet depends on. Use RESTHeart alone if you only need REST APIs. Use Facet if you want to add server-rendered HTML using convention-based templates instead of writing code.
What about performance?
Facet runs on GraalVM by default (~1s startup, ~150MB memory) and supports JavaScript extensibility. For maximum performance, native images are available (<100ms startup, ~50MB memory). Choose a GraalVM runtime or a GraalVM-built native binary depending on your deployment and extension needs.
How do I deploy Facet?
Facet is distributed as a JAR file or native binary. Deploy to Docker, Kubernetes, AWS, or any cloud platform. Native binaries can be deployed on bare metal, no need to install Java. Both distribution options are stateless and cloud-native.
Ready to Get Started?
Learn how to build your first Facet application