Quick Start
$ npx 4bnode init my-app $ cd my-app $ npm run dev
Your app runs at http://localhost:3000 with a built-in visual dashboard at http://localhost:3000/_dev.
CLI Commands
Create a Project
$ npx 4bnode init <name>
Scaffolds a new Express project with:
- ES Module syntax
- Environment config (
.env.development,.env.production) - CORS, JSON body parser (50MB limit)
- Static file serving from
public/ - Built-in dev dashboard at
/_dev
Add Features
Use the interactive menu:
$ npx 4bnode add
Or add directly:
| Command | Description |
|---|---|
4bnode add api <name> | Create a new API endpoint |
4bnode add mongo | Configure MongoDB connection |
4bnode add crud | Add CRUD operations to a route |
4bnode add login | Add JWT authentication & login |
4bnode add socket | Integrate Socket.IO |
4bnode add websocket | Add native WebSocket support |
4bnode add serialport | Serial port communication |
API Endpoint Creation
$ 4bnode add api users
When creating an API endpoint:
- Select HTTP method (GET, POST, PUT, DELETE, PATCH)
- Choose fields from existing model (if available)
- Add custom fields received from client
- File fields auto-configure
multerfor multipart uploads - All routes use
/api/prefix
Schema Management
$ 4bnode schema # Interactive create/view/edit $ 4bnode schema user # Create or edit 'user' schema
Supported field types: String, Number, Boolean, Date, Array, ObjectId, Mixed, Buffer
Field constraints: required, unique, default
Presets available: user, product, post
List Project Info
$ 4bnode list # Show all models, routes & config $ 4bnode list models # List models only $ 4bnode list routes # List routes only
Update 4bnode
To update to the latest version of 4bnode, run:
$ npx 4bnode@latest
Dashboard Passkey
During npx 4bnode init, you'll be prompted to set a 6-digit passkey to protect the dev dashboard.
To change the passkey later, run inside your project:
$ 4bnode passkey
Start Dev Dashboard
$ 4bnode ui
Runs npm run dev and opens the visual dashboard. Must be run inside a 4bnode project.
Visual Dashboard
Access at http://localhost:3000/_dev when running npm run dev. A full-featured development environment built right into your app.
Overview
Project status, configured features, and quick stats at a glance.
Database
MongoDB connection setup and URI management. Connect, disconnect, and monitor your database.
Schemas
Create, view, and edit MongoDB schemas with visual field management. Add/remove fields, toggle required/unique, set defaults.
Environment
View and edit .env.development and .env.production files directly from the dashboard.
API Routes
Full route management with visual controls:
- Create new routes (Methods, CRUD, Login, Register)
- Add methods to existing routes with field selection
- Select fields from models or add custom fields
- File upload fields auto-configure multer
- View route source code, edit inline
- Share endpoint docs with frontend team (Markdown format)
- Delete routes (removes file + index.js registration)
API Tester
Built-in Postman-like API testing tool with REST, Socket.IO, and WebSocket support.
- Body types: JSON, Form Data, URL Encoded, Raw, Binary
- File uploads: Choose file, send as File or Base64
- Auto-detect fields: Matches URL to route and pre-fills body/form fields from route code
- Path variables: Auto-detects
:idparams, shows editable fields - Query params: Key-value editor, auto-fills from
req.query - Headers: Key-value editor with quick presets (Bearer Auth, JSON, Form Data, URL Encoded, Accept)
- Response viewer: Body + Headers tabs, copy response, save responses
- Collection management: Save requests, organize with responses, delete with confirmation
- Import from routes: One-click import endpoints from your project routes
- All data persisted in
.4bnode/JSON files (not localStorage)
Share Collection
Generate a shareable API documentation page:
Reports
Export MongoDB data as styled Excel (.xlsx) reports.
- Select models and fields to include
- Populate referenced ObjectId fields
- Custom column headers and prefixes
- Drag-and-drop column reordering
- Configurable date format & timezone
- Preview before download
Logs
Real-time server log monitoring via SSE.
- Filter by type (LOG, INFO, WARN, ERROR)
- Search through log entries
- Auto-scroll with toggle
- Keeps last 500 entries
Real-time
Socket.IO and WebSocket configuration panel. Set up real-time communication in seconds.
SerialPort
Serial port setup with path and baud rate config. Communicate with hardware devices directly.
Generated Project Structure
Real-time Communication
Socket.IO
$ 4bnode add socket
Access in routes via req.io:
router.get('/notify', (req, res) => { req.io.emit('message', 'Hello from server'); res.json({ sent: true }); });
WebSocket
$ 4bnode add websocket
Access in routes via req.wss:
router.get('/broadcast', (req, res) => { req.wss.clients.forEach(client => { if (client.readyState === WebSocket.OPEN) { client.send('Hello from server'); } }); res.json({ sent: true }); });
Help
$ 4bnode -h $ 4bnode --help
License
Proprietary License
© 2025 4Brains Technologies. All rights reserved.
Unauthorized copying, distribution, modification, or use of this code is strictly prohibited.
For licensing or commercial use: contact@4brains.in