Build HTTP APIs with your framework of choice
MooseStack allows you to embed a supported framework inside your MooseStack application. This is useful when you need full framework routing/middleware but still want MooseStack to run and deploy everything together.
Supported frameworks:
MooseStack provides adapters for the following frameworks:
Want to discuss other integrations?
Client-only embedding (existing apps)
Optionally, if you already have a running app server, you can keep it where it is and use MooseStack as a library for ClickHouse modeling + type-safe queries (no separate Moose Runtime web service).
- Embed ClickHouse analytics in Next.js
- Embed ClickHouse analytics in Fastify
- For query patterns, see Reading Data.
The WebApp Class
The WebApp class is the bridge between your web framework and MooseStack. It handles:
- Mounting your framework at a custom URL path
- Injecting MooseStack utilities (database clients, SQL helpers, JWT)
- Validating JWT tokens when authentication is configured
- Managing the request/response lifecycle
See framework templates for complete working examples with Express, Fastify, Koa, FastAPI, and more.
import { WebApp } from "@514labs/moose-lib";const webApp = new WebApp("webapp", your_framework_app, { mountPath: "/webapp", metadata: { description: "Your framework application", },});Mount paths
Each WebApp mounts your framework under a unique path.
const webApp = new WebApp("webapp", your_framework_app, { mountPath: "/webapp", /// ... other config ...});- Cannot be
/ - Cannot end with a trailing slash
- Cannot start with reserved prefixes:
/admin,/api,/consumption,/health,/ingest,/mcp,/moose,/ready,/workflows
WebApp utilities
Your frameworks can now access your OLAP database through MooseStack's injected utilities. This includes the Moose ClickHouse client, SQL helpers, and JWT utilities.
import { getMooseUtils } from "@514labs/moose-lib"; const { client, sql, jwt } = getMooseUtils(req);