πŸš€ DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more β†’
Socket
Book a DemoInstallSign in
Socket

js-mvc-app

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-mvc-app

A CLI tool to scaffold complete Node.js MVC projects with TypeScript, just like Laravel

latest
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

Create Node MVC

A powerful CLI tool to scaffold complete Node.js MVC projects with multiple language and framework options, just like Laravel does.

πŸš€ Installation

npm install -g create-node-mvc

πŸ“‹ Usage

create-node-mvc my-app

This will start an interactive prompt to configure your project:

Language Options

  • πŸ”· TypeScript (Recommended) - Full type safety and modern features
  • 🟨 JavaScript - Classic Node.js with CommonJS modules

Framework Options

  • ⚑ Express.js - Simple & Fast traditional MVC framework
  • πŸ—οΈ NestJS - Enterprise-grade framework with decorators and modules

Database Options

  • πŸƒ MongoDB with Mongoose ODM
  • 🐬 MySQL with Sequelize/TypeORM
  • 🐘 PostgreSQL with Sequelize/TypeORM
  • πŸ“± SQLite with Sequelize/TypeORM

Project Types

  • 🌐 API Only - REST endpoints only
  • 🎨 Full MVC - With views and frontend assets
  • πŸ“Š GraphQL API - GraphQL with Apollo (NestJS only)
  • πŸ”„ Microservices - Microservice architecture (NestJS only)

✨ Supported Combinations

LanguageFrameworkStructureBest For
TypeScriptExpressTraditional MVCFull-stack web apps
JavaScriptExpressTraditional MVCSimple APIs & websites
TypeScriptNestJSModule-basedEnterprise applications
JavaScriptNestJSModule-basedModern APIs

🎯 Features

Core Features

  • Multiple languages: TypeScript & JavaScript support
  • Multiple frameworks: Express.js & NestJS architectures
  • Authentication: JWT tokens with bcrypt password hashing
  • Database flexibility: MongoDB, MySQL, PostgreSQL, SQLite
  • Validation: Joi (Express) or class-validator (NestJS)
  • Error handling: Comprehensive error middleware and logging
  • Security: Helmet, CORS, rate limiting built-in

Optional Extras

  • 🐳 Docker - Complete containerization setup
  • πŸ” ESLint & Prettier - Code formatting and linting
  • πŸ§ͺ Jest Testing - Unit and integration test setup
  • πŸͺ Git Hooks - Husky pre-commit hooks
  • πŸ“š API Documentation - Swagger/OpenAPI (NestJS)

πŸ“‚ Generated Project Structures

Express.js Structure (Traditional MVC)

my-app/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ config/           # Database and app configuration
β”‚   β”œβ”€β”€ controllers/      # Route controllers
β”‚   β”œβ”€β”€ models/          # Database models
β”‚   β”œβ”€β”€ routes/          # Express routes
β”‚   β”œβ”€β”€ middlewares/     # Custom middlewares
β”‚   β”œβ”€β”€ utils/           # Utilities (TypeScript)
β”‚   β”œβ”€β”€ validators/      # Joi validators (JavaScript)
β”‚   └── app.ts/js        # Express application
β”œβ”€β”€ tests/ (optional)
β”œβ”€β”€ .env.example
β”œβ”€β”€ tsconfig.json (TypeScript only)
└── package.json

NestJS Structure (Module-based)

my-app/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ auth/            # Authentication module
β”‚   β”‚   β”œβ”€β”€ dto/         # Data transfer objects
β”‚   β”‚   β”œβ”€β”€ guards/      # Auth guards
β”‚   β”‚   β”œβ”€β”€ strategies/  # Passport strategies
β”‚   β”‚   β”œβ”€β”€ auth.controller.ts
β”‚   β”‚   β”œβ”€β”€ auth.service.ts
β”‚   β”‚   └── auth.module.ts
β”‚   β”œβ”€β”€ users/           # Users module
β”‚   β”‚   β”œβ”€β”€ dto/         # User DTOs
β”‚   β”‚   β”œβ”€β”€ entities/    # User entities
β”‚   β”‚   β”œβ”€β”€ users.controller.ts
β”‚   β”‚   β”œβ”€β”€ users.service.ts
β”‚   β”‚   └── users.module.ts
β”‚   β”œβ”€β”€ config/          # Configuration
β”‚   β”œβ”€β”€ app.module.ts    # Root module
β”‚   └── main.ts/js       # NestJS bootstrap
β”œβ”€β”€ test/ (optional)
β”œβ”€β”€ tsconfig.json (TypeScript only)
└── package.json

