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 🙏

© 2025 – Pkg Stats / Ryan Hefner

janpa-js

v0.0.21

Published

janpa-ts is a framework built around express.js that helps build a clean code rest api

Readme

logo

Small, simple express.js extension built in TypeScript that helps you develop your project with clean and straightforward architecture

Basic usage

Example project index.ts file where we define our server:

JanpaServerRunner.builder()
	.addExpressBase(ExpressServer)
	.registerService(server  => {
		server.registerService(DatabaseService);
		server.registerService(UserService);
	})
	.registerController(server  => {
		server.registerController(UserController);
	})
	.startServer();

Let me explain the building process.

.addExpressBase(app: ExpressBase)

Every express server related things as: routes, middleware etc. will be based on given class that extends ExpressBase interface.

interface ExpressBase {
	app: Express;
	init(): Promise<Express>;
	start(): Promise<any>;
}

in init function app: Express instance must be created!

  this.app = express();

Janpa server calls init function, checks if app is created, adds decorated controller routes to app router and finally calls start method.

export  class  ExpressServer  implements  ExpressBase {

	app: Express;
	
	async  init(): Promise<any> {
		this.app = express();
		this.app.use((req, res: Response, next) => {
		res.header("Access-Control-Allow-Origin", "*");
	}

	async  start(): Promise<any> {
		this.app.use(async (req: Request, res: Response) => {
			res.sendStatus(404);
		});
		this.app.listen(conf.PORT, conf.HOST_NAME, 0, () => {
			console.log(`Express server is running on ${conf.HOST_NAME}:${conf.PORT}`);
		});
	}
}

Janpa server adds routes to app between init and start call so make sure that you don't add that not found route inside init method because it will override your routes.

.registerService(callback : (c: ServiceRegister) =>  any)

Adds services to janpa server dependency injection container - use as shown above in code, more on this later.

.registerController(callback: (c: ControllerRegister) =>  any)

Janpa server keeps track of all added controllers - It is needed to make route decorators work.

.startServer()

Janpa server calls given express base instance start method.

Why janpa-js makes your express project better?

Answer is simple - clean architecture. By using janpa-js your project structure is simpler.

Example suggested project structure:

- index.ts
/src
	/controller
		- UserController.ts
	/service
		- UserService.ts
	/model
		- User.ts

All added services to janpa server can be accessed by @Service() decorator inside your controller.

export  class  UserController {

	@Service()
	private  userService: UserService;

	@Get("/register")
	private  async  register(req: Request, res: Response): Promise<void> {
		try {
			this.userService.registerUser(requestToUser(req));
			res.sendStatus(200);
		} catch(e) {
			res.sendStatus(e.code).json(e.message);
		}
	}
}

You can use built in controller path decorator like:

	@Get("/route")
	@Post("/route")
	@Put("/route")
	@Delete("/route")

I know a lot of things are missing and somethings can be done much better but it is version 0.0.x so pls be patient. I'm still working on it 😎

If you somehow decide to use this tool and you have trouble using it you can contact me on