initkit 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +844 -0
- package/bin/index.js +8 -0
- package/package.json +79 -0
- package/src/cli.js +264 -0
- package/src/commands/create.js +264 -0
- package/src/index.js +9 -0
- package/src/prompts/questions.js +358 -0
- package/src/templates/express.js +915 -0
- package/src/templates/fullstack.js +1236 -0
- package/src/templates/nextjs.js +620 -0
- package/src/templates/react.js +586 -0
- package/src/templates/vue.js +545 -0
- package/src/utils/errorHandler.js +275 -0
- package/src/utils/git.js +69 -0
- package/src/utils/packageManager.js +90 -0
- package/src/utils/templateGenerator.js +365 -0
- package/src/utils/validation.js +186 -0
- package/src/utils/versionFetcher.js +128 -0
package/README.md
ADDED
|
@@ -0,0 +1,844 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# InitKit
|
|
4
|
+
|
|
5
|
+
**A modern CLI tool for scaffolding production-ready web projects**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/initkit)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
[](https://nodejs.org)
|
|
10
|
+
[](https://github.com/shirishshrestha/initkit)
|
|
11
|
+
|
|
12
|
+
Built with ES Modules | TypeScript Ready | Zero Config Required | Fully Documented
|
|
13
|
+
|
|
14
|
+
[Getting Started](#quick-start) • [Documentation](#documentation) • [Features](#features) • [Examples](#usage-examples)
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Demo
|
|
21
|
+
|
|
22
|
+
<div align="center">
|
|
23
|
+
|
|
24
|
+

|
|
25
|
+
|
|
26
|
+
_Creating a full-stack Next.js + Express application with InitKit_
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Why InitKit?
|
|
33
|
+
|
|
34
|
+
InitKit eliminates the tedious project setup process by providing intelligent scaffolding with modern best practices. Whether you're building a frontend app, backend API, or full-stack application, InitKit generates a production-ready structure in seconds.
|
|
35
|
+
|
|
36
|
+
**Key Benefits:**
|
|
37
|
+
|
|
38
|
+
- **Live Version Fetching** - Automatically fetches latest package versions from npm registry (no hardcoded versions!)
|
|
39
|
+
- **Smart Validation** - Real-time npm package name validation with helpful suggestions and colored feedback
|
|
40
|
+
- **Enhanced CLI UX** - Beautiful formatted help text with colors, boxes, and comprehensive examples
|
|
41
|
+
- **Monorepo Support** - Full-stack monorepo architecture with Turborepo and shared packages
|
|
42
|
+
- **Multiple Stacks** - MERN, PERN, T3 Stack, Next.js + Express, and more
|
|
43
|
+
- **Flexible Architecture** - Feature-based, type-based, domain-driven, clean architecture structures
|
|
44
|
+
- **Docker Ready** - Complete Docker orchestration with multi-stage builds and docker-compose
|
|
45
|
+
- **API Integration** - Seamless frontend-backend communication with axios interceptors
|
|
46
|
+
- **Production Ready** - ESLint, Prettier, Git hooks, and CI/CD pipelines out of the box
|
|
47
|
+
- **Automatic Rollback** - Failed installations clean up automatically with transaction-like safety
|
|
48
|
+
- **Interactive Prompts** - Intelligent 13-question flow that adapts to your project type
|
|
49
|
+
- **4 Package Managers** - Full support for npm, yarn, pnpm, and bun
|
|
50
|
+
- **Fully Documented** - Comprehensive JSDoc comments, guides, and architecture documentation
|
|
51
|
+
- **Test Coverage** - 44% coverage with unit and integration tests included
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Quick Start
|
|
56
|
+
|
|
57
|
+
### Installation
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npm install -g initkit
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Create Your First Project
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Interactive mode with step-by-step prompts
|
|
67
|
+
initkit
|
|
68
|
+
|
|
69
|
+
# Quick start with project name
|
|
70
|
+
initkit my-awesome-app
|
|
71
|
+
|
|
72
|
+
# Skip all prompts and use sensible defaults
|
|
73
|
+
initkit my-app --yes
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Documentation
|
|
79
|
+
|
|
80
|
+
Comprehensive documentation to help you get the most out of InitKit:
|
|
81
|
+
|
|
82
|
+
| Document | Description | Lines |
|
|
83
|
+
| -------------------------------------------------------------- | ---------------------------------------------------------------------- | ------------- |
|
|
84
|
+
| **[Quick Start Guide](./docs/QUICK_START.md)** | Get started in under 5 minutes with step-by-step tutorial | ~350 lines |
|
|
85
|
+
| **[Advanced Configuration](./docs/ADVANCED_CONFIGURATION.md)** | Custom templates, Docker, CI/CD, monorepo, and advanced features | ~930 lines |
|
|
86
|
+
| **[Architecture](./docs/ARCHITECTURE.md)** | System design, data flow, component architecture, and design decisions | ~800 lines |
|
|
87
|
+
| **[Contributing Guide](./CONTRIBUTING.md)** | Code of conduct, workflow, code guidelines, and template creation | ~500 lines |
|
|
88
|
+
| **[Question Flow](./QUESTION_FLOW.md)** | Interactive 13-question flow and decision tree visualization | Complete flow |
|
|
89
|
+
| **[Documentation Summary](./docs/DOCUMENTATION_SUMMARY.md)** | Overview of all documentation and maintenance guide | ~670 lines |
|
|
90
|
+
|
|
91
|
+
### 🚀 Getting Started
|
|
92
|
+
|
|
93
|
+
New to InitKit? Start here:
|
|
94
|
+
|
|
95
|
+
1. **[Quick Start Guide](./docs/QUICK_START.md)** - Create your first project in 5 minutes
|
|
96
|
+
2. **[Question Flow](./QUESTION_FLOW.md)** - Understand the interactive setup process
|
|
97
|
+
3. **[Advanced Configuration](./docs/ADVANCED_CONFIGURATION.md)** - Customize and extend InitKit
|
|
98
|
+
|
|
99
|
+
### 🛠️ For Contributors
|
|
100
|
+
|
|
101
|
+
Want to contribute or add a custom template?
|
|
102
|
+
|
|
103
|
+
1. **[Contributing Guide](./CONTRIBUTING.md)** - Code of conduct, workflow, guidelines
|
|
104
|
+
2. **[Architecture](./docs/ARCHITECTURE.md)** - Technical design and implementation
|
|
105
|
+
3. **[Examples](./docs/examples.md)** - Real-world examples to learn from
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Features
|
|
110
|
+
|
|
111
|
+
### 🎯 Project Types
|
|
112
|
+
|
|
113
|
+
| Type | Description | Use Case |
|
|
114
|
+
| ------------------- | -------------------------- | ---------------------------------- |
|
|
115
|
+
| **Frontend Only** | Single-page applications | React, Vue, Angular, Svelte apps |
|
|
116
|
+
| **Backend Only** | REST APIs and services | Express, Fastify, NestJS servers |
|
|
117
|
+
| **Full Stack** | Integrated client + server | Monorepo with frontend and backend |
|
|
118
|
+
| **Node.js Library** | Publishable npm packages | Reusable modules and utilities |
|
|
119
|
+
|
|
120
|
+
### 🎨 Framework Support
|
|
121
|
+
|
|
122
|
+
**Frontend Frameworks:**
|
|
123
|
+
|
|
124
|
+
- React (with Create React App or Vite)
|
|
125
|
+
- Vue.js (Vue CLI or Vite)
|
|
126
|
+
- Angular (Angular CLI)
|
|
127
|
+
- Svelte (SvelteKit)
|
|
128
|
+
- Next.js (App Router & Pages Router)
|
|
129
|
+
- Nuxt.js (Vue 3)
|
|
130
|
+
- Vanilla JavaScript (Modern ES6+)
|
|
131
|
+
|
|
132
|
+
**Backend Frameworks:**
|
|
133
|
+
|
|
134
|
+
- Express.js (Minimalist & flexible)
|
|
135
|
+
- Fastify (High performance)
|
|
136
|
+
- Koa (Next-gen Express)
|
|
137
|
+
- NestJS (Enterprise TypeScript)
|
|
138
|
+
- Hapi (Configuration-centric)
|
|
139
|
+
|
|
140
|
+
**Databases:**
|
|
141
|
+
|
|
142
|
+
- PostgreSQL (with connection pooling)
|
|
143
|
+
- MySQL (with TypeORM/Prisma)
|
|
144
|
+
- MongoDB (with Mongoose)
|
|
145
|
+
- SQLite (for prototyping)
|
|
146
|
+
|
|
147
|
+
### 🛠 Development Tools
|
|
148
|
+
|
|
149
|
+
**Code Quality:**
|
|
150
|
+
|
|
151
|
+
- ESLint (with recommended rules)
|
|
152
|
+
- Prettier (opinionated formatting)
|
|
153
|
+
- Husky (Git hooks)
|
|
154
|
+
- Lint-staged (pre-commit linting)
|
|
155
|
+
- EditorConfig (consistent coding styles)
|
|
156
|
+
|
|
157
|
+
**Testing:**
|
|
158
|
+
|
|
159
|
+
- Jest (comprehensive testing framework)
|
|
160
|
+
- Vitest (blazing fast unit tests)
|
|
161
|
+
- Pre-configured test structure
|
|
162
|
+
|
|
163
|
+
**DevOps:**
|
|
164
|
+
|
|
165
|
+
- Docker (multi-stage builds)
|
|
166
|
+
- Docker Compose (full-stack orchestration)
|
|
167
|
+
- GitHub Actions (CI/CD pipelines)
|
|
168
|
+
- Environment variables (.env setup)
|
|
169
|
+
- Turborepo (monorepo build system)
|
|
170
|
+
|
|
171
|
+
### 🏗️ Full-Stack Architectures
|
|
172
|
+
|
|
173
|
+
**Monorepo (Turborepo):**
|
|
174
|
+
|
|
175
|
+
- Shared packages (types, UI components)
|
|
176
|
+
- Unified workspace management
|
|
177
|
+
- Optimized build pipeline
|
|
178
|
+
- Consistent tooling across apps
|
|
179
|
+
|
|
180
|
+
**Traditional Stack Options:**
|
|
181
|
+
|
|
182
|
+
- **MERN** - MongoDB + Express + React + Node
|
|
183
|
+
- **PERN** - PostgreSQL + Express + React + Node
|
|
184
|
+
- **Next.js + Express** - Full-stack React with API
|
|
185
|
+
- **Laravel + React** - PHP backend with React frontend
|
|
186
|
+
|
|
187
|
+
**Features:**
|
|
188
|
+
|
|
189
|
+
- API integration (Vite proxy, Next.js rewrites)
|
|
190
|
+
- Docker orchestration (frontend + backend + database)
|
|
191
|
+
- Environment configuration
|
|
192
|
+
- Shared TypeScript types
|
|
193
|
+
- Reusable UI components
|
|
194
|
+
|
|
195
|
+
### 🎨 Styling Solutions
|
|
196
|
+
|
|
197
|
+
| Solution | Description | Best For |
|
|
198
|
+
| --------------------- | ------------------------------- | ------------------------------ |
|
|
199
|
+
| **Tailwind CSS** | Utility-first CSS framework | Rapid prototyping, modern apps |
|
|
200
|
+
| **CSS Modules** | Scoped CSS with local scope | Component isolation |
|
|
201
|
+
| **Styled Components** | CSS-in-JS with tagged templates | React apps, dynamic styling |
|
|
202
|
+
| **Emotion** | Performant CSS-in-JS | High-performance apps |
|
|
203
|
+
| **Sass/SCSS** | CSS preprocessor | Complex stylesheets |
|
|
204
|
+
| **Plain CSS** | Standard CSS files | Simple projects, full control |
|
|
205
|
+
|
|
206
|
+
### 📦 Additional Libraries
|
|
207
|
+
|
|
208
|
+
**Frontend State Management:**
|
|
209
|
+
|
|
210
|
+
- Redux Toolkit (Industry-standard state management)
|
|
211
|
+
- Zustand (Lightweight state management)
|
|
212
|
+
- Jotai (Atomic state management)
|
|
213
|
+
|
|
214
|
+
**Frontend Routing & Data:**
|
|
215
|
+
|
|
216
|
+
- React Router (Client-side routing)
|
|
217
|
+
- TanStack Query (Data fetching & caching)
|
|
218
|
+
- React Hook Form (Performant forms)
|
|
219
|
+
|
|
220
|
+
**Frontend UI & Animation:**
|
|
221
|
+
|
|
222
|
+
- Radix UI (Headless UI components)
|
|
223
|
+
- React Icons (Popular icon library)
|
|
224
|
+
- ShadCN UI (Beautiful component library)
|
|
225
|
+
- Framer Motion (Smooth animations)
|
|
226
|
+
|
|
227
|
+
**Backend:**
|
|
228
|
+
|
|
229
|
+
- Prisma (Type-safe ORM)
|
|
230
|
+
- JWT (Secure authentication)
|
|
231
|
+
- Bcrypt (Password hashing)
|
|
232
|
+
- Winston (Structured logging)
|
|
233
|
+
|
|
234
|
+
**Common:**
|
|
235
|
+
|
|
236
|
+
- Axios (HTTP client)
|
|
237
|
+
- Lodash (Utility functions)
|
|
238
|
+
- Date-fns (Date manipulation)
|
|
239
|
+
- Zod (Schema validation)
|
|
240
|
+
|
|
241
|
+
### 📁 Folder Structure Options
|
|
242
|
+
|
|
243
|
+
| Structure | Organization | Best For |
|
|
244
|
+
| ----------------- | ------------------------ | --------------------------- |
|
|
245
|
+
| **Feature-based** | Group by feature/module | Scalable applications |
|
|
246
|
+
| **Type-based** | Group by file type | Small to medium projects |
|
|
247
|
+
| **Domain-driven** | Group by business domain | Enterprise applications |
|
|
248
|
+
| **Flat** | Minimal nesting | Simple projects, prototypes |
|
|
249
|
+
|
|
250
|
+
### 📝 Code Quality & Documentation
|
|
251
|
+
|
|
252
|
+
**InitKit Generated Projects Include:**
|
|
253
|
+
|
|
254
|
+
- **JSDoc Comments** - Comprehensive function documentation with examples
|
|
255
|
+
- **README.md** - Project-specific getting started guide
|
|
256
|
+
- **Code Standards** - ESLint rules enforcing best practices
|
|
257
|
+
- **Git Hooks** - Pre-commit linting with Husky and lint-staged
|
|
258
|
+
- **CI/CD Templates** - GitHub Actions workflows for testing and deployment
|
|
259
|
+
- **Environment Examples** - `.env.example` files with all required variables
|
|
260
|
+
|
|
261
|
+
**InitKit Codebase Quality:**
|
|
262
|
+
|
|
263
|
+
- **200+ JSDoc Blocks** - All functions fully documented with types and examples
|
|
264
|
+
- **44% Test Coverage** - Unit and integration tests with Jest
|
|
265
|
+
- **Comprehensive Docs** - 2,400+ lines of guides and architecture documentation
|
|
266
|
+
- **Modern Patterns** - ES Modules, async/await, error boundaries
|
|
267
|
+
- **Type Safety** - TypeScript-first with strict type checking
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## Command Line Interface
|
|
272
|
+
|
|
273
|
+
### Enhanced CLI Experience
|
|
274
|
+
|
|
275
|
+
InitKit features a beautiful, user-friendly CLI with:
|
|
276
|
+
|
|
277
|
+
- **Colored Output** - Syntax highlighting and visual feedback
|
|
278
|
+
- **Formatted Boxes** - Clean, organized information display
|
|
279
|
+
- **Real-time Validation** - Instant feedback with ✓/✗ icons as you type
|
|
280
|
+
- **Smart Suggestions** - Auto-corrections for common mistakes
|
|
281
|
+
- **Progress Indicators** - Elegant spinners during operations
|
|
282
|
+
- **Helpful Examples** - Context-aware usage examples in help text
|
|
283
|
+
|
|
284
|
+
### Commands
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
# Create a new project (default command)
|
|
288
|
+
initkit [project-name] [options]
|
|
289
|
+
|
|
290
|
+
# List available templates and frameworks (categorized with icons)
|
|
291
|
+
initkit list
|
|
292
|
+
|
|
293
|
+
# Display CLI information and version (formatted with features list)
|
|
294
|
+
initkit info
|
|
295
|
+
|
|
296
|
+
# Show help (with examples and documentation links)
|
|
297
|
+
initkit --help
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### Options
|
|
301
|
+
|
|
302
|
+
| Option | Alias | Description | Default |
|
|
303
|
+
| -------------------------- | ------ | -------------------------------------- | ------------------ |
|
|
304
|
+
| `--version` | `-v` | Output the current version | - |
|
|
305
|
+
| `--template <name>` | `-t` | Specify template (react, vue, express) | Interactive prompt |
|
|
306
|
+
| `--yes` | `-y` | Skip prompts, use defaults | false |
|
|
307
|
+
| `--typescript` | `--ts` | Use TypeScript | true |
|
|
308
|
+
| `--javascript` | `--js` | Use JavaScript instead | false |
|
|
309
|
+
| `--no-git` | - | Skip Git initialization | false |
|
|
310
|
+
| `--no-install` | - | Skip dependency installation | false |
|
|
311
|
+
| `--package-manager <name>` | `-p` | Use npm, yarn, pnpm, or bun | npm |
|
|
312
|
+
| `--verbose` | - | Show detailed output | false |
|
|
313
|
+
| `--help` | `-h` | Display help information | - |
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
## Usage Examples
|
|
318
|
+
|
|
319
|
+
### Example 1: React + TypeScript + Tailwind
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
initkit my-react-app
|
|
323
|
+
# Select: Frontend Only → React → TypeScript → Tailwind CSS → ESLint + Prettier
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
**Generated Structure:**
|
|
327
|
+
|
|
328
|
+
```
|
|
329
|
+
my-react-app/
|
|
330
|
+
├── src/
|
|
331
|
+
│ ├── components/
|
|
332
|
+
│ ├── hooks/
|
|
333
|
+
│ ├── utils/
|
|
334
|
+
│ ├── App.tsx
|
|
335
|
+
│ └── main.tsx
|
|
336
|
+
├── public/
|
|
337
|
+
├── .eslintrc.cjs
|
|
338
|
+
├── .prettierrc
|
|
339
|
+
├── tsconfig.json
|
|
340
|
+
├── vite.config.ts
|
|
341
|
+
└── package.json
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### Example 2: Full Stack MERN with Docker
|
|
345
|
+
|
|
346
|
+
```bash
|
|
347
|
+
initkit fullstack-app
|
|
348
|
+
# Select: Full Stack → Traditional → MERN
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
**Generated Structure:**
|
|
352
|
+
|
|
353
|
+
```
|
|
354
|
+
fullstack-app/
|
|
355
|
+
├── client/ # React + Vite frontend
|
|
356
|
+
│ ├── src/
|
|
357
|
+
│ │ ├── features/
|
|
358
|
+
│ │ ├── components/
|
|
359
|
+
│ │ └── lib/api.js
|
|
360
|
+
│ ├── Dockerfile
|
|
361
|
+
│ └── package.json
|
|
362
|
+
├── server/ # Express backend
|
|
363
|
+
│ ├── src/
|
|
364
|
+
│ │ ├── controllers/
|
|
365
|
+
│ │ ├── models/
|
|
366
|
+
│ │ └── routes/
|
|
367
|
+
│ ├── Dockerfile
|
|
368
|
+
│ └── package.json
|
|
369
|
+
├── docker-compose.yml # MongoDB + Frontend + Backend
|
|
370
|
+
└── README.md
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
### Example 3: Monorepo with Turborepo
|
|
374
|
+
|
|
375
|
+
```bash
|
|
376
|
+
initkit my-monorepo
|
|
377
|
+
# Select: Full Stack → Monorepo → Next.js + Express + PostgreSQL
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
**Generated Structure:**
|
|
381
|
+
|
|
382
|
+
```
|
|
383
|
+
my-monorepo/
|
|
384
|
+
├── apps/
|
|
385
|
+
│ ├── frontend/ # Next.js app
|
|
386
|
+
│ └── backend/ # Express API
|
|
387
|
+
├── packages/
|
|
388
|
+
│ ├── shared-types/ # Shared TypeScript interfaces
|
|
389
|
+
│ └── ui-components/ # Shared React components
|
|
390
|
+
├── turbo.json # Turborepo config
|
|
391
|
+
├── docker-compose.yml
|
|
392
|
+
└── package.json
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
### Example 4: Express API with Docker
|
|
396
|
+
|
|
397
|
+
```bash
|
|
398
|
+
initkit api-server
|
|
399
|
+
# Select: Backend Only → Express → MongoDB → TypeScript → Docker + GitHub Actions
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
**Features:**
|
|
403
|
+
|
|
404
|
+
- RESTful API structure
|
|
405
|
+
- MongoDB connection setup
|
|
406
|
+
- Docker multi-stage build
|
|
407
|
+
- GitHub Actions CI/CD
|
|
408
|
+
- Environment variable management
|
|
409
|
+
|
|
410
|
+
### Example 5: Quick Start with Defaults
|
|
411
|
+
|
|
412
|
+
```bash
|
|
413
|
+
initkit quick-app --yes
|
|
414
|
+
# Creates a full-stack app with React + Express + TypeScript
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
---
|
|
418
|
+
|
|
419
|
+
## Interactive Prompt Flow
|
|
420
|
+
|
|
421
|
+
InitKit uses an intelligent 13-question flow that adapts based on your project type:
|
|
422
|
+
|
|
423
|
+
1. **Project Type** - Frontend, Backend, Full Stack, or Library
|
|
424
|
+
2. **Project Name** - With real-time validation and suggestions
|
|
425
|
+
3. **Frontend Framework** - Shown for Frontend/Full Stack projects
|
|
426
|
+
4. **Backend Framework** - Shown for Backend/Full Stack projects
|
|
427
|
+
5. **Database** - Shown for Backend/Full Stack projects
|
|
428
|
+
6. **Language** - TypeScript (recommended) or JavaScript
|
|
429
|
+
7. **Folder Structure** - Feature-based, Type-based, Domain-driven, or Flat
|
|
430
|
+
8. **TypeScript Strictness** - Strict, Moderate, or Relaxed (if TS selected)
|
|
431
|
+
9. **Styling Solution** - CSS frameworks and preprocessors
|
|
432
|
+
10. **Additional Libraries** - Multi-select from curated list
|
|
433
|
+
11. **Development Features** - Testing, linting, Docker, CI/CD
|
|
434
|
+
12. **Package Manager** - npm, yarn, or pnpm
|
|
435
|
+
13. **Git Initialization** - Initialize repository with .gitignore
|
|
436
|
+
|
|
437
|
+
See [QUESTION_FLOW.md](./QUESTION_FLOW.md) for the complete decision tree.
|
|
438
|
+
|
|
439
|
+
---
|
|
440
|
+
|
|
441
|
+
## What Makes InitKit Special?
|
|
442
|
+
|
|
443
|
+
### 🎯 Production-Ready Output
|
|
444
|
+
|
|
445
|
+
Unlike other scaffolding tools, InitKit generates **truly production-ready** projects:
|
|
446
|
+
|
|
447
|
+
- **Latest Dependencies** - Fetches actual latest versions from npm registry (not hardcoded)
|
|
448
|
+
- **No Manual Setup Required** - Everything configured and ready to deploy
|
|
449
|
+
- **Best Practices Built-in** - Error boundaries, loading states, proper TypeScript types
|
|
450
|
+
- **Security First** - Environment variables, input validation, secure authentication patterns
|
|
451
|
+
- **Performance Optimized** - Code splitting, lazy loading, optimized bundle sizes
|
|
452
|
+
- **Deployment Ready** - Docker files, CI/CD pipelines, health checks included
|
|
453
|
+
|
|
454
|
+
### 🚀 Developer Experience
|
|
455
|
+
|
|
456
|
+
- **Intelligent Prompts** - Context-aware questions that adapt to your choices
|
|
457
|
+
- **Real-time Feedback** - See validation results as you type
|
|
458
|
+
- **Helpful Errors** - Clear messages with suggestions for fixing issues
|
|
459
|
+
- **Automatic Cleanup** - Failed installations roll back completely
|
|
460
|
+
- **Comprehensive Docs** - 2,400+ lines of guides, tutorials, and API docs
|
|
461
|
+
|
|
462
|
+
### 🏗️ Enterprise-Grade Architecture
|
|
463
|
+
|
|
464
|
+
- **Clean Code** - Feature-based, domain-driven, or type-based organization
|
|
465
|
+
- **Scalable Structure** - Monorepo support with Turborepo for large projects
|
|
466
|
+
- **Type Safety** - Full TypeScript support with strict type checking
|
|
467
|
+
- **Testing Ready** - Jest/Vitest configured with example tests
|
|
468
|
+
- **Maintainable** - Consistent patterns, JSDoc comments, clear separation of concerns
|
|
469
|
+
|
|
470
|
+
### 📚 Documentation Excellence
|
|
471
|
+
|
|
472
|
+
**For Users:**
|
|
473
|
+
|
|
474
|
+
- Quick Start Guide (5-minute tutorial)
|
|
475
|
+
- Advanced Configuration (Docker, CI/CD, monorepo)
|
|
476
|
+
- Interactive Question Flow visualization
|
|
477
|
+
|
|
478
|
+
**For Developers:**
|
|
479
|
+
|
|
480
|
+
- Architecture Documentation (800+ lines)
|
|
481
|
+
- Contributing Guide with template creation walkthrough
|
|
482
|
+
- Comprehensive JSDoc on all functions
|
|
483
|
+
|
|
484
|
+
**For Code:**
|
|
485
|
+
|
|
486
|
+
- Generated README for every project
|
|
487
|
+
- Environment variable documentation
|
|
488
|
+
- API integration examples
|
|
489
|
+
|
|
490
|
+
---
|
|
491
|
+
|
|
492
|
+
## Development
|
|
493
|
+
|
|
494
|
+
### Setup
|
|
495
|
+
|
|
496
|
+
```bash
|
|
497
|
+
# Clone the repository
|
|
498
|
+
git clone git@github.com:shirishshrestha/initkit.git
|
|
499
|
+
cd initkit
|
|
500
|
+
|
|
501
|
+
# Install dependencies
|
|
502
|
+
npm install
|
|
503
|
+
|
|
504
|
+
# Link for local development
|
|
505
|
+
npm link
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
### Available Scripts
|
|
509
|
+
|
|
510
|
+
```bash
|
|
511
|
+
# Run the CLI locally
|
|
512
|
+
npm start [project-name]
|
|
513
|
+
|
|
514
|
+
# Run tests with ES modules support
|
|
515
|
+
npm test
|
|
516
|
+
|
|
517
|
+
# Lint code
|
|
518
|
+
npm run lint
|
|
519
|
+
|
|
520
|
+
# Format code
|
|
521
|
+
npm run format
|
|
522
|
+
|
|
523
|
+
# Pre-publish checks (test + lint)
|
|
524
|
+
npm run prepublishOnly
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
### Project Structure
|
|
528
|
+
|
|
529
|
+
```
|
|
530
|
+
initkit/
|
|
531
|
+
├── bin/
|
|
532
|
+
│ └── index.js # CLI entry point
|
|
533
|
+
├── src/
|
|
534
|
+
│ ├── cli.js # Main CLI program
|
|
535
|
+
│ ├── index.js # Programmatic API
|
|
536
|
+
│ ├── commands/
|
|
537
|
+
│ │ └── create.js # Project creation logic
|
|
538
|
+
│ ├── prompts/
|
|
539
|
+
│ │ └── questions.js # Interactive prompts
|
|
540
|
+
│ └── utils/
|
|
541
|
+
│ ├── errorHandler.js # Error handling & rollback
|
|
542
|
+
│ ├── validation.js # Input validation
|
|
543
|
+
│ ├── templateGenerator.js
|
|
544
|
+
│ ├── packageManager.js
|
|
545
|
+
│ └── git.js
|
|
546
|
+
├── templates/ # Project templates (to be added)
|
|
547
|
+
├── docs/ # Documentation
|
|
548
|
+
├── __tests__/ # Test files
|
|
549
|
+
└── package.json
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
---
|
|
553
|
+
|
|
554
|
+
## Technical Details
|
|
555
|
+
|
|
556
|
+
### Built With
|
|
557
|
+
|
|
558
|
+
**Core Dependencies:**
|
|
559
|
+
|
|
560
|
+
- **Commander.js** (12.0.0) - CLI framework with command routing
|
|
561
|
+
- **Inquirer** (9.2.15) - Interactive prompts with validation
|
|
562
|
+
- **Chalk** (5.3.0) - Terminal styling and colors
|
|
563
|
+
- **Ora** (8.0.1) - Elegant progress spinners
|
|
564
|
+
- **fs-extra** (11.2.0) - Enhanced file system operations
|
|
565
|
+
- **validate-npm-package-name** (5.0.0) - Package name validation
|
|
566
|
+
|
|
567
|
+
**Development Dependencies:**
|
|
568
|
+
|
|
569
|
+
- **Jest** (29.7.0) - Testing framework with ES module support
|
|
570
|
+
- **ESLint** (9.17.0) - Code linting with modern rules
|
|
571
|
+
- **Prettier** (3.4.2) - Code formatting
|
|
572
|
+
|
|
573
|
+
### ES Modules Architecture
|
|
574
|
+
|
|
575
|
+
InitKit is built entirely with modern ES Modules:
|
|
576
|
+
|
|
577
|
+
- ✅ `"type": "module"` in package.json
|
|
578
|
+
- ✅ All imports use `.js` file extensions
|
|
579
|
+
- ✅ Native ESM support (no transpilation)
|
|
580
|
+
- ✅ Compatible with Node.js 14+
|
|
581
|
+
- ✅ Tree-shakeable for optimal bundle sizes
|
|
582
|
+
|
|
583
|
+
### Error Handling System
|
|
584
|
+
|
|
585
|
+
**Professional-Grade Error Management:**
|
|
586
|
+
|
|
587
|
+
- **CLIError Class** - Custom error type with codes and context
|
|
588
|
+
- **8 Error Codes** - Specific error types (VALIDATION_ERROR, DIRECTORY_EXISTS, etc.)
|
|
589
|
+
- **Automatic Rollback** - Transaction-like cleanup on failure
|
|
590
|
+
- **Graceful Shutdown** - Handles Ctrl+C and other interrupts
|
|
591
|
+
- **Validation Errors** - Clear messages with helpful suggestions
|
|
592
|
+
- **Safe File Operations** - All I/O wrapped in error boundaries
|
|
593
|
+
- **Context Preservation** - Errors include relevant debugging information
|
|
594
|
+
|
|
595
|
+
---
|
|
596
|
+
|
|
597
|
+
## Requirements
|
|
598
|
+
|
|
599
|
+
- **Node.js**: >= 14.0.0
|
|
600
|
+
- **Package Manager**: npm >= 6.0.0 (or yarn >= 1.22.0, pnpm >= 6.0.0, bun >= 1.0.0)
|
|
601
|
+
- **Git**: >= 2.0.0 (for Git initialization feature)
|
|
602
|
+
- **TypeScript**: Automatically installed per project (no global installation needed)
|
|
603
|
+
|
|
604
|
+
---
|
|
605
|
+
|
|
606
|
+
## Troubleshooting
|
|
607
|
+
|
|
608
|
+
### Common Issues
|
|
609
|
+
|
|
610
|
+
#### 1. TypeScript Config Errors
|
|
611
|
+
|
|
612
|
+
**Problem:** `No inputs were found in config file` error after project generation.
|
|
613
|
+
|
|
614
|
+
**Solution:** This has been fixed in the latest version. Update InitKit:
|
|
615
|
+
|
|
616
|
+
```bash
|
|
617
|
+
npm update -g initkit
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
If you're on an older version, manually update your `tsconfig.json`:
|
|
621
|
+
|
|
622
|
+
```json
|
|
623
|
+
{
|
|
624
|
+
"include": ["src/**/*.ts", "src/**/*.tsx"]
|
|
625
|
+
}
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
#### 2. Package Installation Fails
|
|
629
|
+
|
|
630
|
+
**Problem:** Dependencies fail to install during project creation.
|
|
631
|
+
|
|
632
|
+
**Solutions:**
|
|
633
|
+
|
|
634
|
+
- Check your internet connection
|
|
635
|
+
- Try a different package manager: `initkit my-app --package-manager pnpm`
|
|
636
|
+
- Clear npm cache: `npm cache clean --force`
|
|
637
|
+
- Use `--no-install` flag and install manually later:
|
|
638
|
+
```bash
|
|
639
|
+
initkit my-app --no-install
|
|
640
|
+
cd my-app
|
|
641
|
+
npm install
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
#### 3. Directory Already Exists
|
|
645
|
+
|
|
646
|
+
**Problem:** `DIRECTORY_EXISTS` error when creating a project.
|
|
647
|
+
|
|
648
|
+
**Solution:** Choose a different project name or remove the existing directory:
|
|
649
|
+
|
|
650
|
+
```bash
|
|
651
|
+
rm -rf my-app # On Unix/Mac
|
|
652
|
+
rmdir /s my-app # On Windows
|
|
653
|
+
```
|
|
654
|
+
|
|
655
|
+
#### 4. Permission Denied Errors
|
|
656
|
+
|
|
657
|
+
**Problem:** `EACCES` or permission errors during installation.
|
|
658
|
+
|
|
659
|
+
**Solutions:**
|
|
660
|
+
|
|
661
|
+
- On Unix/Mac: Use sudo (not recommended) or fix npm permissions:
|
|
662
|
+
```bash
|
|
663
|
+
mkdir ~/.npm-global
|
|
664
|
+
npm config set prefix '~/.npm-global'
|
|
665
|
+
export PATH=~/.npm-global/bin:$PATH
|
|
666
|
+
```
|
|
667
|
+
- On Windows: Run terminal as Administrator
|
|
668
|
+
- Or install locally without `-g` flag
|
|
669
|
+
|
|
670
|
+
#### 5. Backend Feature-Based Structure Errors
|
|
671
|
+
|
|
672
|
+
**Problem:** `ENOENT: no such file or directory` when creating backend with feature-based structure.
|
|
673
|
+
|
|
674
|
+
**Solution:** This has been fixed. Update InitKit to the latest version:
|
|
675
|
+
|
|
676
|
+
```bash
|
|
677
|
+
npm update -g initkit
|
|
678
|
+
```
|
|
679
|
+
|
|
680
|
+
#### 6. Git Initialization Fails
|
|
681
|
+
|
|
682
|
+
**Problem:** Git repository not initialized or .gitignore missing.
|
|
683
|
+
|
|
684
|
+
**Solutions:**
|
|
685
|
+
|
|
686
|
+
- Ensure Git is installed: `git --version`
|
|
687
|
+
- Manually initialize: `git init && git add . && git commit -m "Initial commit"`
|
|
688
|
+
- Use `--no-git` flag if Git is not available
|
|
689
|
+
|
|
690
|
+
#### 7. Outdated Package Versions
|
|
691
|
+
|
|
692
|
+
**Problem:** Generated projects have old package versions.
|
|
693
|
+
|
|
694
|
+
**Solution:** InitKit now fetches latest versions from npm automatically. Update to latest:
|
|
695
|
+
|
|
696
|
+
```bash
|
|
697
|
+
npm update -g initkit
|
|
698
|
+
```
|
|
699
|
+
|
|
700
|
+
For existing projects, update packages:
|
|
701
|
+
|
|
702
|
+
```bash
|
|
703
|
+
npm update # Update to latest within semver range
|
|
704
|
+
npm outdated # Check for newer versions
|
|
705
|
+
```
|
|
706
|
+
|
|
707
|
+
### Getting Help
|
|
708
|
+
|
|
709
|
+
If you encounter issues not listed here:
|
|
710
|
+
|
|
711
|
+
1. **Check existing issues**: [GitHub Issues](https://github.com/shirishshrestha/initkit/issues)
|
|
712
|
+
2. **Create a new issue**: Include:
|
|
713
|
+
- InitKit version: `initkit --version`
|
|
714
|
+
- Node version: `node --version`
|
|
715
|
+
- OS: Windows/Mac/Linux
|
|
716
|
+
- Full error message
|
|
717
|
+
- Steps to reproduce
|
|
718
|
+
3. **Join discussions**: [GitHub Discussions](https://github.com/shirishshrestha/initkit/discussions)
|
|
719
|
+
|
|
720
|
+
### Debug Mode
|
|
721
|
+
|
|
722
|
+
Run InitKit with verbose output for debugging:
|
|
723
|
+
|
|
724
|
+
```bash
|
|
725
|
+
initkit my-app --verbose
|
|
726
|
+
```
|
|
727
|
+
|
|
728
|
+
---
|
|
729
|
+
|
|
730
|
+
## Recent Updates
|
|
731
|
+
|
|
732
|
+
### Version 1.1.0 (Latest)
|
|
733
|
+
|
|
734
|
+
**🎉 Major Features:**
|
|
735
|
+
|
|
736
|
+
- ✨ **Live NPM Version Fetching** - Automatically fetches latest package versions from npm registry
|
|
737
|
+
- 🎯 **New Libraries Added**:
|
|
738
|
+
- Redux Toolkit & React Redux (state management)
|
|
739
|
+
- Jotai (atomic state)
|
|
740
|
+
- React Router (routing)
|
|
741
|
+
- React Icons (icon library)
|
|
742
|
+
- Radix UI (headless components)
|
|
743
|
+
- ShadCN UI (component library)
|
|
744
|
+
- 📦 **Bun Support** - Added bun as a package manager option
|
|
745
|
+
|
|
746
|
+
**🐛 Bug Fixes:**
|
|
747
|
+
|
|
748
|
+
- Fixed TypeScript config errors (Next.js, Vue, Express)
|
|
749
|
+
- Fixed Express backend feature-based structure directory errors
|
|
750
|
+
- Fixed package manager selection for yarn, pnpm, and bun
|
|
751
|
+
- Fixed Next.js tsconfig to properly include `src/**/*.ts` patterns
|
|
752
|
+
|
|
753
|
+
**🔧 Improvements:**
|
|
754
|
+
|
|
755
|
+
- All templates now fetch actual latest versions from npm (React 19+, Vite 7+, Next.js 16+)
|
|
756
|
+
- Enhanced error messages with better troubleshooting suggestions
|
|
757
|
+
- Improved directory structure handling across all architecture patterns
|
|
758
|
+
- Better fallback handling when npm registry is unreachable
|
|
759
|
+
|
|
760
|
+
---
|
|
761
|
+
|
|
762
|
+
## Contributing
|
|
763
|
+
|
|
764
|
+
We welcome contributions! InitKit has comprehensive documentation to help you get started.
|
|
765
|
+
|
|
766
|
+
**📖 Read First:**
|
|
767
|
+
|
|
768
|
+
- [Contributing Guide](./CONTRIBUTING.md) - Code of conduct, workflow, and guidelines
|
|
769
|
+
- [Architecture Documentation](./docs/ARCHITECTURE.md) - System design and patterns
|
|
770
|
+
- [Adding Templates](./CONTRIBUTING.md#adding-new-templates) - 5-step guide for new frameworks
|
|
771
|
+
|
|
772
|
+
**Quick Start:**
|
|
773
|
+
|
|
774
|
+
1. Fork the repository
|
|
775
|
+
2. Clone and setup: `git clone <your-fork> && cd initkit && npm install`
|
|
776
|
+
3. Create feature branch: `git checkout -b feature/amazing-feature`
|
|
777
|
+
4. Make changes and add tests (maintain 40%+ coverage)
|
|
778
|
+
5. Commit with conventional commits: `git commit -m 'feat: add amazing feature'`
|
|
779
|
+
6. Push and create PR: `git push origin feature/amazing-feature`
|
|
780
|
+
|
|
781
|
+
**Contribution Areas:**
|
|
782
|
+
|
|
783
|
+
- 🎨 Add new framework templates (React, Vue, Next.js, etc.)
|
|
784
|
+
- 🐛 Fix bugs and improve error messages
|
|
785
|
+
- 📝 Improve documentation and examples
|
|
786
|
+
- ✅ Add more test coverage
|
|
787
|
+
- 🚀 Optimize performance and bundle size
|
|
788
|
+
- 💡 Suggest new features and improvements
|
|
789
|
+
|
|
790
|
+
**Code Standards:**
|
|
791
|
+
|
|
792
|
+
- Follow ESLint rules (run `npm run lint`)
|
|
793
|
+
- Add JSDoc comments to all functions
|
|
794
|
+
- Write tests for new features
|
|
795
|
+
- Update documentation as needed
|
|
796
|
+
|
|
797
|
+
---
|
|
798
|
+
|
|
799
|
+
## License
|
|
800
|
+
|
|
801
|
+
MIT © [Shirish Shrestha](https://github.com/shirishshrestha)
|
|
802
|
+
|
|
803
|
+
---
|
|
804
|
+
|
|
805
|
+
## Project Statistics
|
|
806
|
+
|
|
807
|
+
### Codebase Metrics
|
|
808
|
+
|
|
809
|
+
- **Total Lines of Code**: ~4,000+ lines
|
|
810
|
+
- **Documentation**: 2,400+ lines across 6 major docs
|
|
811
|
+
- **JSDoc Comments**: 200+ function documentation blocks
|
|
812
|
+
- **Test Coverage**: 44% (unit + integration tests)
|
|
813
|
+
- **Test Files**: 7 test suites with 52 passing tests
|
|
814
|
+
- **Supported Frameworks**: 15+ (Frontend, Backend, Full-Stack)
|
|
815
|
+
- **Template Files**: 10+ production-ready templates
|
|
816
|
+
|
|
817
|
+
### Documentation Coverage
|
|
818
|
+
|
|
819
|
+
- ✅ Quick Start Guide (5-minute tutorial)
|
|
820
|
+
- ✅ Advanced Configuration (930 lines)
|
|
821
|
+
- ✅ Architecture Documentation (800 lines)
|
|
822
|
+
- ✅ Contributing Guide (500 lines)
|
|
823
|
+
- ✅ Question Flow (complete decision tree)
|
|
824
|
+
- ✅ JSDoc on all major functions
|
|
825
|
+
- ✅ Enhanced CLI help with examples
|
|
826
|
+
|
|
827
|
+
---
|
|
828
|
+
|
|
829
|
+
## Support
|
|
830
|
+
|
|
831
|
+
- **Issues**: [GitHub Issues](https://github.com/shirishshrestha/initkit/issues)
|
|
832
|
+
- **Discussions**: [GitHub Discussions](https://github.com/shirishshrestha/initkit/discussions)
|
|
833
|
+
- **Documentation**: [Full Documentation](./docs/QUICK_START.md)
|
|
834
|
+
- **Email**: your.email@example.com
|
|
835
|
+
|
|
836
|
+
---
|
|
837
|
+
|
|
838
|
+
<div align="center">
|
|
839
|
+
|
|
840
|
+
**Made with ❤️ by developers, for developers**
|
|
841
|
+
|
|
842
|
+
[⭐ Star on GitHub](https://github.com/shirishshrestha/initkit) | [📖 Documentation](./docs/user-guide.md) | [🐛 Report Bug](https://github.com/shirishshrestha/initkit/issues)
|
|
843
|
+
|
|
844
|
+
</div>
|