Telaio
Upgrade Guide

Upgrading to v1.10

Lifecycle hooks, build targets, CLI, and config changes

Upgrading to v1.10

Lifecycle Hooks

The builder methods have been renamed for clarity:

BeforeAfter
onReady(fn)onStart(fn)
onClose(fn)onStop(fn)
.build().buildApi()
TelaioAppTelaioApi

onStart callbacks now run inside start() instead of Fastify's onReady hook. onStop callbacks now run inside stop() instead of Fastify's onClose hook.

Build Targets

The builder now has two build methods:

  • buildApi() -- creates a full Fastify server (replaces build())
  • buildConsumer() -- creates a lightweight queue worker (replaces startConsumer())

Before

import { createApp } from 'telaio';
import { startConsumer } from 'telaio/queue';

// API
const app = await createApp({ config }).withDatabase().build();
await app.start();

// Consumer (separate file)
await startConsumer(registry, { connection: config });

After

import { createApp } from 'telaio';

// app.ts -- shared builder
export function getBuilder() {
  return createApp({ config }).withDatabase().withQueues(registry);
}

// server.ts
const server = await getBuilder().buildApi();
await server.start();

// consumer.ts
const consumer = await getBuilder().buildConsumer();
await consumer.start();

CLI Changes

RemovedReplacement
telaio devrun-p with tsx watch (or similar)
telaio consumerbuildConsumer() in a plain TypeScript entry point

New flags:

  • telaio gen-client --watch -- watch src/ and regenerate on changes
  • telaio db-types --watch -- watch migration files and regenerate

Config Changes

The consumer and dev keys in defineConfig() and package.json are no longer used and can be removed.

On this page