@reintersect/sdk has two APIs for the same app model. The Promise API in @reintersect/sdk/app
takes async handlers and any Standard Schema library. The Effect API in
@reintersect/sdk/effect/app takes Effect Schema, runs every handler as an
Effect, tracks the services and errors of each handler in its type, and hands you secrets as
Redacted values.
Reintersect can’t tell the two apart. Both produce the same manifest, receive the same signed
deliveries and render with the same components, so every guide in this site
applies to both. These pages cover what’s different on the Effect side.
When to use it
Use the Effect API when your backend already runs on Effect, or when you want the compiler to check that every service your handlers need is provided and that their failures are handled. Use the Promise API when your app is plainasync TypeScript or you’d rather write schemas with Zod, ArkType
or Valibot.
An app uses one API. Adding a piece from
@reintersect/sdk/app to an Effect app is a type error.
Components from @reintersect/sdk/components work with both.
Install
Scaffold an Effect app, served withHttpLayerRouter on Node and tested with @effect/vitest:
effect and @effect/platform next to the
SDK. They’re optional peer dependencies, so Promise apps never need them:
@effect/platform-node. For tests, add
@effect/vitest.
Entry points
A complete app
This app has one block with one action. The action moves a task through aTasks service, and the
app provides that service once with a layer:
Tasks, so moveTask, TaskBlock and the app all carry Tasks as a
requirement. Without provide(app, Tasks.Default), serving the app is a type error that names the
missing service. See Services and layers.
Effect Schema decodes the props, state and arguments on the way in and encodes the state your action
returns before Reintersect stores it. See Handlers and schemas.
If updateStatus could fail, its error would appear in the action’s type. Reintersect would keep the
block as it was and show the member an error. See Errors.
Next steps
Handlers and schemas
The handler forms, what’s in the context, Effect Schema, environment values and secrets.
Blocks and references
Actions and views as Effects, components that return an Effect, and resolving links.
Commands, actions and events
Slash commands, message actions, lifecycle events and HTTP routes.
Deferred answers
Answer a command or message action after the delivery returns, with
defer.Services and layers
Provide services once, serve the app on
HttpLayerRouter and swap layers in tests.Errors
What a failure does in each piece, the errors the SDK raises and how to catch them.
Client and streams
Call the Reintersect API from handlers, jobs and scripts, and post to app streams.
Testing
Run your app against a fake host inside
@effect/vitest, with test clocks and fake services.