Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@10565/quicknode-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
QuickNode CLI
๐ A powerful CLI tool to quickly bootstrap Node.js projects with clean architecture and pre-configured dependencies.
โจ Features
- TypeScript & JavaScript Support: Choose between TypeScript or JavaScript templates
- Clean Architecture: Domain-driven design with clear separation of concerns
- Pre-configured Dependencies: All essential tools ready to use
- Multiple Database Support: PostgreSQL (TypeORM) and MongoDB (Mongoose)
- API Documentation: Swagger/OpenAPI 3.0 integration
- Security & Validation: Helmet, express-validator, and class-validator
- Testing Setup: Jest with extended matchers and coverage
- Code Quality: ESLint, Prettier, and Husky pre-commit hooks
- Development Tools: Hot reload with ts-node-dev/nodemon
- Logging: Structured logging with Pino
๐ฆ Installation
Install the CLI globally:
npm install -g @10565/quicknode-cliAlternatively, you can run it without a global installation using npx:
npx @10565/quicknode-cli create my-awesome-app๐ฏ Usage
Create a new project
If you have installed the CLI globally, you can use the qn command directly.
# Create a new project in a new directory
qn create my-awesome-app
# Create a project in the current directory
qn create .
# Interactive mode (will prompt for options)
qn createCommand Options
# Use TypeScript template (default)
qn create my-app --typescript
# Use JavaScript template
qn create my-app --javascript๐๏ธ What's Included
Dependencies
- Express.js: Web framework
- Helmet: Security middleware
- Dotenv: Environment variable management
- Express-validator: Request validation
- Pino: Structured logging
- Swagger: API documentation
- TypeORM: PostgreSQL ORM (TypeScript template)
- Mongoose: MongoDB ODM
- Class-transformer & Class-validator: DTO validation (TypeScript)
Development Dependencies
- TypeScript: Type checking (TypeScript template)
- ts-node-dev: Development server with hot reload (TypeScript)
- Nodemon: Development server with hot reload (JavaScript)
- Jest: Testing framework
- Jest-extended: Additional Jest matchers
- ESLint: Code linting
- Prettier: Code formatting
- Husky: Git hooks
- Commitlint: Conventional commits
Pre-configured Scripts
{
"dev": "Start development server",
"build": "Build TypeScript to JavaScript (TypeScript only)",
"start": "Start production server",
"test": "Run tests",
"test:watch": "Run tests in watch mode",
"test:coverage": "Run tests with coverage",
"lint": "Lint code",
"lint:fix": "Lint and fix code",
"format": "Format code with Prettier"
}๐๏ธ Clean Architecture Structure
src/
โโโ domain/ # Domain layer (business logic)
โ โโโ entities/ # Domain entities
โ โโโ repositories/ # Repository interfaces
โ โโโ use-cases/ # Application use cases
โโโ infrastructure/ # Infrastructure layer
โ โโโ controllers/ # HTTP controllers
โ โโโ database/ # Database configuration
โ โ โโโ entities/ # TypeORM entities (TypeScript)
โ โ โโโ models/ # Mongoose models
โ โ โโโ repositories/ # Repository implementations
โ โโโ docs/ # API documentation setup
โ โโโ logging/ # Logging configuration
โ โโโ middleware/ # Express middleware
โ โโโ routes/ # Route definitions
โโโ server.ts/js # Application entry point๐ Quick Start
After creating your project:
Navigate to your project:
cd my-awesome-appInstall dependencies:
npm install
Copy environment variables:
cp .env.example .envUpdate environment variables in
.env:DATABASE_URL=postgresql://username:password@localhost:5432/your_db MONGO_URL=mongodb://localhost:27017/your_db PORT=3000 JWT_SECRET=your-secret-keyStart development server:
npm run devVisit your API:
- API: http://localhost:3000
- Documentation: http://localhost:3000/api-docs
- Health Check: http://localhost:3000/health
๐ Database Setup
PostgreSQL (TypeScript template)
- Install PostgreSQL
- Create a database
- Update
DATABASE_URLin.env - Run migrations:
npm run db:migrate(TypeScript only)
MongoDB
- Install MongoDB
- Update
MONGO_URLin.env - Connection is automatic
๐งช Testing
The template includes a complete testing setup:
- Unit tests for use cases and entities
- Integration tests for API endpoints
- Coverage reports with detailed metrics
- Jest extended for additional matchers
Run tests:
npm test # Run all tests
npm run test:watch # Watch mode
npm run test:coverage # With coverage๐ง Code Quality
ESLint & Prettier
Code quality is ensured with ESLint and Prettier:
npm run lint # Check for issues
npm run lint:fix # Fix issues automatically
npm run format # Format codeGit Hooks
Pre-commit hooks automatically:
- Lint and fix code
- Format code
- Validate commit messages (conventional commits)
Conventional Commits
Commit format: type(scope): description
Types: feat, fix, docs, style, refactor, test, chore
Examples:
feat: add user authenticationfix: resolve database connection issuedocs: update API documentation
๐ Example API
The template includes a complete User API with:
- Create user (POST /api/v1/users)
- Get all users (GET /api/v1/users)
- Get user by ID (GET /api/v1/users/:id)
- Update user (PUT /api/v1/users/:id)
- Delete user (DELETE /api/v1/users/:id)
All endpoints include:
- Input validation
- Error handling
- Swagger documentation
- Clean architecture implementation
๐ค Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m '''feat: add amazing feature''' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Built with modern Node.js best practices
- Inspired by clean architecture principles
- Designed for developer productivity
๐ Support
If you have any questions or issues:
- Check the GitHub Issues
- Create a new issue if needed
- Contribute to make it better!
โ Buy us a Coffee
- PayPal: Dakson Chaves Cruz
Happy coding! ๐