πŸš€ Quick Start Examples

Create a TypeScript Express API

create-node-mvc my-api
# Select: TypeScript β†’ Express β†’ MongoDB β†’ API Only
cd my-api
npm install
npm run dev

Create a NestJS Enterprise App

create-node-mvc my-enterprise-app
# Select: TypeScript β†’ NestJS β†’ PostgreSQL β†’ API Only β†’ Docker + Testing
cd my-enterprise-app
npm install
npm run start:dev

Create a Simple JavaScript API

create-node-mvc my-simple-api
# Select: JavaScript β†’ Express β†’ MongoDB β†’ API Only
cd my-simple-api
npm install
npm start

πŸ“– Available Scripts

After generating your project, you can use these commands:

Express.js Projects

npm start          # Start production server
npm run dev        # Start development server with nodemon/ts-node
npm run build      # Compile TypeScript (TypeScript only)
npm test           # Run tests (if testing enabled)
npm run lint       # Run ESLint (if linting enabled)

NestJS Projects

npm run start          # Start production server
npm run start:dev      # Start development server with watch
npm run start:debug    # Start with debugging
npm run build          # Build the application
npm run test           # Run unit tests
npm run test:e2e       # Run end-to-end tests

πŸŽ›οΈ Configuration

Environment Variables

Your generated project includes a .env.example file. Copy it to .env and configure:

# Database
DATABASE_URL=mongodb://localhost:27017/your-app
# or for SQL databases
DATABASE_URL=postgresql://user:password@localhost:5432/your-app

# JWT
JWT_SECRET=your-super-secret-jwt-key

# Server
PORT=3000
NODE_ENV=development

# CORS (optional)
CORS_ORIGIN=http://localhost:3000

Database Setup

  • MongoDB: Ensure MongoDB is running locally or provide a connection string
  • PostgreSQL/MySQL: Create a database and provide connection details
  • SQLite: Database file will be created automatically

πŸ”§ Customization

Adding New Routes (Express)

// src/routes/example.ts
import { Router } from "express";
const router = Router();

router.get("/", (req, res) => {
  res.json({ message: "Hello World" });
});

export default router;

Adding New Modules (NestJS)

# Generate new module
nest g module products
nest g controller products
nest g service products

🀝 Contributing

We welcome contributions! Please feel free to submit a Pull Request.

πŸ“„ Development

To work on this CLI tool:

git clone https://github.com/your-username/create-node-mvc.git
cd create-node-mvc
npm install
npm run dev

πŸ†š Comparison with Other Tools

Featurecreate-node-mvccreate-next-app@nestjs/cli
Multiple Languagesβœ… TS & JS❌ TS only❌ TS only
Multiple Frameworksβœ… Express & NestJS❌ Next only❌ NestJS only
Database Supportβœ… 4 databases❌ None❌ Manual setup
Authenticationβœ… Built-in JWT❌ Manual❌ Manual
Docker Setupβœ… Optional❌ Manual❌ Manual
Testing Setupβœ… Pre-configured❌ Manualβœ… Basic

πŸ“‹ Roadmap

  • React/Vue frontend integration
  • GraphQL support for Express
  • Prisma ORM support
  • WebSocket support
  • Microservices templates
  • CI/CD pipeline templates

πŸ† License

MIT Β© [Zebix]

Made with ❀️ for the Node.js community

Like Laravel's Artisan for Node.js πŸš€

Keywords

nodejs

FAQs

Package last updated on 04 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts