Installations
npm install 4brains-node-generator
Developer Guide
Typescript
No
Module System
ESM
Node Version
22.11.0
NPM Version
10.9.0
Score
73.1
Supply Chain
98.6
Quality
88
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (96.29%)
HTML (3.71%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
pawan-4brains
Download Statistics
Total Downloads
18,056
Last Day
1
Last Week
31
Last Month
393
Last Year
18,056
GitHub Statistics
4 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Jul 06, 2024
Bundle Size
7.30 kB
Minified
2.37 kB
Minified + Gzipped
Package Meta Information
Latest Version
3.4.9
Package Id
4brains-node-generator@3.4.9
Unpacked Size
77.45 kB
Size
14.22 kB
File Count
21
NPM Version
10.9.0
Node Version
22.11.0
Published on
Jan 05, 2025
Total Downloads
Cumulative downloads
Total Downloads
18,056
Last Day
0%
1
Compared to previous day
Last Week
-73%
31
Compared to previous week
Last Month
-63.5%
393
Compared to previous month
Last Year
0%
18,056
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
4Brains Node Generator
A comprehensive CLI tool to streamline the generation and management of Node.js applications by 4Brains Technologies.
Installation
To install the 4Brains Node Generator globally, use the following command:
1npm install -g 4brains-node-generator
Available Commands
node-app init <projectName>
Initialize a new Node.js project with the specified name.
1node-app init my-project
node-app add-api <endpointName>
Add a new API endpoint to your project.
1node-app add-api users
node-app add-mongo
Integrate MongoDB into your project. This command sets up the necessary MongoDB configuration.
1node-app add-mongo
node-app add-mongo-schema <schemaName>
Create a new MongoDB schema. You will be prompted to enter field details for the schema.
1node-app add-mongo-schema User
node-app 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.
1node-app add-login
node-app add-mongo-insert
Add a template for inserting data into a MongoDB collection. This command allows you to easily create routes for data insertion.
1node-app add-mongo-insert
node-app add-mongo-update
Add a template for updating data in a MongoDB collection. This facilitates creating routes for updating documents.
1node-app add-mongo-update
node-app add-mongo-read
Add a template for reading data from a MongoDB collection, helping you to quickly set up read operations.
1node-app add-mongo-read
node-app add-mongo-delete
Add a template for deleting data from a MongoDB collection, making it easy to handle deletion operations.
1node-app add-mongo-delete
node-app add-socket
Integrate Socket.io into your project for real-time communication capabilities.
1node-app add-socket
node-app add-websocket
Add native WebSocket support to your project.
1node-app add-websocket
Examples
Adding MongoDB Schema
When you run the command to add a MongoDB schema, you will be prompted to enter the field details.
1node-app 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.
1node-app add-login
Real-time Communication Integration
WebSocket Integration
When you add WebSocket integration, it will automatically be added to your project.
1node-app add-websocket
To use req.wss
in your route endpoints, you can access the WebSocket server as follows:
1router.get("/some-endpoint", (req, res) => { 2 req.wss.clients.forEach((client) => { 3 if (client.readyState === WebSocket.OPEN) { 4 client.send("Hello, client!"); 5 } 6 }); 7 res.send("Message sent to all WebSocket clients."); 8});
Socket.io Integration
When you add Socket.io integration, it will automatically be added to your project.
1node-app add-socket
To use req.io
in your route endpoints, you can access the Socket.io server as follows:
1router.get("/some-endpoint", (req, res) => { 2 req.io.emit("message", "Hello, Socket.io clients!"); 3 res.send("Message sent to all Socket.io clients."); 4});
Help
If you enter an invalid command, you will see the following message:
1Unknown command. Use -h or --help for help.
You can also use -h
or --help
to get help information.
1node-app -h 2node-app --help
License
This project is licensed under the ISC License.

No vulnerabilities found.

No security vulnerabilities found.