1. MooseStack
  2. Moose APIs & Web Apps
  3. Bring Your Own API Framework

On this page

Supported frameworks:Client-only embedding (existing apps)The WebApp ClassMount pathsWebApp utilities

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:

  • Express
  • Fastify
  • Koa
  • Raw Node.js
Want to discuss other integrations?

Join our Slack community to chat about other framework integrations you'd like to see or share your own implementation.

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);
import { getMooseUtils } from "@514labs/moose-lib"; const { client, sql, jwt } = getMooseUtils(req);
  • Overview
Build a New App
  • 5 Minute Quickstart
  • Browse Templates
  • Existing ClickHouse
Add to Existing App
  • Next.js
  • Fastify
Fundamentals
  • Moose Runtime
  • MooseDev MCP
  • Data Modeling
Moose Modules
  • Moose OLAP
  • Moose Streaming
  • Moose Workflows
  • Moose APIs & Web Apps
    • Native APIs
    • Ingest API
    • Analytics API
    • Workflow Trigger
    • Admin APIs
    • Authentication
    • Use Your Web Framework
    • Overview
    • Express
    • Fastify
    • Koa
    • Raw Node.js
Deployment & Lifecycle
  • Moose Migrate
  • Moose Deploy
Reference
  • API Reference
  • Data Types
  • Table Engines
  • CLI
  • Configuration
  • Observability Metrics
  • Help
  • Changelog
Contribution
  • Documentation
  • Framework
FiveonefourFiveonefour
Fiveonefour Docs
MooseStackTemplates
Changelog
Source508