@craftycodesmith/node-structure 1.0.2 → 1.0.3

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.
Files changed (2) hide show
  1. package/README.md +107 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,107 @@
1
+ # Feature-Based CLI Generator
2
+
3
+ A zero-dependency CLI tool to scaffold Node.js projects with a **Feature-Based (Modular) Architecture** using TypeScript.
4
+
5
+ ---
6
+
7
+ ## 🚀 Quick Start
8
+
9
+ You can run this tool directly using `npx` without installation:
10
+ ```bash
11
+ # Initialize a new project
12
+ npx your-package-name init [folder-name]
13
+
14
+ # Generate a feature module
15
+ npx your-package-name res [resource-name]
16
+ ```
17
+
18
+ ---
19
+
20
+ ## 📦 Commands
21
+
22
+ ### `init [folder-name]`
23
+
24
+ Creates a new project with the feature-based architecture structure.
25
+
26
+ **Usage:**
27
+ ```bash
28
+ npx your-package-name init my-project
29
+ ```
30
+
31
+ If no folder name is provided, it initializes in the current directory.
32
+
33
+ **What it does:**
34
+ - Creates the directory structure
35
+ - Runs `npm init -y`
36
+ - Installs TypeScript and `@types/node`
37
+ - Generates a `tsconfig.json`
38
+ - Sets up base folders (`features`, `common`, `config`, `middleware`)
39
+
40
+ ---
41
+
42
+ ### `res [resource-name]`
43
+
44
+ Generates a new feature module with Controller, Service, and Model files.
45
+
46
+ **Usage:**
47
+ ```bash
48
+ npx your-package-name res User
49
+ ```
50
+
51
+ This creates:
52
+ ```
53
+ src/features/user/
54
+ ├── user.controller.ts
55
+ ├── user.service.ts
56
+ └── user.model.ts
57
+ ```
58
+
59
+ Each file includes boilerplate code to get you started quickly.
60
+
61
+ ---
62
+
63
+ ## 🏗 Generated Architecture
64
+
65
+ The tool enforces a modular structure where each functional area of your application lives in its own "feature" folder.
66
+ ```
67
+ project-root/
68
+ ├── src/
69
+ │ ├── features/
70
+ │ │ └── [feature-name]/
71
+ │ │ ├── [name].controller.ts
72
+ │ │ ├── [name].service.ts
73
+ │ │ └── [name].model.ts
74
+ │ ├── common/ # Shared utilities and helpers
75
+ │ ├── config/ # Environment and DB configurations
76
+ │ └── middleware/ # Global Express/Koa middlewares
77
+ ├── tsconfig.json
78
+ └── package.json
79
+ ```
80
+
81
+ ---
82
+
83
+ ## 🛠 Features
84
+
85
+ - **Zero Dependencies**: Lightweight and fast
86
+ - **TypeScript Ready**: Automatically generates `tsconfig.json` and installs `@types/node` and `typescript`
87
+ - **Automated Setup**: Runs `npm init -y` and dependency installation automatically
88
+ - **Clean Code**: Generates boilerplate classes and interfaces for rapid development
89
+ - **Modular Architecture**: Each feature is self-contained for better maintainability
90
+
91
+ ---
92
+
93
+ ## 📝 Example Workflow
94
+ ```bash
95
+ # 1. Create a new project
96
+ npx your-package-name init my-app
97
+
98
+ # 2. Navigate to the project
99
+ cd my-app
100
+
101
+ # 3. Generate features
102
+ npx your-package-name res User
103
+ npx your-package-name res Product
104
+ npx your-package-name res Order
105
+
106
+ # 4. Start building!
107
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@craftycodesmith/node-structure",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Feature-based architecture generator",
5
5
  "main": "dist/index.js",
6
6
  "bin": {