nodex_gen
v1.0.2
Published
A Node.js project generator CLI tool to quickly scaffold Express applications with authentication, configurations, and pre-installed dependencies.
Maintainers
Readme
Nodex Gen - Node.js Project Generator 🚀
Nodex Gen is a comprehensive and interactive Command Line Interface (CLI) tool crafted to streamline the process of bootstrapping Node.js applications. It eliminates the repetitive setup of folders, configuration files, and core dependencies, allowing you to focus immediately on building business logic.
Whether you are a beginner looking for a best-practice starting point or an experienced developer needing a quick prototype, Nodex Gen has you covered.
🌟 Why Nodex Gen?
- ⚡ Efficiency: Save 15-30 minutes of setup time per project.
- 🏗️ Standards: Starts your project with a clean, industry-standard Model-Controller-Service architecture.
- 🛡️ Security: "With Auth" mode provides robust security features (Password Hashing, JWT, standard headers) out of the box.
- 📘 TypeScript Support: First-class support for TypeScript with a pre-configured
tsconfig.jsonand strict type safety settings.
✨ Key Features
1. 🖥️ Interactive Setup
Forget remembering long command-line arguments. Our CLI guides you through every step:
- Project Naming: Sets up your package.json name.
- Language: One-click selection between JavaScript (ES6+ via CommonJS) or TypeScript.
- Authentication: Choose a full auth scaffold or a blank slate.
- Package Selection: Interactively toggle libraries like Mongoose, CORS, Dotenv, etc.
2. 🔐 Built-in Authentication System
If you choose "With Auth", you get a production-ready auth module:
- User Model: Complete Mongoose schema with validation.
- Secure Passwords: Automatic hashing using
bcryptjs. - JWT & Sessions: Stateless authentication with JSON Web Tokens.
- Flows:
- Registration with Email Verification.
- Login & Logout.
- Password Reset & OTP implementation.
- Protected Route Middleware.
3. 📂 Modular Architecture
The generated project organization promotes scalability:
src/controllers: Handles incoming HTTP requests and responses.src/services: Contains business logic, keeping controllers clean.src/models: Database schemas (Mongoose).src/routes: API route definitions.src/middlewares: Express middlewares (Auth, Error Handling, Logging).src/config: centralized configuration (DB connection, Nodemailer, etc.).
4. ⚙️ Automatic Configuration
- Dependencies: Automatically runs
npm installfor you. - Dev Server: Sets up
nodemon(JS) orts-node-dev(TS) and starts the server. - Environment: Creates a
.envfile template. - TypeScript: Generates a valid
tsconfig.jsoncompatible with the project structure.
📦 Installation
Option 1: Run with npx (Recommended)
This ensures you always use the latest version without cluttering your global packages.
npx nodex_genOption 2: Install Globally
If you prefer to have the tool installed globally on your machine:
npm install -g nodex_genGlobal Usage
Once installed, you can run the tool from any directory by simply typing:
nodex_genThis is useful if you plan to generate multiple projects frequently.
📔 Usage Guide
After running the tool, follow these steps to get your project running:
Navigate to your project:
cd <your-project-name>Environment Setup: Open the
.envfile and configure your variables (MongoDB URI, JWT Secret, SMTP credentials, etc.).Start Development: The tool automatically tries to start the server. If you stopped it, simply run:
npm run dev
🧩 Generated Tech Stack
The projects created by Nodex Gen harness the power of:
- Runtime: Node.js
- Framework: Express.js
- Database: MongoDB (via Mongoose)
- Language: JavaScript (ES6+) or TypeScript
- Tools:
nodemon/ts-node-dev(Hot Reloading)dotenv(Environment Management)cors(Cross-Origin Resource Sharing)morgan(HTTP Logging)
❓ Troubleshooting
Q: "Command not found" after global install?
A: Ensure your npm global bin directory is in your system's PATH. Alternatively, use npx nodex_gen.
Q: TypeScript "moduleResolution" errors?
A: Ensure you are using the generated tsconfig.json which is specifically tuned for this project structure ("moduleResolution": "node", "esm": false for ts-node).
Q: MongoDB connection fails?
A: Make sure you have MongoDB running locally (mongodb://localhost:27017) or update the MONGO_URI in .env to point to your Atlas cluster.
📄 License
This project is open-source and available under the ISC License.
