Getting Started
Learn how to install the SDK, authenticate, and deploy your first pipeline in under 5 minutes.
Installation
Install the Mario Koala SDK using your preferred package manager.
npm
npm install @mariokoala/sdk
pnpm / yarn
pnpm add @mariokoala/sdk
# or
yarn add @mariokoala/sdk
Step 1 — Initialize the client
Create a client with your API key. We recommend storing credentials in environment variables — never commit them to source control.
JavaScript
import { MarioKoala } from '@mariokoala/sdk' const mk = new MarioKoala({ apiKey: process.env.MK_API_KEY, // optional: pin to a specific environment environment: 'production', }) export default mk
Step 2 — Define a pipeline
Pipelines are the core building block. Each pipeline has a trigger, one or more steps, and optional retry configuration.
JavaScript
import mk from './mk-client' const welcomePipeline = mk.pipeline('send-welcome-email', { // Trigger on incoming webhook POST trigger: { type: 'webhook', path: '/events/user-created', secret: process.env.WEBHOOK_SECRET, }, steps: [ { id: 'fetch-user', async run(ctx) { return await ctx.db('postgres').queryOne( 'SELECT * FROM users WHERE id = $1', [ctx.trigger.userId] ) }, }, { id: 'send-email', retry: { max: 3, backoff: 'exponential' }, async run(ctx) { await ctx.integration('sendgrid').send({ to: ctx.steps['fetch-user'].email, template: 'welcome-v3', data: { name: ctx.steps['fetch-user'].name }, }) }, }, ], }) export default welcomePipeline
Step 3 — Deploy
Use the Mario Koala CLI to authenticate and push your pipeline to the cloud. The deploy command detects changed pipelines and only updates what's necessary.
bash
# Authenticate the CLI $ mk login # Deploy all pipelines in current directory $ mk deploy # Deploy to a specific environment $ mk deploy --env production # Output ✓ Detected 1 changed pipeline ✓ send-welcome-email deployed (1.3s) ✓ Webhook endpoint: https://run.mariokoala.ai/hooks/events/user-created
What's next?
- Set up Authentication with your integrations
- Learn about Retry & Error Handling
- Add Observability to your pipelines
- Explore the full API Reference