Skip to content
Vite Plugin · DI Framework

Build-time

Dependency Injection.

Build-time safety, 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
Performance

First-class lazy loading

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

Compatibility

Framework agnostic

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

Build-time

Static resolution

Alloy scans your source at build time to emit a static dependency graph — no reflection, minimal runtime.

Build-time

Visualized graph

Because the whole graph is known ahead of time, Alloy emits a Mermaid diagram of your services.

Safety

Errors caught at build time

Circular dependencies and duplicate registrations fail the build — not a request in production.

Safety

Fully type-safe

Generates TypeScript definitions for every service identifier. Your IDE knows the whole graph.