isam-nestjs-starter-cli
v1.0.2
Published
π Generate production-ready NestJS applications with authentication, database integration, email service, and complete module generation
Maintainers
Readme
Isam NestJS Starter CLI
π A powerful CLI tool to generate production-ready NestJS applications with authentication, database integration, email service, and complete module generation.
β¨ Features
- π JWT Authentication - Complete auth system with email verification
- π§ Email Service - SMTP integration with HTML templates
- ποΈ Multi-Database Support - PostgreSQL, MySQL, SQLite, MongoDB
- ποΈ Module Generator - Generate complete CRUD modules instantly
- π Security First - Built-in guards, permissions, and validation
- π TypeScript - Full TypeScript support with strict mode
- π³ Docker Ready - Includes Dockerfile and docker-compose
- π Comprehensive Docs - Detailed documentation and examples
π Quick Start
Installation
npm install -g isam-nestjs-starter-cliCreate Your First Project
# Create project with authentication and email
isam-nestjs-starter create my-app --auth --database postgres --email
# Navigate to project
cd my-app
# Install dependencies
npm install
# Start development server
npm run start:devGenerate Modules
# Generate a complete CRUD module
isam-nestjs-starter generate module productsπ Commands
Create Project
isam-nestjs-starter create <project-name> [options]Options:
--auth- Include authentication module--database <type>- Database type (postgres, mysql, sqlite, mongodb)--email- Include email service--upload- Include file upload module
Examples:
# Full-featured project
isam-nestjs-starter create ecommerce-api --auth --database postgres --email --upload
# Minimal project
isam-nestjs-starter create simple-api --database sqlite
# Interactive mode (prompts for options)
isam-nestjs-starter create my-projectGenerate Module
isam-nestjs-starter generate module <module-name>Generates:
- Controller with CRUD endpoints
- Service with business logic
- Entity with TypeORM decorators
- Repository for database operations
- DTOs with validation
- Permissions for access control
- Audit middleware
ποΈ Generated Project Structure
my-app/
βββ src/
β βββ common/ # Shared utilities and decorators
β βββ config/ # Configuration files
β βββ modules/
β β βββ auth/ # Authentication module
β β βββ email/ # Email service
β β βββ users/ # User management
β βββ app.module.ts
β βββ main.ts
βββ .env.example
βββ docker-compose.yml
βββ Dockerfile
βββ package.jsonπ Authentication Features
- User Registration with email verification
- JWT Token authentication
- Password Reset via email
- Email Verification system
- Role-based access control
- Permissions system
API Endpoints
POST /auth/register # User registration
POST /auth/login # User login
POST /auth/verify-email # Email verification
POST /auth/forgot-password # Password reset request
POST /auth/reset-password # Password resetπ§ Email Service
Built-in email service with:
- SMTP Configuration for multiple providers
- HTML Templates with variable substitution
- Email Verification templates
- Password Reset templates
- Welcome Email templates
Configuration
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
[email protected]
SMTP_PASS=your-app-password
[email protected]ποΈ Database Support
Supported Databases
- PostgreSQL (recommended)
- MySQL
- SQLite (for development)
- MongoDB
Configuration Example
DB_TYPE=postgres
DB_HOST=localhost
DB_PORT=5432
DB_USERNAME=your_username
DB_PASSWORD=your_password
DB_DATABASE=your_databaseποΈ Module Generation
Generate complete modules with a single command:
isam-nestjs-starter generate module productsCreates:
src/modules/products/
βββ controllers/products.controller.ts # CRUD endpoints
βββ services/products.service.ts # Business logic
βββ entities/product.entity.ts # Database entity
βββ repositories/products.repository.ts # Data access
βββ dto/ # Data transfer objects
βββ permissions/products.permissions.ts # Access control
βββ middlewares/products-audit.middleware.ts # Loggingπ Security Features
- JWT Authentication with configurable expiration
- Password Hashing with bcrypt
- Input Validation with class-validator
- CORS Configuration
- Rate Limiting ready
- Security Headers with Helmet
- SQL Injection protection via TypeORM
π³ Docker Support
Generated projects include:
Dockerfile:
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["npm", "run", "start:prod"]docker-compose.yml:
version: '3.8'
services:
app:
build: .
ports:
- "3000:3000"
postgres:
image: postgres:15
environment:
POSTGRES_DB: myappπ Documentation
Comprehensive documentation is available at:
π Full Documentation
Or browse individual sections:
- Installation Guide
- Quick Start
- Authentication Guide
- Database Configuration
- Email Service
- Module Generation
- Security Best Practices
- Deployment Guide
π Deployment
Production Build
npm run build
npm run start:prodDocker Deployment
docker build -t my-app .
docker run -p 3000:3000 my-appCloud Deployment
Supports deployment to:
- AWS Elastic Beanstalk
- Heroku
- DigitalOcean App Platform
- Google Cloud Run
π€ Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Setup
git clone https://github.com/isamch/nestjs-starter-cli.git
cd nestjs-starter-cli
npm install
npm linkπ License
This project is licensed under the MIT License - see the LICENSE file for details.
π Support
- π Documentation: https://nestjs-cli-doc.isamchajia.com
- π Issues: GitHub Issues
- β FAQ: Frequently Asked Questions
- π§ Troubleshooting: Common Issues
π― Examples
E-commerce API
isam-nestjs-starter create ecommerce-api --auth --database postgres --email
cd ecommerce-api
isam-nestjs-starter generate module products
isam-nestjs-starter generate module orders
isam-nestjs-starter generate module categoriesBlog API
isam-nestjs-starter create blog-api --auth --database postgres --email
cd blog-api
isam-nestjs-starter generate module posts
isam-nestjs-starter generate module commentsSimple CRUD API
isam-nestjs-starter create simple-api --database sqlite
cd simple-api
isam-nestjs-starter generate module tasksMade with β€οΈ by Isam Chajia
Generate production-ready NestJS applications in seconds!
