1.1.1 • Published 5 months ago

4bnode v1.1.1

Weekly downloads
-
License
Proprietary
Repository
github
Last release
5 months ago

4Brains Node Tool

A professional tool to streamline the generation and management of Node.js applications by 4Brains Technologies.

Usage via NPX

No global installation needed.

Run any command using npx:

npx 4bnode <command>

Examples:

npx 4bnode init my-project
npx 4bnode add-mongo
npx 4bnode add-serialport

Available Commands

npx 4bnode init <projectName>

Initialize a new Node.js project with the specified name.

npx 4bnode init my-project

npx 4bnode add-api <endpointName>

Add a new API endpoint to your project.

npx 4bnode add-api users

npx 4bnode add-mongo

Integrate MongoDB into your project. This command sets up the necessary MongoDB configuration.

npx 4bnode add-mongo

npx 4bnode add-mongo-schema <schemaName>

Create a new MongoDB schema. You will be prompted to enter field details for the schema.

npx 4bnode add-mongo-schema User

npx 4bnode add-login

Add a login template to an existing route in your project. You will be prompted to select a route and a model, and then enter the login fields.

npx 4bnode add-login

npx 4bnode add-mongo-insert

Add a template for inserting data into a MongoDB collection. This command allows you to easily create routes for data insertion.

npx 4bnode add-mongo-insert

npx 4bnode add-mongo-update

Add a template for updating data in a MongoDB collection. This facilitates creating routes for updating documents.

npx 4bnode add-mongo-update

npx 4bnode add-mongo-read

Add a template for reading data from a MongoDB collection, helping you to quickly set up read operations.

npx 4bnode add-mongo-read

npx 4bnode add-mongo-delete

Add a template for deleting data from a MongoDB collection, making it easy to handle deletion operations.

npx 4bnode add-mongo-delete

npx 4bnode add-socket

Integrate Socket.io into your project for real-time communication capabilities.

npx 4bnode add-socket

npx 4bnode add-websocket

Add native WebSocket support to your project.

npx 4bnode add-websocket

npx 4bnode add-serialport

Integrate SerialPort functionality into your project. This command does the following:

  • Prompts for Serial Port path and baud rate
  • Automatically updates .env.development and .env.production with SERIALPORT_PATH and BAUDRATE
  • Adds SerialPort and Readline parser setup to your index.js
  • Installs required dependencies: serialport and @serialport/parser-readline
npx 4bnode add-serialport

Once added, your project will automatically initialize the serial port with the specified configuration and log incoming data.

Example incoming data log:

Received data: <data from serial device>

Examples

Adding MongoDB Schema

When you run the command to add a MongoDB schema, you will be prompted to enter the field details.

npx 4bnode add-mongo-schema User

Adding a Login Template

When you run the command to add a login template, you will be prompted to select a route and a model, and then enter the login fields.

npx 4bnode add-login

Real-time Communication Integration

WebSocket Integration

When you add WebSocket integration, it will automatically be added to your project.

npx 4bnode add-websocket

To use req.wss in your route endpoints, you can access the WebSocket server as follows:

router.get("/some-endpoint", (req, res) => {
  req.wss.clients.forEach((client) => {
    if (client.readyState === WebSocket.OPEN) {
      client.send("Hello, client!");
    }
  });
  res.send("Message sent to all WebSocket clients.");
});

Socket.io Integration

When you add Socket.io integration, it will automatically be added to your project.

npx 4bnode add-socket

To use req.io in your route endpoints, you can access the Socket.io server as follows:

router.get("/some-endpoint", (req, res) => {
  req.io.emit("message", "Hello, Socket.io clients!");
  res.send("Message sent to all Socket.io clients.");
});

Help

If you enter an invalid command, you will see the following message:

Unknown command. Use -h or --help for help.

You can also use -h or --help to get help information.

npx 4bnode -h
npx 4bnode --help

License

Proprietary License

© 2025 4Brains Technologies. All rights reserved.

This software is proprietary and confidential. Unauthorized copying, distribution, modification, or use of this code, in whole or in part, is strictly prohibited.

The contents of this package may not be used for any purpose without the express written permission of 4Brains Technologies.

For licensing or commercial use inquiries, contact: contact@4brains.in

1.1.1

5 months ago

1.1.0

5 months ago

1.0.9

5 months ago

1.0.8

5 months ago

1.0.7

5 months ago

1.0.6

5 months ago

1.0.5

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago

3.5.3

5 months ago

3.5.2

5 months ago