create-tk-node-app
v1.0.4
Published
CLI to scaffold Node.js projects
Readme
create-tk-node-app
A powerful CLI tool to scaffold Node.js projects with multiple template options including JavaScript, TypeScript, and encrypted variants.
Features
- 🚀 Quick project scaffolding
- 🔐 Password-protected CLI access
- 📝 Multiple template options:
- JavaScript
- TypeScript
- JavaScript (Encrypted)
- TypeScript (Encrypted)
- 🎨 Beautiful CLI interface with colors and spinners
- 📦 Ready-to-use project structure
Installation
npx create-tk-node-appUsage
Create a new project
create-tk-node-appFollow the prompts
- Enter CLI password - Authenticate to use the CLI
- Project name - Name your new project
- Select template - Choose from available templates
Available Templates
| Template | Description | Features | |----------|-------------|-----------| | JavaScript | Standard JavaScript project | Express, MongoDB, JWT auth | | TypeScript | TypeScript project | All JS features + TypeScript support | | JavaScript (Encrypted) | JavaScript with encryption | Built-in payload encryption/decryption | | TypeScript (Encrypted) | TypeScript with encryption | All features + encryption + TypeScript |
Project Structure
Each generated project includes:
my-app/
├── bin/
│ └── www.js # Server entry point
├── controllers/
│ ├── admin.controller.js # Admin logic
│ └── auth.controller.js # Authentication logic
├── helpers/
│ ├── common.js # Common utilities
│ ├── Crypto.js # Encryption utilities (encrypted templates)
│ └── validations/
│ └── user/
│ └── user.validate.js # Input validation
├── model/
│ ├── user.js # User model
│ ├── userLogin.js # User session model
│ └── country_state_cities.js # Location data
├── routes/
│ └── v1/
│ ├── admin.route.js # Admin routes
│ ├── auth.route.js # Auth routes
│ └── v1.js # Route aggregator
├── services/
│ ├── admin.service.js # Admin business logic
│ └── auth.service.js # Auth business logic
├── seeder/
│ ├── seeder.js # Database seeder
│ └── user.seeder.js # User data seeder
├── views/
│ └── EmailTemplate/
│ └── verification.ejs # Email templates
├── .env.example # Environment variables template
├── .gitignore # Git ignore file
├── package.json # Dependencies and scripts
└── README.md # Project documentationGetting Started
After creating your project:
cd your-project-name
npm install
cp .env.example .env
npm run devEnvironment Variables
Configure your .env file with:
# Server
NODE_ENV=local
PORT=4000
HOST=http://localhost
# Database
DB_URL=mongodb://localhost:27017/your-database-name
# JWT Authentication
JWT_EXPIRATION=2h
# Header Keys
WebKey=your-web-key
mobileKey=your-mobile-key
# Socket Host
socketHost=http://localhost:4000
# Email Configuration
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
[email protected]
EMAIL_PASS=your-app-passwordAvailable Scripts
npm run dev- Start development server with nodemonnpm start- Start production servernpm run seed- Run database seeders
Features Included
Authentication
- JWT-based authentication
- Password hashing with bcrypt
- Login/Logout functionality
- Password reset
- Token refresh
Security
- Request payload encryption/decryption (encrypted templates)
- Rate limiting
- CORS configuration
- Input validation
Database
- MongoDB integration with Mongoose
- User management
- Session tracking
- Location data (countries, states, cities)
API Endpoints
Authentication Routes
POST /api/v1/auth/login- User loginPUT /api/v1/auth/changepassword- Change passwordPUT /api/v1/auth/editprofile- Update profilePOST /api/v1/auth/logout- User logoutPOST /api/v1/auth/forgetpassword- Forgot passwordPUT /api/v1/auth/reset-password- Reset passwordPOST /api/v1/auth/refreshtoken- Refresh JWT token
Admin Routes
POST /api/v1/admin/createuser- Create new user (admin only)
Development
Prerequisites
- Node.js 18+
- MongoDB
- npm
Local Development
git clone https://github.com/your-username/create-tk-node-app.git
cd create-tk-node-app
npm install
npm linkContributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the 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.
Support
If you encounter any issues or have questions:
Changelog
v1.0.2
- Fixed template path issues
- Updated environment variable examples
- Improved error handling
v1.0.1
- Initial release
- Basic scaffolding functionality
- Password protection
- Multiple template support
Made with ❤️ by the create-tk-node-app team
