Skip to content
Vite Plugin · DI Framework

Compile-time

Dependency Injection.

Zero runtime reflection. Alloy resolves your dependency graph at build time — generating a static, type-safe container that ships nothing it doesn't use.

Get started → Why Alloy?
vite.config.ts
import { defineConfig } from 'vite'
import { alloy } from 'alloy-di/vite'

export default defineConfig({
  plugins: [
    alloy({
      providers: ['src/providers.ts'],
    }),
  ],
})
Core capabilities
Build-time

Compile-time resolution

Scans your source at build time to emit a static dependency graph. Zero reflection, zero runtime overhead.

Code-split

First-class lazy loading

Granular code-splitting per service via Lazy() and dynamic imports. Pay only for what's needed.

Framework agnostic

Works with React, Vue, Svelte, or vanilla TypeScript. It's just a Vite plugin.

Fully type-safe

Generates TypeScript definitions for all service identifiers. Your IDE knows the full graph.