New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

create-node-backend-template

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-node-backend-template

A CLI tool to scaffold a Node.js backend project

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
0
-100%
Maintainers
0
Weekly downloads
 
Created
Source

Create Node Backend CLI

A CLI tool to scaffold Node.js backend projects with options for JavaScript or TypeScript templates. The generated project includes essential packages and follows a standard structure.

Features

  • Scaffold a Node.js backend project with JavaScript or TypeScript.
  • Includes essential packages such as express, dotenv, cors, and body-parser.
  • Sets up a standard project structure with folders for controllers, middlewares, models, routes, and services.
  • Automatically generates configuration files like .env, .gitignore, tsconfig.json, and package.json.

Prerequisites

  • Node.js (version 14.0.0 or later)
  • npm or yarn

Installation

Install the CLI globally:

npm install -g create-node-backend

Usage

To create a new node-backend, run the following command:

create-node-backend your-backend-name

You will be prompted to choose between a JavaScript or TypeScript template. Follow the prompts to set up your project.

Project Structure you get from the CLI

For TypeScript project template:

${your-project-name}/
├── src/
│   ├── controllers/
│   ├── middlewares/
│   ├── models/
│   ├── routes/
│   ├── services/
│   └── server.ts
├── .env
├── .gitignore
├── nodemon.json
├── package.json
├── tsconfig.json
└── README.md

For JavaScript project template:

${your-project-name}/
├── src/
│   ├── controllers/
│   ├── middlewares/
│   ├── models/
│   ├── routes/
│   ├── services/
│   └── app.js
├── .env
├── .gitignore
├── package.json
├── server.js
└── README.md

Scripts

The package.json includes the following scripts:

  • start: Start the production server.
  • dev: Start the development server with auto-reload (using nodemon for JavaScript or ts-node-dev for TypeScript).
  • build: Compile TypeScript to JavaScript (only if TypeScript is chosen).

Environment Variables

The .env file contains placeholders for the following environment variables:

  • PORT: The port number on which the server will run.
  • DATABASE_URL: The URL for the database connection.
  • SECRET_KEY: A secret key for signing tokens or other secrets.

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue.

License

This project is licensed under the MIT License.

Keywords

cli

FAQs

Package last updated on 22 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts