npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

thespringway

v1.0.4

Published

Package that add the @Service and @Repository in typescript like a Spring Framework

Readme

The Spring Way

This project is a lightweight annotation-based utility that brings Spring Boot-style notation to TypeScript. It is designed for developers coming from the Spring Boot ecosystem who want a smoother transition to TS while keeping a familiar architectural style.

Installation

npm install thespringway

Usage

This package provides two decorators, @Repository and @Service, which can be integrated as shown below (example only).

Setup

First you need to add the following configuration to your tsconfig.json file:

{
    "compilerOptions": {
        "experimentalDecorators": true,
		"emitDecoratorMetadata": true,
    	"target": "ES2020",
    }
}

Services

In this case, simply adding the @Service() annotation is enough.

import { Service } from 'thespringway'

@Service()
export class LoginUseCase {
    constructor(
        private readonly repository: AuthRepository,
        private readonly crypt: CryptRepository,
        private readonly jwt: JwtRepository
    ) {}

    async login(input: LoginInput): Promise<LoginOutput> {
        const user = this.repository.getByEmail(input.email)

        if (!user || !user.active || !user.password) throw new Error('User not found')
        if (!(this.crypt.compare(input.passwowrd, user.password))) throw new Error('Password incorrect')

        return {
            token: this.jwt.sign(user),
            session: user
        }
    }
}

Repositories

Here we define two classes: one for the repository contract and another for its final implementation with the corresponding annotation.

import { Repository } from 'thespringway'

export abstract class AuthRepository {
    abstract getByEmail(email: string): AuthStore | null
}


@Repository(AuthRepository)
export class LocalAuthRepository extends AuthRepository {

    getByEmail(email: string): AuthStore | null{
        if (email !== '[email protected]') return null

        return {
            id: 1,
            name: 'admin',
            email: '[email protected]',
            password: '$2a$10$hXTzALcJ5a6tscposYW81OSMbXxrORVllKj4WGKpnazCbFWE3p.2W',
            active: true
        }
    }
}

Final Usage

To use the service/use case, call the resolve function included in the package. It resolves and injects the service dependencies automatically.

import { resolve } from 'thespringway'

const loginUseCase = resolve(LoginUseCase)

loginUseCase.login({ email: '[email protected]', password: 'password' })