Skip to main content
Skip to main content
Edit this page

Developing on ClickHouse with Moose OLAP

Community Maintained

Moose OLAP is a core module of the Moose Stack, an open source developer toolkit for building real-time analytical backends in Typescript and Python.

Moose OLAP offers developer-friendly abstractions and ORM-like functionality, built natively for ClickHouse.

Key features of Moose OLAP

  • Schemas as code: Define your ClickHouse tables in TypeScript or Python with type safety and IDE autocompletion
  • Type-safe queries: Write SQL queries with type checking and autocompletion support
  • Local development: Develop and test against local ClickHouse instances without affecting production
  • Migration management: Version control your schema changes and manage migrations through code
  • Real-time streaming: Built-in support for pairing ClickHouse with Kafka or Redpanda for streaming ingest
  • REST APIs: Easily generate fully documented REST APIs on top of your ClickHouse tables and views

Getting started in under 5 minutes

For the latest and greatest Installation and Getting Started guides, see the Moose Stack documentation.

Or follow this guide to get up and running with Moose OLAP on an existing ClickHouse or ClickHouse Cloud deployment in under 5 minutes.

Prerequisites

  • Node.js 20+ OR Python 3.12+ - Required for TypeScript or Python development
  • Docker Desktop - For local development environment
  • macOS/Linux - Windows works via WSL2

Install Moose

Install the Moose CLI globally to your system:

Set up your project

Option A: Use your own existing ClickHouse deployment

Important: Your production ClickHouse will remain untouched. This will just initialize a new Moose OLAP project with data models derived from your ClickHouse tables.

Your ClickHouse connection string should be in this format:

Option B: use ClickHouse playground

Don't have ClickHouse up and running yet? Use the ClickHouse Playground to try out Moose OLAP!

Install dependencies

You should see: Successfully generated X models from ClickHouse tables

Explore your generated models

The Moose CLI automatically generates TypeScript interfaces or Python Pydantic models from your existing ClickHouse tables.

Check out your new data models in the app/index.ts file.

Start development

Start your dev server to spin up a local ClickHouse instance with all your production tables automatically reproduced from your code definitions:

Important: Your production ClickHouse will remain untouched. This creates a local development environment.

Seed your local database

Seed your data into your local ClickHouse instance:

From your own ClickHouse

From ClickHouse playground

Building with Moose OLAP

Now that you have your Tables defined in code, you get the same benefits as ORM data models in web apps - type safety and autocomplete when building APIs and Materialized Views on top of your analytical data. As a next step, you could try:

Get help and stay connected

  • Reference Application: Check out the open source reference application, Area Code: a starter repo with all the necessary building blocks for a feature-rich, enterprise-ready application that requires specialized infrastructure. There are two sample applications: User Facing Analytics and Operational Data Warehouse.
  • Slack Community: Connect with the Moose Stack maintainers on Slack for support and feedback
  • Watch Tutorials: Video tutorials, demos, and deep-dives into Moose Stack features on Youtube
  • Contribute: Check out the code, contribute to the Moose Stack, and report issues on GitHub