Configuration
ConduitOptions
import { createConduit } from '@yellatech/conduit'
const app = createConduit({
engine: {
/* EngineOptions: passed through to createEngine() */
concurrency: 10,
store: { type: 'sqlite', path: './app.db' },
},
db: './app.db',
skills: ['./skills'],
server: {
auth: {
operator: operatorMiddleware,
ingress: hmacMiddleware,
},
operatorExclude: ['/auth'],
},
})
Full type:
interface ConduitOptions {
engine?: EngineOptions
db?: string
skills?: string[]
server?: ConduitServerConfig
onConnectorEvent?: (event: ConnectorEvent) => void
}
interface ConduitServerConfig {
auth?: ConduitAuthHooks
operatorExclude?: string[]
}
interface ConduitAuthHooks {
operator?: MiddlewareHandler
ingress?: MiddlewareHandler
public?: MiddlewareHandler
}
Engine Options
The engine field is passed directly to createEngine(). Conduit strips the server option (it manages its own server) but forwards everything else: concurrency, store, hooks, maxPayloadBytes, maxChainDepth, etc.
See Engine Configuration for the full list.
Database
Conduit uses a SQLite database for auth config persistence, connector config, cron job state, and OAuth token caching. The path is resolved through a fallback chain:
When conduit and engine share the same database file, conduit tables (conduit_auth_configs, conduit_connector_status, conduit_cron_jobs, etc.) are created alongside engine tables in the same SQLite file. Migrations are tracked independently via _conduit_migrations.
// Explicit path
const app = createConduit({ db: './data/app.db' })
// Or via environment variable
// CONDUIT_DB_PATH=./data/app.db
const app = createConduit()
Server
app.listen(port, host) starts an HTTP server (defaults to 0.0.0.0:3000). Returns a ConduitServer with address and stop().
const server = await app.listen(8080)
console.log(`Listening on ${server.address.port}`)
The Hono app is accessible via app.hono for adding custom routes before calling listen().
Auth Surfaces
Conduit’s server has three auth surfaces, each protected by optional middleware:
| Surface | Paths | Purpose |
|---|---|---|
| public | /livez, /readyz | Health checks, always accessible |
| ingress | /connectors/*, /hooks/* | Inbound webhooks from external services |
| operator | Everything else | Dashboard, API routes, emit |
const app = createConduit({
server: {
auth: {
operator: bearerAuth({ token: process.env.ADMIN_TOKEN }),
ingress: hmacVerify({ secret: process.env.WEBHOOK_SECRET }),
},
operatorExclude: ['/auth'], // skip operator auth for these paths
},
})
See Concepts for more detail on the security model.
Webhooks
Register webhook endpoints on the ingress surface:
app.webhook('/hooks/stripe', {
eventType: 'stripe:event', // static event name
})
// Dynamic event type from payload
app.webhook('/hooks/github', {
eventType: (body) => `github:${body.action}`,
})
// With HMAC verification middleware
app.webhook('/hooks/stripe', {
eventType: 'stripe:event',
verify: stripeVerifyMiddleware,
})
Webhook routes are mounted as POST handlers. The request body is parsed as JSON and emitted as an event payload.
Cron Jobs
Register cron jobs that emit events on a schedule. Requires a database.
const app = createConduit({ db: './app.db' })
app.cron('daily-cleanup', '0 3 * * *', { timezone: 'America/New_York' })
app.cron('heartbeat', '*/5 * * * *', { payload: { source: 'cron' } })
app.process({
name: 'cleanup',
on: 'cron:daily-cleanup',
run: async (ctx) => {
// runs at 3am ET daily
return { success: true }
},
})
Cron events arrive as cron:{name}. Pause/resume state is persisted in the database across restarts.
app.pauseCron('heartbeat') // stops firing, survives restart
app.resumeCron('heartbeat') // resumes
app.getCronJobs() // list all jobs with status and next run time
Cron lifecycle
On restart, cron jobs registered in code are reconciled with database state: orphaned DB rows (jobs no longer in code) are cleaned up, and pause state from the DB is respected for jobs that still exist.
Dashboard
Conduit extends the Engine dashboard with a connector status panel. The dashboard is served automatically from / when listen() is called. No additional configuration is needed.
Environment Variables
| Variable | Purpose |
|---|---|
CONDUIT_DB_PATH | Path to the SQLite database file |
STATE_DB_PATH | Engine-level database path (used if CONDUIT_DB_PATH is not set) |
See also: Engine Configuration, Concepts, Auth.