Step 1: Setup Connection
In this step, you'll configure MooseStack to connect to your existing OLTP database.
Overview
MooseStack needs to connect to your existing database to read data and create materialized views. This connection is configured securely and doesn't require any changes to your production database.
Configuration
moose.config.ts
import { defineConfig } from "@514labs/moose-cli"; export default defineConfig({ dataSources: { postgres: { type: "postgres", host: process.env.DB_HOST || "localhost", port: parseInt(process.env.DB_PORT || "5432"), database: process.env.DB_NAME || "mydb", user: process.env.DB_USER || "postgres", password: process.env.DB_PASSWORD || "", }, },});Environment Variables
For security, store sensitive credentials in environment variables:
DB_HOST=your-db-host
DB_PORT=5432
DB_NAME=your-database
DB_USER=your-username
DB_PASSWORD=your-passwordVerify Connection
After configuring the connection, verify it works:
moose db pingNext Steps
Once your connection is configured, proceed to the next step to create materialized views.