Add VibeLang to an existing project
Install VibeLang in a project with an existing package.json, verify the compiler, then wire your build.
TypeScript and npm boundaries
Call your own .ts functions and npm packages through Effect.try when they may throw, or tryPromise for Promises (TypeScript boundaries):
import { parseSettings } from "./settings.ts"
error BadSettings { cause: unknown }
effect function settings(text: string) {
return try Effect.try({
try: () => parseSettings(text),
catch: (cause) => new BadSettings({ cause })
})
}- Avoid stem collisions: Do not place
settings.vibebesidesettings.ts— both emitsettings.js(TS5056). Name the wrapperload-settings.vibe. - Throwing contracts: For non-effectful foreign calls,
@throws {never}permits a direct call; missing annotations meanunknownand non-nevercontracts require anEffect.trybridge in effect code (EK0403). A callable returning anEffect,StreamorLayeris effectful: call it directly, regardless of@throws. Run an Effect result withtryrather than wrapping its factory inEffect.try. - Platform APIs: Use Effect services (
Console,Clock,Random) for platform, clock, and randomness APIs; direct host/web calls likecrypto.randomUUID()reportEK4402(diagnostics).
1. Check package.json
- ESM required:
package.jsonmust set"type": "module". Check how that affects any existing.jsfiles first. - Supported Effect range (
^4.1.0):vibelangandvibelang-runtimesupport any stableeffectversion>=4.1.0 <5.0.0(tested on4.1.6), and reject3.x,4.0.x,5.x, and prereleases at compile and load time (EK3201). Core runtime constructs use public Effect 4 APIs, so no@effect/platform-node-sharedoverride or resolution is required. VibeLang follows Effect 4.0.6's defect precedence, which Effect 4.1+ keeps: a failure whose cleanup crashes is a defect (release notes). Upgrade your existing project to a stable Effect^4.1.0release (such aseffect@4.1.6) and verify its tests pass before converting files to.vibe. - Published libraries: Keep
vibelang-runtime(andvibelangif launching source children viavibelang/registerorvibelang/bun) in productiondependenciesat a registry version, not a localfile:path.
2. Install the packages
No transitive @effect/platform-node-shared override or resolution is needed — any stable ^4.1.0 Effect release works out of the box.
Install with Bun:
bun add vibelang-runtime@0.0.15 effect@^4.1.6 @effect/platform-node@^4.1.6
bun add -d vibelang@0.0.15 vibelang-vite@0.0.15 vitest@5.1.0 @effect/vitest@^4.1.6Or with npm:
npm install vibelang-runtime@0.0.15 effect@^4.1.6 @effect/platform-node@^4.1.6
npm install --save-dev vibelang@0.0.15 vibelang-vite@0.0.15 vitest@5.1.0 @effect/vitest@^4.1.6With pnpm, allow dprint's install script in pnpm-workspace.yaml (pnpm 11+ fails with ERR_PNPM_IGNORED_BUILDS otherwise):
allowBuilds:
dprint: truepnpm add vibelang-runtime@0.0.15 effect@^4.1.6 @effect/platform-node@^4.1.6
pnpm add --save-dev vibelang@0.0.15 vibelang-vite@0.0.15 vitest@5.1.0 @effect/vitest@^4.1.6Yarn — use the node_modules linker (Yarn 2+: add nodeLinker: node-modules to .yarnrc.yml) and install vite explicitly if not already on Vite 7 or 8:
nodeLinker: node-modulesyarn add vibelang-runtime@0.0.15 effect@^4.1.6 @effect/platform-node@^4.1.6
yarn add --dev vibelang@0.0.15 vibelang-vite@0.0.15 vitest@5.1.0 @effect/vitest@^4.1.6
yarn add --dev vite@8| Package | Install as | Purpose |
|---|---|---|
vibelang-runtime | Dependency | Small helpers used by compiled code |
effect, @effect/platform-node | Dependency | Effect ^4.1.0 (tested on 4.1.6) and Node platform |
vibelang | Dev dependency | Compiler, language server, native binary, and VS Code extension |
vibelang-vite | Dev dependency | Compiles .vibe modules for Vite and Vitest |
vitest, @effect/vitest | Dev dependency | Vitest 5.1.0 and @effect/vitest ^4.1.0 |
vite | Dev dependency | Vite 7 or 8 (explicit peer for Yarn) |
Keep vibelang, vibelang-runtime, and vibelang-vite at one version, keep effect and @effect/platform-* on stable ^4.1.0 releases, and keep optional dependencies enabled so vibelang installs its platform binary.
VibeLang uses TypeScript 7, which rejects removed options such as moduleResolution: "node" / "node10" and baseUrl (TS5108 / TS5102); see the TypeScript 7 migration notes.
3. Check the compiler
npx vibelang --versionVibeLang 0.0.15 (TypeScript 7.1.0-dev)4. Port Effect TypeScript files
Rename an Effect .ts file to .vibe (or .tsx to .vibex) and check it:
npx vibelang -p tsconfig.json --noEmit- TypeScript-style Effect code: Library calls keep working in
.vibe(TypeScript-style Effect code). A pipedEffect.gen(...)also works. You can write the same program as aneffect functionwithprovideandtry. For retired syntax from earlier releases, see Migrating retired forms. - Relative imports and sidecars: Replace stale
./user.tsimports that point to a renameduser.vibewith./user.vibeor./user.js(CLI setup).vibelangwrites adjacent.d.vibe.tsdeclarations even with--noEmit(let TypeScript tools read .vibe modules). - Monorepos & project references: When migrating referenced packages, compile and revert steps refresh affected projects automatically. They follow the reverse reference closure, clear affected outputs, and rebuild reference roots before checking dependents. For native checking with Bun (
bun check --no-script), route tovibelang --noEmit(orvibelang -bin build mode).
Next
- Coding agents: run
npx vibelang agents init(Coding agents). - Build setup: React, Vue, or Svelte with Vite; Vite and Vitest; Build with the vibelang CLI without a bundler; or step 3 of Set up VibeLang for other bundlers.
- Last resort: Only if you must keep TypeScript file names, consider the experimental TypeScript shim after reading its stock-tool limitations.