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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@agutierrezt9410/express-ts-cli

v0.0.15

Published

CLI to generate express project with ts and dependency injection, using a n-tier architecture

Downloads

47

Readme

express-ts-cli

Library to generate a template of an express aplication using Typescript and dependency injection with tsyringe, the express app follows a n-tier architecture.

Table of Contents

Installing

Using npm:

$ npm install @agutierrezt9410/express-ts-cli -g

Using npx:

$ npx @agutierrezt9410/express-ts-cli -a Andres Gutierrez -n example

How to use

From your terminal or cmd you can use the command express-ts to create a new project based from the template, the cli can receive some parameters to customize the application generated.

  • -n --name: Required, the name of project, cli will create a folder inside the directory with the name supplied in the parameter, the name also would be used in the package.json.
  • -a, --author: Required, the name of the author of the project, this parameter would be used in the package.json.
  • -d, --description: Optional, the description of the project, this parameter would be used in the package.json.
  • -k, --keywords: Optional, array of keywords to be used in the package.json.
  • --help: Command that shows the cli options.

Folder structure

Once the command is successful a new folder with the name of the parameter would be generated, this folder constains the following content:

  • src: Folder where all the typescript content would be stored.
  • src/clients: Folder where the http clients should be created, the folder has a generic http client using axios.
  • src/controllers: Folder where the routes handlers of expres would be created through the use of decorators, a healthCheck controller is created with the generator.
  • src/db: Folder where the connections to the different data sources should be created.
  • src/db/models: Folder where the different models of the different datasources should be stored.
  • src/decorators: Folder where custom decorators are created, the template has some decorators to built-in, which ease the implementation of express.
  • src/dtos: Folder where the request and response DTOs should be created.
  • src/errors: Folder where the custom errors are stored.
  • src/middlewares: Folder where the express middleware should be stored, an error middleware is created with the template.
  • src/services: Folder where the services should be stored, this services hold the bussiness rules of project, an example service is created with the template.
  • src/types: Folder where the typescript types should be created.
  • src/utils: Folder where the constants and utility methods should be created.
  • src/ioc.ts: File where the IoC container would be configured.
  • src/server.ts: File where the express application is created.
  • src/index.ts: This file is the starting point of the project.

Example

$ express-ts -n example -a Andres Gutierrez
$ cd example
$ npm i
$ npm start

Or if you want to restart your server when there is change in your files you can run

$ npm run watch

Changelog

0.0.12 (January 29, 2022)

  • Added nodemon to restart server automatically.

Credits

This library is created for free use and with the goal of optimizing the setup process of an express project.

License

MIT