Thanks to visit codestin.com
Credit goes to github.com

Skip to content
/ moose Public
forked from 514-labs/moosestack

The developer framework for building analytical backends on top of ClickHouse, Redpanda and other high-performance analytical infrastructure

License

Notifications You must be signed in to change notification settings

cleaton/moose

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

moose logo

NPM Version Moose Community Docs MIT license

MooseStack

Developer toolkit for building real-time analytical backends in Typescript and Python — MooseStack modules offer type‑safe, code‑first abstractions for popular open source analytical infrastructure, including ClickHouse, Kafka, Redpanda, Temporal, and Redis.

MooseStack is designed to bring the best of the modern web-development experience to any developer building an application that needs to integrate an analytics stack.

Why MooseStack?

  • 5‑minute setup: Install the CLI and bootstrap a backend.
  • Pre‑integrated components: ClickHouse (storage), Redpanda (streaming), Temporal (orchestration).
  • Hot‑reload development: Run everything locally with live schema migrations.
  • Code‑first infrastructure: Declare tables, streams, workflows, and APIs in TS/Python -> MooseStack wires it all up.
  • Modular design: Only enable the modules you need. Each module is independent and can be adopted incrementally.
  • Built for speed: ClickHouse is a columnar database that is roughly 100× faster than traditional databases for analytical queries.

MooseStack Modules

Quickstart

Also available in the Docs: 5-minute Quickstart

Already running Clickhouse: Getting Started with Existing Clickhouse

Install the CLI

bash -i <(curl -fsSL https://fiveonefour.com/install.sh) moose

Create a project

# typescript
moose init my-project --from-remote <YOUR_CLICKHOUSE_CONNECTION_STRING> --language typescript

# python
moose init my-project --from-remote <YOUR_CLICKHOUSE_CONNECTION_STRING> --language python

Run locally

cd my-project
moose dev

MooseStack will start ClickHouse, Redpanda, Temporal, and Redis; the CLI validates each component.

Examples

TypeScript

import { Key, OlapTable, Stream, IngestApi, ConsumptionApi } from "@514labs/moose-lib";
 
interface DataModel {
  primaryKey: Key<string>;
  name: string;
}
// Create a ClickHouse table
export const clickhouseTable = new OlapTable<DataModel>("TableName");
 
// Create a Redpanda streaming topic
export const redpandaTopic = new Stream<DataModel>("TopicName", {
  destination: clickhouseTable,
});
 
// Create an ingest API endpoint
export const ingestApi = new IngestApi<DataModel>("post-api-route", {
  destination: redpandaTopic,
});
 
// Create consumption API endpoint
interface QueryParams {
  limit?: number;
}
export const consumptionApi = new ConsumptionApi<QueryParams, DataModel[]>("get-api-route", 
  async ({limit = 10}: QueryParams, {client, sql}) => {
    const result = await client.query.execute(sql`SELECT * FROM ${clickhouseTable} LIMIT ${limit}`);
    return await result.json();
  }
);

Python

from moose_lib import Key, OlapTable, Stream, StreamConfig, IngestApi, IngestApiConfig, ConsumptionApi
from pydantic import BaseModel
 
class DataModel(BaseModel):
    primary_key: Key[str]
    name: str
 
# Create a ClickHouse table
clickhouse_table = OlapTable[DataModel]("TableName")
 
# Create a Redpanda streaming topic
redpanda_topic = Stream[DataModel]("TopicName", StreamConfig(
    destination=clickhouse_table,
))
 
# Create an ingest API endpoint
ingest_api = IngestApi[DataModel]("post-api-route", IngestApiConfig(
    destination=redpanda_topic,
))
 
# Create a consumption API endpoint
class QueryParams(BaseModel):
    limit: int = 10
 
def handler(client, params: QueryParams):
    return client.query.execute("SELECT * FROM {table: Identifier} LIMIT {limit: Int32}", {
        "table": clickhouse_table.name,
        "limit": params.limit,
    })
 
consumption_api = ConsumptionApi[RequestParams, DataModel]("get-api-route", query_function=handler)

Docs

Built on

Moose in Production

Moose is beta software and under active development. Multiple public companies are using Moose in production. If you’re evaluating production use, consider Boreal Cloud or review the documentation for self-hosting. You can also reach us at [email protected] or join the slack community.

Community

Join us on Slack: https://join.slack.com/t/moose-community/shared_invite/zt-2fjh5n3wz-cnOmM9Xe9DYAgQrNu8xKxg

Contributing

We welcome contributions! See the contribution guidelines.

License

MooseStack is open source software and MIT licensed.

About

The developer framework for building analytical backends on top of ClickHouse, Redpanda and other high-performance analytical infrastructure

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 50.6%
  • TypeScript 22.6%
  • MDX 16.7%
  • Python 7.3%
  • JavaScript 1.0%
  • CSS 0.8%
  • Other 1.0%