Skip to content

effect-analyzer

Paste Effect code into a live browser playground, export interactive analysis pages, and generate diagrams without running your program.

Live Browser Playground

Paste Effect code into a static in-browser playground and get a rendered railway diagram immediately.

Open the playground

Interactive HTML Export

Generate a shareable analysis page with search, filters, path explorer, themes, and embedded IR.

Open the HTML demo

These two features are what make the library easy to share: one lets people try it instantly, the other turns analysis into a linkable artifact.

Example fixture: packages/effect-analyzer/src/__fixtures__/docs/transfer-workflow.ts

export const transferWorkflow = (
fromAccountId: string,
toAccountId: string,
amount: number,
) =>
Effect.gen(function* () {
const accounts = yield* AccountService
const audit = yield* AuditLog
const balance = yield* accounts.getBalance(fromAccountId)
if (balance < amount) {
return yield* Effect.fail(new InsufficientFundsError(balance, amount))
}
yield* accounts.debit(fromAccountId, amount)
yield* accounts.credit(toAccountId, amount)
yield* audit.record(`Transferred ${amount} from ${fromAccountId} to ${toAccountId}`)
})
$ npx effect-analyze ./src/__fixtures__/docs/transfer-workflow.ts --format explain
transferWorkflow (generator):
1. Yields accounts <- AccountService
2. Yields audit <- AuditLog
3. Yields balance <- accounts.getBalance
4. If balance < amount:
Returns:
Calls fail - constructor
5. Calls accounts.debit
6. Calls accounts.credit
7. Calls audit.record
Services required: AccountService, AuditLog
Error paths: AccountNotFoundError, InsufficientFundsError
Concurrency: sequential (no parallelism)
flowchart LR
  prog["transferWorkflow"]

  svc_AccountService{{"AccountService"}}
  prog -->|requires| svc_AccountService
  svc_AuditLog{{"AuditLog"}}
  prog -->|requires| svc_AuditLog

Static Analysis

Analyze Effect programs without execution. Extracts generators, pipes, services, layers, error handlers, and control flow.

Mermaid Diagrams

Auto-generate flowcharts, railway diagrams, service maps, error flows, concurrency views, and more.

Complexity Metrics

Calculate cyclomatic complexity, cognitive complexity, path counts, nesting depth, and parallel breadth.

Semantic Diff

Compare two versions of an Effect program to see what changed - steps added, removed, or modified.

Terminal window
# Install
npm install effect-analyzer
# Analyze a file
npx effect-analyze ./src/my-program.ts
# Generate a railway diagram
npx effect-analyze ./src/my-program.ts --format mermaid-railway
# Compare versions
npx effect-analyze HEAD:program.ts program.ts --diff