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

create-node-app-cli

v1.1.0

Published

CLI to scaffold a Node.js project with optional frameworks, databases, ORMs, TypeScript, and Swagger docs configuration

Downloads

13

Readme

create-node-app-cli

create-node-app-cli is a powerful CLI tool that helps developers quickly scaffold a Node.js project with integrated database configuration, ORM setup, and optional TypeScript support. The tool also includes support for popular frameworks such as Express, Fastify, and Nest, as well as built-in Swagger documentation configuration for API development.

Features

  • Framework Choices: Select from popular Node.js frameworks like Express, Fastify, and Nest.
  • Database Integration: Set up MongoDB, PostgreSQL, or MySQL with ease.
  • ORM Support: Automatically configure ORM like Mongoose, Prisma, or DrizzleORM.
  • TypeScript or JavaScript: Choose whether to set up the project with TypeScript or JavaScript.
  • Swagger Documentation: Automatically includes Swagger API docs setup with customizable folder structure for your APIs endpoint and Schemas.
  • Linting and Formatting: Integrated ESLint and Prettier setup for code quality.
  • Environment Configuration: Pre-configured .env sample file for setting up environment variables.
  • Robust Error Handler: Returns a structured JSON response that directly points to where the error originates.
{
  "success": false,
  "message": "Directly pointing to where the error is coming from"
}

Getting Started

Prerequisites

Make sure you have the following installed:

  • Node.js (v14 or higher)
  • npm

Installation

You can install create-node-app-cli via npx:

Usage

npx create-node-app-cli@latest new

After running the command, follow the prompts to configure your project you'll be asked to select: Framework: Express, Fastify, or Nest. Database: MongoDB, PostgreSQL, or MySQL. ORM: Mongoose, Prisma, or DrizzleORM. TypeScript or JavaScript.

Folder Structure

The CLI generates a project with the following folder structure

my-app/
│
├── src/
│   ├── controllers/
│   ├── routes/
│   ├── mails/
│   ├── middleware/
|   |   └── async-error.ts/
|   |   └── error.ts/
│   ├── services/
│   ├── schemas/
│   ├── swagger-docs/
│   │   ├── swagger-api-docs/
|   |   |   ├── sample-api.yaml
│   │   └── swagger-schema-docs/
|   |   |   ├── sample-schema.yaml
│   └── utils/
|   |   ├── db.ts
|   |   ├── error-handler.ts
│   └── app.ts
|   └── server.ts
├── .env.sample
├── .gitignore
├── package.json
├── tsconfig.json (if using TypeScript)
└── README.md

Swagger Documentation

The project includes built-in Swagger documentation configuration to help you document and visualize your API. By default, the Swagger docs are available at:

    /api-docs

Environment Variables

You can configure your environment by copying the .env.sample file to .env and setting the appropriate values for your project.

    cp .env.sample .env

Available Scripts

Here are some useful npm scripts to help you manage the project:

  • Start the development server:

    npm run dev
  • Build the project:

    npm run build
  • Lint your code:

    npm run lint

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Commit your changes (git commit -m 'Add some feature').
  4. Push to the branch (git push origin feature-branch).
  5. Open a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.