Tutorial: Migrate Your Dashboard to ClickHouse
This tutorial is for teams with a production dashboard or report that needs to get faster as data volume grows.
By the end of this guide you’ll have
Real-time replication (CDC) pipeline
A production pipeline that continuously replicates data from your source database into ClickHouse.
ClickHouse analytics layer in code
A MooseStack project that defines views, materialized views, serving tables, and query/API handlers on top of CDC-replicated raw tables.
Safe local-to-production workflow
A local development workflow plus Fiveonefour hosting preview environments and migration plans so you can validate changes before merging to `main`.
You do not need a full rewrite. Keep your source database (Postgres or SQL Server) as the transactional system of record, keep your existing app contracts, and offload analytical reads to ClickHouse via CDC (ClickPipes or Debezium).
This guide gives a path to ship this as normal code, as part of your existing development process. With MooseStack, you model your ClickHouse analytics layer in code, iterate locally, and roll out with preview migrations in Fiveonefour so you can safely iterate on your analytics layer without risking your production ClickHouse data.
Starting from scratch?
If you're building a new dashboard or data-connected chat (not migrating an existing dashboard), start with Chat in Your App.
Want Python Examples?
You'll work through:
AI-assisted Development
We recommend using an AI copilot to accelerate the migration to handle complex query translations. However, you can complete every step manually if you prefer. Any AI-enabled editor (Claude Code, Cursor, Codex, Opencode, GitHub Copilot, Windsurf, etc.) will work. Editors that support MCPs can make this workflow even faster.
Project Setup
Create and Deploy MooseStack Project
This sets up the foundation for the rest of this guide. You'll initialize a MooseStack project in your monorepo and deploy your new project to Fiveonefour hosting for preview deployments and migration planning.
Why deploy to Fiveonefour hosting now?
Preview Environments and Migration Planning
When you open a feature branch and PR later in this guide, Fiveonefour can automatically provision a preview environment and generate a migration plan for the code changes in your branch. This ensures your code changes are safe and you can apply them to your main ClickHouse database with confidence.
Sign Up for FiveonefourOnce this section is complete, you’re ready to continue with local development and the component migration phases in the rest of the tutorial.
Develop with ClickHouse locally
This section covers the local development loop you will use for the rest of the migration: get your environment running, confirm data is flowing, and then migrate one dashboard component at a time. The goal is to keep changes safe and incremental while preserving your existing API contracts.
Prepare your local development environment
First, get your local services and tooling into a known-good state so migration work is testable from the start.
Migrate a dashboard component to ClickHouse
With your local environment ready, migrate one dashboard backend path from OLTP reads to ClickHouse reads with MooseStack.
You only replace the read layer. Routing, auth, request/response contracts, and frontend behavior stay the same. In your MooseStack project, you will define functions that build and run ClickHouse queries using OlapTable objects for type-safe column access, then repoint the existing API handler to call those functions instead of the OLTP query path.
If you set up the optional copilot context workspace in local setup, use it here to organize component-specific files and prompts across all three phases.
Pick a specific dashboard component or report to migrate. You'll work through one component at a time.
Going to production
In this section, you'll apply your local changes to production. Complete these steps in order:
Confirm Fiveonefour hosting project access
To deploy to production (and to create branch preview environments), you need a Fiveonefour hosting project connected to the GitHub repo you’re working in. If you haven’t created a project yet, go back to Create your Fiveonefour project above and complete that setup first.