@effit/core
v0.1.0-alpha.7
Published
Core package of Effit, a framework for building Effect-TS apps.
Readme
@effit/core
Core package of Effit, a framework for building Effect-TS apps.
Provides the primitives every Effit process needs:
Bootstrap.run(serviceName, live, { scoped? })—Layer.launch+ logger + tracing +NodeRuntime.runMaincommandHandler(Schema, handler)/queryHandler(Schema, handler)— schema-validated handlers with automatic spansId.create(name)— branded ID factory with.make(),.makeNew(),.fromStreamName(),.EMPTY,.stripPrefix()BusinessError(400),NotFoundError(404),ForbiddenError(403) —Schema.TaggedErrors with HTTP annotationsApplicationLogger— JSON logger in production, pretty logger elsewhereTelemetry.make(serviceName)— OTLP tracing Layer in production,Layer.emptyotherwiseInContext— Effect ↔ Promise bridge that preserves runtime context (runPromise,runPromiseUnwrap)
Installation
pnpm add @effit/core effect @effect/platform @effect/platform-node @effect/opentelemetry \
@opentelemetry/sdk-trace-base @opentelemetry/exporter-trace-otlp-http@effit/core declares these as peer dependencies so your app controls their versions.
Usage
import { Bootstrap } from '@effit/core/Bootstrap.js';
import { commandHandler } from '@effit/core/CommandHandler.js';
import { Id } from '@effit/core/Id.js';
import { NotFoundError } from '@effit/core/errors/NotFoundError.js';
export const RoundId = Id.create('RoundId');
Bootstrap.run('my-api', ServerLive, { scoped: true });License
MIT © Talysson de Oliveira Cassiano
