Alpha software. APIs may change between minor versions until 1.0. Pin your versions and check the changelog before upgrading.
Compile-time dependency injection for TypeScript. No reflect-metadata, no runtime scanning — just decorators and code generation.
Decorators (your code) → Transformer (compile-time) → Generated code → Runtime (ApplicationContext)
- You annotate classes with Stage 3 decorators (
@Singleton,@Injectable,@Inject, etc.) - At build time, a ts-morph transformer scans your code and generates a typed wiring file
- At runtime,
ApplicationContextresolves the dependency graph from the generated definitions
The result: full DI with zero runtime reflection, type-safe tokens, and instant startup.
- Node.js >= 22
- TypeScript >= 5.7
- pnpm >= 10 (for workspace consumers)
pnpm add @goodie-ts/core @goodie-ts/decorators
pnpm add -D @goodie-ts/transformer @goodie-ts/vite-pluginimport { Singleton, Inject } from '@goodie-ts/decorators';
@Singleton()
class UserRepository {
findAll() { return [{ id: '1', name: 'Alice' }]; }
}
@Singleton()
class UserService {
@Inject() accessor userRepo!: UserRepository;
getUsers() { return this.userRepo.findAll(); }
}// vite.config.ts
import { defineConfig } from 'vite';
import { diPlugin } from '@goodie-ts/vite-plugin';
export default defineConfig({
plugins: [diPlugin()],
});import { Goodie } from '@goodie-ts/core';
import { definitions } from './AppContext.generated.js';
const app = await Goodie.build(definitions).start();
const userService = app.context.get(UserService);| Package | Description |
|---|---|
@goodie-ts/core |
Runtime container, ApplicationContext, InjectionToken, topological sort |
@goodie-ts/decorators |
@Singleton, @Injectable, @Inject, @Value, @Module, @Provides, and more |
@goodie-ts/transformer |
ts-morph scanner and code generator (build-time only) |
@goodie-ts/cli |
CLI tool — goodie generate with watch mode |
@goodie-ts/vite-plugin |
Vite integration — runs transformer on build and HMR |
@goodie-ts/testing |
TestContext with bean overrides and @MockDefinition |
| Package | Description |
|---|---|
@goodie-ts/aop |
AOP foundation — createAopDecorator, @Before, @Around, @After, interceptor chain |
@goodie-ts/cache |
In-memory caching — @Cacheable, @CacheEvict, @CachePut |
@goodie-ts/config |
Configuration binding — @ConfigurationProperties |
@goodie-ts/hono |
HTTP routing — @Controller, @Get, @Post, @Put, @Delete, @Patch |
@goodie-ts/kysely |
Kysely integration — @Transactional, @Migration, CrudRepository |
@goodie-ts/logging |
Method logging — @Log, LoggerFactory, MDC |
@goodie-ts/health |
Health checks — HealthIndicator, HealthAggregator, UptimeHealthIndicator |
@goodie-ts/resilience |
Resilience patterns — @Retryable, @CircuitBreaker, @Timeout |
pnpm build # Build all packages
pnpm test # Run all tests (vitest)
pnpm test:watch # Watch mode
pnpm lint # Check with Biome
pnpm lint:fix # Auto-fix lint issues
pnpm clean # Clean all dist/