Skip to content

[Feature]: Lifetime Decorators #14

@Evanion

Description

@Evanion

What problem would this feature solve?

Allowing developers to declaratively set the lifetime of services (singleton, transient, scoped) improves ergonomics, aligns with top DI libraries, and makes service lifecycles explicit and easy to manage.

Proposed solution or design

Introduce decorators such as @Singleton, @Transient, and @Scoped, or provider options like { lifetime: 'singleton' | 'transient' | 'scoped' }. Store lifetime metadata at registration and resolve accordingly.

Additional context

See the NexusDI Roadmap: Lifetime Decorators for more details and proposed API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions