Stop wasting time on setup. Engineered to eliminate repetition. Instantly generate comprehensive Node.js/Express structures, seamlessly connecting routes, controllers, and folders..
Nodibranch (nb) is a lightweight CLI that removes the repetitive setup work from every new Express project. Initialize a full project structure, generate CRUD-ready routes and controllers, or just spin up a controller on its own — all from one command, or through a guided interactive menu.
- Interactive menu — Run
nbwith no arguments and navigate through a clean, description-rich interface - Full project init — Folder structure, templates,
.envfile, and dependency installation in one shot - Route & controller generation — Pair them together or generate each independently
- Granular method filtering — Use
--onlyor--exceptto include or exclude specific CRUD methods at generation time - CRUD out of the box — Every controller ships with
create,readOne,readAll,update, anddeletepre-wired
# for global installation
npm install -g nodibranch
# for local installation
npm install nodibranch
npx nodibranchAvailable as both nodibranch and the short alias nb.
The fastest way to get started — run with no arguments:
nbA guided menu walks you through every available action with live descriptions.
Sets up the full project structure: folders, templates, .env, and installs base dependencies automatically.
nb init
nb -i # shorthandCreates a route file in src/routes/ and its matching controller in src/controllers/.
# All CRUD methods
nb -r client
# Only the methods you need
nb -r client --only:create,readAll
# Everything except what you don't
nb -r client --except:deleteExample — nb -r client generates:
src/routes/clientRoutes.js
import { Router } from 'express';
import * as clientController from '../controllers/clientController.js';
const router = Router();
router.get('/', clientController.getAll);
router.get('/:id', clientController.getOne);
router.post('/', clientController.create);
router.put('/:id', clientController.update);
router.delete('/:id', clientController.remove);
export default router;src/controllers/clientController.js
export const create = async (req, res) => {
try {
res.status(201).json({
message: "smthng created successfully",
data: req.body
});
} catch (error) {
res.status(500).json({ error: error.message });
}
};
export const getOne = async (req, res) => {
try {
res.status(200).json({
message: "Fetch ... with ID successful",
data : "res here"
})
} catch (error) {
res.status(500).json({ error: error.message });
}
};
// ... getAll, update, removeCreates a standalone controller in src/controllers/.
nb -c client
# Only the methods you need
nb -c client --only:create,update
# Everything except what you don't
nb -c client --except:deleteExample — nb -c client --only:create,update generates:
src/controllers/clientController.js
export const create = async (req, res) => {
try {
res.status(201).json({
message: "smthng created successfully",
data: req.body
});
} catch (error) {
res.status(500).json({ error: error.message });
}
};
export const update = async (req, res) => {
try {
res.status(200).json({
message: "Update successful "
});
} catch (error) {
res.status(500).json({
error: error.message
});
}
};When you initialize a project with Nodibranch, the generated src/index.js automatically imports and registers all route files in the src/routes/ directory ending with Routes.js.
Each route is mounted on /api/<name> (where <name> is the route filename prefix in lowercase).
For example, generating nb -r client automatically registers the client route. You can call the endpoints as follows:
| HTTP Method | Endpoint | Controller Function | Description |
|---|---|---|---|
POST |
/api/client |
create |
Create a resource |
GET |
/api/client |
getAll |
Fetch all resources |
GET |
/api/client/:id |
getOne |
Fetch a single resource by ID |
PUT |
/api/client/:id |
update |
Update a resource |
DELETE |
/api/client/:id |
remove |
Remove a resource |
nb -h
nb help
# Command-specific help
nb init -h
nb -r -h
nb -c -hUsed with the --only and --except options:
| Filter Name | Generated Function Name | Description |
|---|---|---|
create |
create |
POST — create a resource |
readOne |
getOne |
GET — fetch a single resource by ID |
readAll |
getAll |
GET — fetch all resources |
update |
update |
PUT/PATCH — update a resource |
delete |
remove |
DELETE — remove a resource |
MIT
