Open source · vishwajit-vm Contracts v0 built
Strutvane Core & Contracts
The kernel, and the shared types every package speaks
The foundation of Strutvane. @strutvane/contracts holds the shared types and wire protocols — Actor, Permission, TenantContext, QueryFilter, ListQuery, Problem, ResourceManifest, AuditEvent and more — with zero runtime dependencies; it is the only thing the product packages share, and its v0 is built and fully tested. @strutvane/core is the kernel every app boots on: lifecycle, a typed service container, providers, validated config and per-request context.
Built for: Package and plugin authors, and advanced app developers.
Packages on npm
@strutvane/contracts↗v0 built and tested · release pending@strutvane/core↗Kernel · github.com/vishwajit-vm/strutvane-core · Phase 1
↓ Scroll to explore the problem, architecture and stack
The problem
Plugin ecosystems usually couple packages directly, so one upgrade cascades into all the others — and loosely typed shared objects let mistakes (like comparing a filter value to null) slip into production.
Why it matters
A small, strictly versioned contracts package lets framework, auth and UI evolve independently, and its types are designed so misuse fails to compile.
What you can do with it
How it’s built
A simplified view of the architecture — follow the dots as a request moves down the layers.
A request, step by step
- createApp starts the kernel; each package’s provider registers its services, then all providers boot.
- Packages import contract types only — never each other.
- The container resolves the real implementation, for example the PermissionProvider supplied by auth.
- Per-request context (request id, trace id, actor, tenant, locale) flows implicitly through AsyncLocalStorage.
- The same contract shapes travel over HTTP, so the UI understands every API the same way.
Tech stack
What I built
- Built @strutvane/contracts v0: 14 source files, runtime and type-level tests (Vitest type tests), 100% coverage and a publint-clean build via tsdown.
- Its CI runs Biome, TypeScript, Vitest with coverage, then the build — on every change.
- Designed types that make misuse a compile error, such as comparing against null or using a permission without a dot.
- Kept it validator-agnostic through Standard Schema, with no dependency, under strict semver with at most one major version a year.
- Specified @strutvane/core: a decorator-free typed token container, defineProvider, frozen validated env, typed hooks and events, and a compiled registry instead of runtime file scanning for fast cold starts.
Hard problems & how I solved them
✅ Type-level tests prove that wrong usages fail to compile.
✅ A typed token container: services are registered and resolved by typed tokens, fully checked by TypeScript.