Skip to content
awaitly logo - clock face with checkmark smile

awaitly

Typed async workflows with Result types and automatic error inference

Good things come to those who a-wait-ly

  • Wraps async operations in Result<T, E> instead of try/catch
  • Infers error types from your dependencies automatically
  • Provides step caching, retries, and timeouts when you need them
  • Supports pause/resume for long-running workflows
Terminal window
npm install awaitly
import { ok, err, type AsyncResult } from 'awaitly';
import { createWorkflow } from 'awaitly/workflow';
// Define operations that return Results (or use Awaitly.ok / Awaitly.err)
const fetchUser = async (id: string): AsyncResult<User, 'NOT_FOUND'> =>
id === '1' ? ok({ id, name: 'Alice' }) : err('NOT_FOUND');
// Create workflow - error types are inferred
const workflow = createWorkflow('workflow', { fetchUser });
// Run it
const result = await workflow.run(async ({ step, deps }) => {
const user = await step('fetchUser', () => deps.fetchUser('1'));
return user;
});
if (result.ok) {
console.log(result.value.name);
} else {
// TypeScript knows: result.error is 'NOT_FOUND' | UnexpectedError
}

Typed errors with async/await

You want compile-time error checking without giving up familiar syntax

Reliability primitives

You need retries, timeouts, circuit breakers built into your workflow

Long-running workflows

You’re building workflows that pause for approval or persist across restarts

Automatic error inference

You want error types computed from dependencies, not maintained manually