npm package: @psd-it/create-nestjs-app
Description: CLI tool to create a new NestJS application with a predefined structure.
Latest version: 1.0.2

# 🚀 Create NestJS App

A modern CLI tool to create a new NestJS application with a predefined structure, including best practices for authentication, database, testing, and more.

## ✨ Features

- 🎨 **Beautiful CLI Interface** - Interactive prompts with colors and emojis
- 📦 **Multiple Package Managers** - Support for npm, yarn, pnpm, and bun
- 🔐 **Security Built-in** - JWT authentication, CSRF protection, and role-based access control
- 🗄️ **Database Ready** - TypeORM configuration with PostgreSQL
- 🧪 **Testing Setup** - Unit and E2E tests with Vitest
- 🐳 **Docker Ready** - Docker and docker-compose files included
- 📝 **Code Quality** - ESLint, Prettier, and Commitlint pre-configured
- 🏥 **Health Checks** - Built-in health check endpoints
- 📄 **API Documentation** - Swagger/OpenAPI ready

## 🚀 Quick Start

### Interactive Mode (Recommended)

Simply run:

```bash
npx create-nestjs-app
```

Or with other package managers:

```bash
# Using yarn
yarn create nestjs-app

# Using pnpm
pnpm create nestjs-app

# Using bun
bunx create-nestjs-app
```

This will start an interactive prompt that will guide you through:
1. Choosing a project name (with validation)
2. Selecting your preferred package manager
3. Confirming the configuration

### Direct Mode

You can also create a project directly with command-line arguments:

```bash
# Using default package manager (npm)
npx create-nestjs-app my-awesome-project

# Specifying a package manager
npx create-nestjs-app my-awesome-project --package-manager yarn
npx create-nestjs-app my-awesome-project -p pnpm

# Skip all prompts with defaults
npx create-nestjs-app my-awesome-project -y
```

## 📋 Project Name Rules

The project name must follow these rules:
- ✅ Only alphanumeric characters, hyphens (-), and underscores (_)
- ✅ Must start with a letter
- ✅ Cannot contain spaces or special characters
- ✅ Maximum 214 characters

### Valid Examples:
- ✅ `my-project`
- ✅ `my_project`
- ✅ `myProject123`
- ✅ `project-name-2024`

### Invalid Examples:
- ❌ `my project` (contains space)
- ❌ `my@project` (contains special character)
- ❌ `123project` (starts with number)
- ❌ `my-project!` (contains special character)

## 🛠️ CLI Options

```bash
create-nestjs-app [project-name] [options]
```

### Arguments:
- `project-name` - Name of the project to create (optional, will prompt if not provided)

### Options:
- `-p, --package-manager <manager>` - Package manager to use (npm, yarn, pnpm, bun). Default: npm
- `-y, --yes` - Skip prompts and use default values
- `-V, --version` - Output the version number
- `-h, --help` - Display help information

### Examples:

```bash
# Interactive mode
npx create-nestjs-app

# Direct mode with npm
npx create-nestjs-app my-app

# With yarn
npx create-nestjs-app my-app -p yarn

# With pnpm
npx create-nestjs-app my-app --package-manager pnpm

# With bun
npx create-nestjs-app my-app -p bun

# Skip all prompts
npx create-nestjs-app my-app -y
```

## 📦 What's Included

The generated project includes:

### Core Features:
- **Authentication & Authorization** - JWT-based authentication with role-based access control
- **CSRF Protection** - Built-in CSRF token management
- **Database Integration** - TypeORM with PostgreSQL support
- **Configuration Management** - Environment-based configuration
- **Logging** - Winston logger integrated with TypeORM
- **Health Checks** - Ready-to-use health check endpoints
- **Pagination** - Reusable pagination service and DTOs

### Developer Experience:
- **Hot Reload** - Fast development with hot module replacement
- **Testing** - Vitest for both unit and E2E tests
- **Code Quality** - ESLint and Prettier pre-configured
- **Git Hooks** - Commitlint for conventional commits
- **Docker** - Dockerfile and docker-compose for easy deployment
- **Scripts** - Useful development and deployment scripts

## 🎯 Next Steps After Creation

1. Navigate to your project:
   ```bash
   cd my-project
   ```

2. Set up environment variables:
   ```bash
   cp envs/.env.example envs/.env.development
   # Edit the .env.development file with your configuration
   ```

3. Start the development server:
   ```bash
   npm run start:dev
   # or with your chosen package manager
   ```

4. Open your browser at `http://localhost:3000`

## 📚 Available Scripts

- `npm run start:dev` - Start development server with hot reload
- `npm run build` - Build for production
- `npm run start:prod` - Start production server
- `npm run test` - Run unit tests
- `npm run test:watch` - Run tests in watch mode
- `npm run test:e2e` - Run E2E tests
- `npm run lint` - Lint the code
- `npm run format` - Format the code with Prettier

## 🐳 Docker Support

Start the application with Docker:

```bash
docker-compose up -d
```

This will start:
- Your NestJS application
- PostgreSQL database
- Any other configured services

## 🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## 📄 License

MIT

## 🙋‍♂️ Support

If you have any questions or need help, please open an issue on GitHub.

---

Made with ❤️ for the NestJS community