Cover image for Bootstrap your express project with express api cli

Bootstrap your express project with express api cli

tolustar profile image tolustar Originally published at tolustar.com on ・4 min read

The Express framework is a popular framework in the NodeJs community. It powers many applications on the internet and it is loved by many because of its simplicity, it is less opinionated, and the ability to develop APIs quickly.

Setting up a new project for a medium-sized application could be time-consuming with the Express framework because it is a minimalist framework, but there is a new tool that can speed up the setup process of a new express project. The new tool is called express-api-cli, With the express-api-cli tool, you can start a new project with just three short words on your command line terminal and your project is immediately ready for development

Express api cli allows you to create a new project within minutes with little or no configuration. You create your project and you start developing your business logic right away.

How to get started

  1. Ensure you have NodeJs and NPM installed on your computer
  2. Open your command-line tool and run npm install -g express-api-cli command – this installs the express-api-cli globally on your computer.
  3. To create a new project run exp-api create awesome-project. Replace *awesome-project * with the name of your project
  4. Follow the instructions to select the type of project you want to create.
  5. Voila, your project is ready for development !!!


For more express-api-cli Commands visit https://www.npmjs.com/package/express-api-cli


Features of express-api-cli

  1. Express-api-cli generated project contains packages that have been configured to ensure you don’t need to waste extra time configuring them. These packages have been carefully selected and configured to ensure that your application is robust. Express-api-cli generated project contains the following packages
    1. Typescript – Typescript is a superset of javascript that adds optional static typing to javascript. During project creation, you are requested to select either Javascript or Typescript, if you select Typescript, it will be installed and configured in your project, if you don’t it will not be configured.
    2. Mongoose – Mongoose is a MongoDB Object Data Modelling Library. It manages communication between your project and your MongoDB database, it also provides schema validation, etc. Mongoose provides a lot of out of the box features to ensure that communication with your database is seamless. It is also optional during installation.
    3. Sequelize – Sequelize is an Object Relational Mapping framework for MySql, Postgres, SQLite, and Microsoft SQL Server. It provides seamless communication with the aforementioned databases. Note: During the creation of a new project, you either select Mongoose or Sequelize
    4. Validation – Validation is readily configured in the project to validate incoming requests. Validation is made available by @hapi/joi
    5. Exception Middleware – There is a centralized exception middleware to handle all forms of errors in your project.
    6. Logging – Logging errors in an api application is very important, in an express-api-cli generated project all incoming requests and error exceptions are logged in a log folder. This ensures that debugging is made easy when your project goes live. Logging is made available thanks to Winston and Morgan
    7. Security – With the help of Helmet and cors, your project there as an added level of security Integrated into your project
    8. Authentication – Express-api-cli uses JsonWebToken to provide authentication in your project
    9. Test environment – Testing suites have been packaged with the express-api-cli project and readily configured. All you just need to do is to start writing tests right away. The following make up the test suite
    10. Mocha is a feature-rich javascript framework for easy testing
    11. Chai is an assertion library that integrates well with mocha
    12. NYC is a tool that checks for test coverage in the project
    13. Supertest is a library for testing HTTP servers
    14. Code Formatting – A codebase with ugly formatting is difficult to read and understand. Also working in a team with different formatting rules configured on each co-worker machine can be frustrating, because each co-worker will reformat the codebase based on the machine prettier formatting configuration. To mitigate this, express-api-cli comes with a configured eslint and prettier rules, to ensure there is uniformity in the project
  2. Set up a new project in less than 5 minutes
  3. Generate controller, router, service files right from the command line
  4. Well formatted and clean code structure

Speed up your new project setup with the express-api-cli tool

Advantages of using the express-api-cli

  1. Start a new project faster with pre-configured packages
  2. Reduce time taken to configure your project
  3. Express-api-cli allows you to generate different files for different parts of your project such as (controller, services, routes, test), etc

Express-api-cli is an awesome tool for every Express Developer.

When next you have a new project, set it up using the express-api-cli tool so that you don’t waste time in the configuration process


The post Bootstrap your express project with express api cli appeared first on Tolustar.

Posted on by:


Editor guide