@masteryhub-its/cli
v1.0.3
Published
CLI tool for generating project skeletons and boilerplates
Downloads
3
Readme
MasteryHub ITS CLI
A CLI tool for generating project skeletons and boilerplates for various frameworks and stacks.
Installation
From npm (Public Registry)
The package is published to the public npm registry.
# Install globally
npm install -g @masteryhub-its/cli
# Or using yarn
yarn global add @masteryhub-its/cli
# Or using pnpm
pnpm add -g @masteryhub-its/cliVerify Installation
masteryhub --version
masteryhub --help
masteryhub listLocal Development
For local development and contribution:
git clone https://gitlab.com/masteryhub-its/masteryhub-its-cli.git
cd masteryhub-its-cli
npm install
npm run build
npm link # Link globally for developmentUsage
Quick Start
# Interactive project creation (recommended)
masteryhub init
# This will guide you through:
# 1. Select project category (API, Frontend, Mobile, etc.)
# 2. Choose template (NestJS, React, Flutter, etc.)
# 3. Configure features (Database, Auth, Swagger, etc.)
# 4. Set up project detailsList Available Templates
masteryhub list
# or
masteryhub lsGenerate a New Project
# Interactive mode (recommended)
masteryhub generate nestjs my-api
# Quick mode (uses defaults)
masteryhub generate nestjs my-api --yes
# Skip dependency installation
masteryhub generate nestjs my-api --yes --no-install
# Use specific package manager
masteryhub generate nestjs my-api --package-manager yarn
masteryhub generate nestjs my-api --package-manager pnpmAvailable Commands
masteryhub init [name]- Interactive project initialization (recommended for first-time users)masteryhub generate <type> [name]- Generate a new project from a templatemasteryhub listormasteryhub ls- List all available templates and categoriesmasteryhub info <template>- Show detailed information about a templatemasteryhub --help- Show help informationmasteryhub --version- Show version
Quick Examples
# Interactive mode (best for beginners)
masteryhub init
# Quick generation
masteryhub generate nestjs my-api
masteryhub generate react my-app
masteryhub generate flutter my-mobile-app
# With options
masteryhub generate nestjs my-api --yes --package-manager yarn📖 For detailed usage guide, see USAGE.md
Command Options
generate command:
-y, --yes- Skip prompts and use defaults--no-install- Skip dependency installation--package-manager <pm>- Package manager to use (npm, yarn, pnpm). Default: npm
Available Templates
API Frameworks
NestJS
Full-featured NestJS boilerplate with TypeScript, testing, and optional features:
- Database support (PostgreSQL, MongoDB, MySQL, SQLite)
- ORM (TypeORM, Prisma, Mongoose, Sequelize)
- GraphQL support
- JWT Authentication
- Swagger/OpenAPI documentation
- Docker configuration
- Validation
- Logging (Winston)
- Caching (Redis, In-Memory)
- Monitoring and Health Checks
- CI/CD pipelines (GitHub Actions, GitLab CI)
masteryhub generate nestjs my-apiExpress
Express.js API with TypeScript:
- TypeScript configuration
- Optional database and ORM support
- Swagger documentation
- JWT authentication
masteryhub generate express my-apiFastify
Fastify API with TypeScript:
- High-performance HTTP server
- TypeScript configuration
- Optional database and ORM support
- Swagger documentation
- JWT authentication
- Structured logging with Pino
masteryhub generate fastify my-apiFrontend Frameworks
React
Modern React application with Vite:
- TypeScript
- Vite for fast development
- Modern React patterns
masteryhub generate react my-appVue
Vue 3 application with Vite:
- TypeScript
- Composition API
- Vite build tool
masteryhub generate vue my-appFull-Stack Frameworks
Next.js
Next.js 15 application with App Router:
- TypeScript
- App Router
- Tailwind CSS
- Server and Client Components
- Testing setup
masteryhub generate nextjs my-appMobile
Flutter
Flutter mobile application:
- Dart language
- Material Design
- Cross-platform support
masteryhub generate flutter my-appPWA (Progressive Web Apps)
React PWA
React Progressive Web App:
- Service Worker
- Offline support
- Installable
- Vite PWA plugin
masteryhub generate react-pwa my-pwaCreating Custom Templates
Templates are stored in src/templates/. To create a new template:
- Create a new directory in
src/templates/with your template name - Add your template files
- Use Handlebars syntax (
{{variable}}) for dynamic content - Files ending with
.hbswill be processed as templates - Add a
README.mdin the template directory for description
Template Variables
The following variables are available in templates:
{{name}}- Project name{{description}}- Project description{{author}}- Author name{{version}}- Project version{{license}}- License type
Quick Start
Get started in 5 minutes:
# 1. List all available templates
masteryhub list
# 2. Interactive initialization (recommended for first-time users)
masteryhub init my-project
# 3. Or generate directly
masteryhub generate nestjs my-api
# 4. Get information about a template
masteryhub info nestjs
# 5. Generate with defaults (non-interactive)
masteryhub generate react my-app --yes
# 6. Use different package manager
masteryhub generate vue my-app --package-manager pnpmYour First Project
Generate a NestJS API:
masteryhub generate nestjs my-first-api
# Follow prompts: select database, ORM, features
cd my-first-api
cp .env.example .env
npm run start:dev
# API: http://localhost:3000Generate a React App:
masteryhub generate react my-app
cd my-app
npm run devGenerate a Flutter App:
masteryhub generate flutter my-app
cd my-app
flutter pub get
flutter runExamples
New Features
The CLI now includes enhanced features:
- New Commands:
initfor interactive setup,infofor template details - Enhanced Features: Logging, caching (Redis/Memory), monitoring, CI/CD pipelines
- Post-Generation: Automatic Git initialization,
.env.examplecreation, CI/CD setup - Progress Indicators: Visual feedback during project generation
- Better Error Handling: Improved error messages and validation
- Type-Safe Structures: All projects follow company-standard folder structures with strict TypeScript typing
- Automatic Folder Creation: Standard folder structures are automatically created for each template type
Standard Folder Structures
All generated projects follow company-standard folder structures defined with strict TypeScript types. Folders are automatically created during project generation.
Key benefits:
- Consistency: All projects follow the same organization
- Type Safety: Structures are defined with TypeScript types
- Automatic Creation: Folders are created automatically during project generation
Example structures:
- NestJS:
src/common/,src/modules/,src/config/,src/database/ - Express/Fastify:
src/api/,src/common/,src/services/,src/config/ - Next.js/React/Vue:
src/components/,src/lib/,src/hooks/,src/types/ - Flutter:
lib/core/,lib/features/,lib/shared/
Detailed Examples
See EXAMPLES.md for comprehensive examples including:
- API projects with different databases and ORMs
- Frontend applications
- Mobile apps
- PWAs
- Full-stack setups
- Microservices architectures
Development
Building
npm run buildRunning in Development
npm run dev generate nestjs test-projectProject Structure
masteryhub-its-cli/
├── src/
│ ├── commands/ # CLI commands
│ ├── templates/ # Project templates
│ ├── utils/ # Utility functions
│ └── index.ts # Entry point
├── dist/ # Compiled output
├── package.json
└── tsconfig.jsonContributing
- Fork the repository
- Create a feature branch
- Add your template or feature
- Submit a merge request
Deployment
This package is deployed to MasteryHub ITS private npm registry. See DEPLOYMENT.md for detailed deployment instructions.
Quick Deploy
# Build
npm run build
# Publish to private registry
npm run publish:private
# Bump version
npm run version:patchLicense
MIT
Troubleshooting
Authentication Issues
Error: npm ERR! 401 Unauthorized
- Verify token in
~/.npmrc - Check token hasn't expired
- Test:
npm whoami --registry=https://gitlab.com/api/v4/packages/npm/
Error: npm ERR! 404 Not Found
- Check Package Registry is enabled in GitLab project settings
- Verify registry URL is correct
- Ensure token has
read_package_registryandwrite_package_registrypermissions
Installation Issues
Error: Command not found: masteryhub
- Verify global installation:
npm list -g @masteryhub-its/cli - Try:
npm install -g @masteryhub-its/cli --force
Error: Template not found
- Run
masteryhub listto see available templates - Check template name spelling
Generation Issues
Error: Permission denied
- Check write permissions in target directory
- Try running with
sudo(not recommended) or fix permissions
Error: Dependencies installation fails
- Check internet connection
- Try different package manager:
--package-manager yarn - Skip installation:
--no-installand install manually
Documentation
- DEPLOYMENT.md - Deployment and publishing guide
- EXAMPLES.md - Comprehensive usage examples
