npm package: @sachin-thakur/create-nodejs-app
Description: A CLI tool to scaffold production-ready Node.js applications with best practices
Author: Your Name
Latest version: 1.0.0

# Create Production Node App

🚀 A powerful CLI tool to scaffold **production-ready** Node.js applications with modern best practices, complete with TypeScript support, database integration, authentication, testing, and more.

## ✨ Features

Unlike other scaffolding tools that give you a basic "Hello World" template, **Create Production App** generates applications that are ready for production deployment with:

- 🎯 **Multiple Project Types**: REST API, GraphQL API, Microservices, CLI Tools
- 📐 **Architecture Patterns**: MVC, Clean Architecture, Feature-based (Modular)
- 💎 **TypeScript or JavaScript**: Full TypeScript support with strict mode
- 🗄️ **Database Integration**: PostgreSQL, MongoDB, MySQL with connection pooling
- 🔐 **Authentication**: JWT-based auth with bcrypt password hashing
- ✅ **Request Validation**: Input validation with Zod
- 📝 **Logging**: Structured logging with Winston
- 📚 **API Documentation**: Auto-generated Swagger/OpenAPI docs
- 🛡️ **Security**: Rate limiting, CORS, helmet, input sanitization
- ⚡ **Caching**: Redis integration for performance
- 📧 **Email Service**: Nodemailer setup for transactional emails
- 📁 **File Upload**: Multer configuration for file handling
- 🔄 **Background Jobs**: Bull queue for async task processing
- 🧪 **Testing**: Jest, Vitest, or Mocha with example tests
- 🐳 **Docker**: Complete Docker and docker-compose setup
- 🔄 **CI/CD**: GitHub Actions workflow configured
- 📦 **ESLint & Prettier**: Code quality and formatting

## 🚀 Quick Start

### Using npx (Recommended)

```bash
npx create-nodejs-app my-awesome-app
```

### Using npm

```bash
npm install -g create-nodejs-app
create-nodejs-app my-awesome-app
```

### Using yarn

```bash
yarn global add create-nodejs-app
create-nodejs-app my-awesome-app
```

## 📖 Usage

Simply run the command and follow the interactive prompts:

```bash
npx create-nodejs-app my-app
```

You'll be asked to choose:

1. **Project Type**: REST API, GraphQL API, Microservice, or CLI Tool
2. **Language**: TypeScript (recommended) or JavaScript
3. **Architecture**: MVC, Clean Architecture, or Feature-based
4. **Database**: PostgreSQL, MongoDB, MySQL, or None
5. **Features**: 
   - Authentication (JWT)
   - API Documentation (Swagger)
   - Request Validation
   - Error Handling & Logging
   - Rate Limiting
   - CORS Configuration
   - File Upload
   - Email Service
   - Caching (Redis)
   - Background Jobs
6. **Testing Framework**: Jest, Vitest, Mocha, or None
7. **Docker**: Include Docker configuration
8. **CI/CD**: Include GitHub Actions workflow

## 📦 What You Get

After running the CLI, you'll have a fully structured project:

```
my-app/
├── src/
│   ├── config/          # Configuration files
│   │   ├── database.ts  # Database connection
│   │   ├── logger.ts    # Winston logger setup
│   │   └── swagger.ts   # Swagger configuration
│   ├── controllers/     # Request handlers
│   ├── models/          # Database models
│   ├── routes/          # API routes with Swagger docs
│   ├── middlewares/     # Custom middlewares (auth, validation, error handling)
│   ├── services/        # Business logic layer
│   ├── utils/           # Utility functions
│   └── index.ts         # Application entry point
├── tests/               # Test files
├── .github/
│   └── workflows/       # CI/CD configuration
├── Dockerfile           # Docker configuration
├── docker-compose.yml   # Multi-container setup
├── .env.example         # Environment variables template
├── .gitignore
├── .eslintrc.json       # ESLint configuration
├── .prettierrc          # Prettier configuration
├── tsconfig.json        # TypeScript configuration (if TS)
├── package.json
└── README.md            # Project-specific README
```

## 🎯 Example Projects

### REST API with PostgreSQL

```bash
npx create-nodejs-app my-api
# Select: REST API, TypeScript, MVC, PostgreSQL
# Select features: Auth, Validation, Logging, Swagger, Rate Limiting, CORS
# Select: Jest, Docker, CI/CD
```

This generates a production-ready REST API with:
- JWT authentication
- PostgreSQL database with connection pooling
- Request validation with Zod
- Comprehensive error handling
- Swagger API documentation
- Rate limiting and CORS
- Docker setup with PostgreSQL container
- CI/CD pipeline with GitHub Actions

### Microservice with MongoDB

```bash
npx create-nodejs-app user-service
# Select: Microservice, TypeScript, Clean Architecture, MongoDB
# Select features: Auth, Validation, Logging, Caching, Background Jobs
# Select: Jest, Docker, CI/CD
```

## 🔧 Development

After creating your project:

```bash
cd my-app
npm install
cp .env.example .env
# Edit .env with your configuration
npm run dev
```

Your app will be running at `http://localhost:3000`

If you included Swagger, visit: `http://localhost:3000/api-docs`

## 🐳 Using Docker

If you included Docker configuration:

```bash
docker-compose up
```

This will start your application along with the database and any other services (Redis, etc.)

## 🧪 Testing

```bash
npm test                 # Run tests
npm run test:watch       # Watch mode
npm run test:coverage    # Coverage report
```

## 🏗️ Architecture Patterns

### MVC (Model-View-Controller)
Traditional and straightforward. Great for most REST APIs and web applications.

### Clean Architecture (Layered)
Domain-driven with clear separation of concerns. Ideal for complex business logic and enterprise applications.

### Feature-based (Modular)
Organized by features rather than technical layers. Perfect for microservices and scalable applications.

## 🤔 Why Create Production App?

Most Node.js scaffolding tools give you a basic structure, but lack:

- ❌ Proper error handling patterns
- ❌ Logging configuration
- ❌ Security best practices
- ❌ Database setup with migrations
- ❌ Authentication implementation
- ❌ API documentation
- ❌ Testing examples
- ❌ Docker and CI/CD setup

**Create Production App** provides all of this out of the box, so you can focus on building features instead of boilerplate.

## 📚 Documentation

For more detailed information, check out:

- [API Development Guide](docs/api-guide.md)
- [Database Setup](docs/database.md)
- [Authentication](docs/authentication.md)
- [Testing Guide](docs/testing.md)
- [Deployment](docs/deployment.md)

## 🤝 Contributing

Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details.

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## 📝 License

MIT License - see [LICENSE](LICENSE) file for details

## 🙏 Acknowledgments

Built with ❤️ to help developers ship production-ready applications faster.

## 🐛 Issues

Found a bug or have a feature request? Please open an issue on [GitHub](https://github.com/yourusername/create-nodejs-app/issues).

## ⭐ Star Us!

If you find this tool helpful, please consider giving it a star on GitHub!

---

**Happy coding! 🚀**