1. MooseStack
  2. Moose APIs

On this page

OverviewCore CapabilitiesBasic ExamplesIngestion APIAnalytics API

Moose APIs

Overview

The APIs module provides standalone HTTP endpoints for data ingestion and analytics. Unlike other modules of the MooseStack, APIs are meant to be paired with other MooseStack modules like OLAP tables and streams.

Bring Your Own API Framework

If you'd prefer to use your own API framework of choice, instead of Moose APIs, see the Bring Your Own API Framework documentation for comprehensive examples and patterns using frameworks such as Express, Koa, Fastify, or FastAPI.

Core Capabilities

Ingest
Ingest New Data
Create HTTP POST endpoints for data ingestion with validation and routing
Analytics
Expose Analytics
Create HTTP GET endpoints for reading data from your OLAP database with query parameters
Trigger
Trigger Workflows
Create HTTP POST endpoints to trigger workflows and other processes
Custom
Bring Your Own API Framework
Use Express, Koa, Fastify, or FastAPI with MooseStack for advanced HTTP features and custom middleware

Basic Examples

Export Required

Ensure your API is correctly exported from your app/index.ts file.

Example: export { userEventsApi, userDataApi }

Learn more about export pattern: local development / hosted.

Ingestion API

import { IngestApi } from "@514labs/moose-lib"; interface UserEvent {  id: string;  userId: string;  timestamp: Date;  eventType: string;} // Create a standalone ingestion APIexport const userEventsApi = new IngestApi<UserEvent>("user-events", {  destination: eventStream});

Analytics API

import { Api } from "@514labs/moose-lib"; interface Params {  userId: string;  limit: number;} interface ResultData {  id: string;  name: string;  email: string;} // Create a standalone analytics APIexport const userDataApi = new Api<Params, ResultData[]>("user-data",   async ({ userId, limit }, { client, sql }) => {    // Query external service or custom logic    return [      { id: userId, name: "John Doe", email: "john@example.com" }    ];  });
import { Api } from "@514labs/moose-lib"; interface Params {  userId: string;  limit: number;} interface ResultData {  id: string;  name: string;  email: string;} // Create a standalone analytics APIexport const userDataApi = new Api<Params, ResultData[]>("user-data",   async ({ userId, limit }, { client, sql }) => {    // Query external service or custom logic    return [      { id: userId, name: "John Doe", email: "john@example.com" }    ];  });
FiveonefourFiveonefour
Fiveonefour Docs
MooseStackTemplates
Changelog
Source506
  • Overview
  • Quick Start
  • Templates / Examples
Fundamentals
  • Moose Runtime
  • MooseDev MCP
  • Data Modeling
MooseStack in your App
  • App / API frameworks
Modules
  • Moose OLAP
  • Moose Streaming
  • Moose Workflows
  • Moose APIs
    • Auth
    • Ingest New Data
    • Expose Analytics
    • Trigger Workflows
    • Client Libraries
    • OpenAPI SDK
    • Admin APIs
Deployment & Lifecycle
  • Moose Migrate
  • Moose Deploy
Reference
  • API Reference
  • Data Types
  • Table Engines
  • CLI
  • Configuration
  • Observability Metrics
  • Help
  • Changelog
Contribution
  • Documentation
  • Framework