Skip to content

stormsidali2001/ioc-arise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

IoC Arise

Arise type-safe IoC containers from your code. Zero overhead, zero coupling.

A powerful TypeScript IoC container generator CLI tool that automatically creates type-safe dependency injection containers from your existing code. No decorators, no annotations, no manual wiring required.

npm version License: MIT Documentation

✨ Features

  • πŸš€ Zero Configuration - No decorators, annotations, or manual wiring required
  • πŸ”’ 100% Type Safe - Generated containers are fully typed with compile-time validation
  • ⚑ Blazing Fast - Powered by AST-grep (built with Rust) for lightning-fast analysis
  • 🎯 Smart Dependency Analysis - Automatically detects circular dependencies and missing implementations
  • πŸ—οΈ Modular Architecture - Organize code into logical modules with cross-module dependency support
  • πŸ”„ Zero Coupling - Your business logic stays clean and framework-agnostic
  • πŸ“Š Advanced Features - Supports scopes (singleton/transient), name collision handling, and more

πŸš€ Quick Start

Installation

# Install globally
npm install -g @notjustcoders/ioc-arise

# Or use with your package manager
pnpm add -D @notjustcoders/ioc-arise

Basic Usage

  1. Create your interfaces and classes:
// IUserService.ts
export interface IUserService {
  createUser(name: string, email: string): Promise<User>;
}

// UserService.ts
export class UserService implements IUserService {
  constructor(private userRepository: IUserRepository) {}
  
  async createUser(name: string, email: string): Promise<User> {
    // Implementation
  }
}
  1. Generate your container:
npx ioc-arise generate
  1. Use the generated container:
import { container } from './container.gen';

const userService = container.coreModule.UserService;
const user = await userService.createUser('John Doe', 'john@example.com');

πŸ“– Documentation

For comprehensive documentation, examples, and advanced usage patterns, visit:

🌐 ioc-arise.notjustcoders.com

Key Documentation Sections:

πŸ—οΈ Project Structure

This is a monorepo containing:

ioc-maker/
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ docs/                    # Documentation website (Astro + Starlight)
β”‚   └── ioc-maker-cli/           # CLI tool package
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ eslint-config/           # Shared ESLint configuration
β”‚   └── typescript-config/       # Shared TypeScript configuration
└── examples/                    # Example projects

πŸ› οΈ Development

Prerequisites

  • Node.js >= 18
  • pnpm (recommended package manager)

Setup

# Clone the repository
git clone https://github.com/spithacode/ioc-maker.git
cd ioc-maker

# Install dependencies
pnpm install

# Build all packages
pnpm build

# Start development
pnpm dev

Available Scripts

  • pnpm build - Build all packages
  • pnpm dev - Start development mode
  • pnpm lint - Run linting
  • pnpm format - Format code with Prettier
  • pnpm check-types - Type checking

Working with the CLI

# Navigate to CLI package
cd apps/ioc-maker-cli

# Build the CLI
pnpm build

# Test with examples
pnpm test1:generate  # Clean architecture example
pnpm test2:generate  # Circular dependencies example
pnpm test3:generate  # Simple modules example
# ... more test scripts available

Working with Documentation

# Navigate to docs
cd apps/docs

# Start development server
pnpm dev

# Build for production
pnpm build

πŸ“ Examples

The repository includes comprehensive examples demonstrating various patterns:

  • Minimal Todo - Basic repository pattern
  • Simple Modules - Cross-module dependencies
  • Clean Architecture - Advanced architectural patterns
  • Use Cases - Classes without interfaces
  • Name Collision - Handling duplicate class names
  • Circular Dependencies - Error detection and handling
  • Scope Management - Singleton vs Transient lifecycles

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ”— Links

πŸ™ Acknowledgments


Made with ❀️ by the NotJustCoders team

About

Arise type-safe IoC containers from your code. Zero overhead, zero coupling.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •