servcraft 0.1.6 → 0.2.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/README.md CHANGED
@@ -229,19 +229,49 @@ npx servcraft init
229
229
  You'll be prompted to choose:
230
230
  - Project name
231
231
  - Language (TypeScript/JavaScript)
232
+ - Module system (ESM/CommonJS)
232
233
  - Database (PostgreSQL, MySQL, SQLite, MongoDB)
233
234
  - Validation library (Zod, Joi, Yup)
234
235
  - Features (Auth, Users, Email, etc.)
235
236
 
237
+ ### Module System Options
238
+
239
+ ServCraft supports both **ES Modules** and **CommonJS**:
240
+
241
+ | Module System | Import Style | File Extension | package.json |
242
+ |--------------|--------------|----------------|--------------|
243
+ | **ESM** (default) | `import x from 'y'` | `.js` | `"type": "module"` |
244
+ | **CommonJS** | `require('y')` | `.cjs` | (none) |
245
+
246
+ ```bash
247
+ # ESM project (recommended)
248
+ npx servcraft init my-app --esm
249
+
250
+ # CommonJS project (legacy compatibility)
251
+ npx servcraft init my-app --cjs
252
+ ```
253
+
254
+ **Note:** TypeScript projects always use ESM syntax in source files. The output format (ESM/CJS) is controlled by the `tsup` build configuration.
255
+
236
256
  ## CLI Commands
237
257
 
238
258
  ### Initialize project
239
259
 
240
260
  ```bash
241
- servcraft init [name] # Create new project
242
- servcraft init --yes # Use defaults
243
- servcraft init --js # Use JavaScript
261
+ servcraft init [name] # Create new project (interactive)
262
+ servcraft init --yes # Use defaults (TypeScript + ESM)
263
+ servcraft init --js # Use JavaScript instead of TypeScript
264
+ servcraft init --ts # Use TypeScript (default)
265
+ servcraft init --esm # Use ES Modules (default)
266
+ servcraft init --cjs # Use CommonJS
244
267
  servcraft init --db postgresql # Specify database
268
+ servcraft init --dry-run # Preview files without writing
269
+
270
+ # Combined examples
271
+ servcraft init my-app --js --esm --db postgresql -y # JS + ESM + PostgreSQL
272
+ servcraft init my-app --js --cjs --db mongodb -y # JS + CommonJS + MongoDB
273
+ servcraft init my-app --ts --db mysql -y # TypeScript + MySQL
274
+ servcraft init my-app --dry-run -y # Preview without creating
245
275
  ```
246
276
 
247
277
  ### Generate resources
@@ -250,6 +280,7 @@ servcraft init --db postgresql # Specify database
250
280
  # Generate complete module
251
281
  servcraft generate module product
252
282
  servcraft g m product --prisma # Include Prisma model
283
+ servcraft g m product --dry-run # Preview files
253
284
 
254
285
  # Generate individual files
255
286
  servcraft generate controller user
@@ -263,6 +294,22 @@ servcraft g c user # controller
263
294
  servcraft g s order # service
264
295
  servcraft g r item # repository
265
296
  servcraft g v post # schema/validator
297
+
298
+ # Preview before generating
299
+ servcraft g m product name:string price:number --dry-run
300
+ ```
301
+
302
+ ### List available modules
303
+
304
+ ```bash
305
+ servcraft list # Show all available modules
306
+ servcraft list --installed # Show only installed modules
307
+ servcraft list --available # Show only available modules
308
+ servcraft list --category Security # Filter by category
309
+ servcraft list --json # Output as JSON
310
+
311
+ # Aliases
312
+ servcraft ls # Same as list
266
313
  ```
267
314
 
268
315
  ### Add pre-built modules
@@ -284,7 +331,7 @@ servcraft add feature-flag # Feature flags & A/B testing
284
331
  servcraft add analytics # Prometheus metrics & tracking
285
332
  servcraft add media-processing # Image/video processing
286
333
  servcraft add api-versioning # API version management
287
- servcraft add --list # Show all modules
334
+ servcraft add auth --dry-run # Preview module files
288
335
  ```
289
336
 
290
337
  **Automatic Environment Configuration:**
package/ROADMAP.md ADDED
@@ -0,0 +1,327 @@
1
+ # Servcraft Roadmap
2
+
3
+ This document outlines the planned features and improvements for Servcraft.
4
+
5
+ ## Version History
6
+
7
+ - **v0.2.0** (Current) - Better error messages, servcraft remove, servcraft doctor (stub)
8
+ - **v0.1.9** - Added `--dry-run` option for all commands (init, add, generate)
9
+ - **v0.1.8** - Added `servcraft list` command
10
+ - **v0.1.7** - ESM/CommonJS module system choice
11
+ - **v0.1.6.3** - JavaScript/TypeScript support, docs command, bug fixes
12
+ - **v0.1.6.2** - Fixed empty modules, added config/middleware/utils generators
13
+ - **v0.1.6.1** - Added @fastify/jwt compatibility fix
14
+ - **v0.1.6** - Fixed module copying from package
15
+
16
+ ---
17
+
18
+ ## Phase 1: Core CLI Improvements (v0.2.x)
19
+
20
+ ### v0.2.0 - CLI Enhancements
21
+
22
+ #### `servcraft list` ✅ Completed in v0.1.8
23
+ List available and installed modules.
24
+ ```bash
25
+ servcraft list # List all available modules
26
+ servcraft list --installed # List installed modules only
27
+ servcraft list --category Security # Filter by category
28
+ servcraft list --json # Output as JSON
29
+ ```
30
+
31
+ #### `--dry-run` Option ✅ Completed in v0.1.9
32
+ Preview changes without writing files.
33
+ ```bash
34
+ servcraft init my-app --dry-run # ✅ Implemented
35
+ servcraft add auth --dry-run # ✅ Implemented
36
+ servcraft generate module users --dry-run # ✅ Implemented
37
+ servcraft generate controller users --dry-run # ✅ Implemented
38
+ servcraft generate service users --dry-run # ✅ Implemented
39
+ ```
40
+
41
+ #### Better Error Messages
42
+ - Descriptive error messages with suggestions
43
+ - Colored output for warnings/errors
44
+ - Links to documentation
45
+
46
+ **Estimated complexity:** Low
47
+
48
+ ---
49
+
50
+ ### v0.2.1 - Module Management
51
+
52
+ #### `servcraft remove <module>`
53
+ Remove an installed module.
54
+ ```bash
55
+ servcraft remove auth
56
+ servcraft remove auth --keep-migrations # Keep database migrations
57
+ ```
58
+
59
+ Features:
60
+ - Remove module files from `src/modules/`
61
+ - Clean up related environment variables
62
+ - Optionally remove database migrations
63
+ - Update imports in main files
64
+
65
+ #### `servcraft update [module]`
66
+ Update modules to latest version.
67
+ ```bash
68
+ servcraft update # Update all modules
69
+ servcraft update auth # Update specific module
70
+ servcraft update --check # Check for updates without applying
71
+ ```
72
+
73
+ **Estimated complexity:** Medium
74
+
75
+ ---
76
+
77
+ ### v0.2.2 - Developer Experience
78
+
79
+ #### `servcraft doctor`
80
+ Diagnose project configuration issues.
81
+ ```bash
82
+ servcraft doctor
83
+ ```
84
+
85
+ Checks:
86
+ - Node.js version compatibility
87
+ - Missing dependencies
88
+ - Environment variables validation
89
+ - Database connection
90
+ - TypeScript configuration
91
+ - Prisma schema sync status
92
+
93
+ #### Shell Auto-completion
94
+ ```bash
95
+ servcraft completion bash >> ~/.bashrc
96
+ servcraft completion zsh >> ~/.zshrc
97
+ ```
98
+
99
+ **Estimated complexity:** Medium
100
+
101
+ ---
102
+
103
+ ## Phase 2: Testing & Quality (v0.3.x)
104
+
105
+ ### v0.3.0 - CLI Tests
106
+
107
+ #### Unit Tests for CLI Commands
108
+ - Test `init` command with various options
109
+ - Test `add` command for all 20 modules
110
+ - Test `generate` command (module, controller, service, etc.)
111
+ - Test `db` commands
112
+ - Test `docs` commands
113
+
114
+ #### Integration Tests
115
+ - Full project generation and startup
116
+ - Module installation and removal
117
+ - Database operations
118
+
119
+ #### CI/CD Pipeline
120
+ - GitHub Actions for automated testing
121
+ - Test on Node.js 18, 20, 22
122
+ - Code coverage reporting
123
+
124
+ **Estimated complexity:** High
125
+
126
+ ---
127
+
128
+ ### v0.3.1 - Generated Project Tests
129
+
130
+ #### Test Templates
131
+ Generate test files alongside modules:
132
+ ```bash
133
+ servcraft generate module users --with-tests
134
+ servcraft add auth # Includes test files
135
+ ```
136
+
137
+ Generated test structure:
138
+ ```
139
+ src/modules/users/
140
+ ├── users.controller.ts
141
+ ├── users.service.ts
142
+ ├── users.repository.ts
143
+ ├── __tests__/
144
+ │ ├── users.controller.test.ts
145
+ │ ├── users.service.test.ts
146
+ │ └── users.integration.test.ts
147
+ ```
148
+
149
+ **Estimated complexity:** Medium
150
+
151
+ ---
152
+
153
+ ## Phase 3: Advanced Features (v0.4.x)
154
+
155
+ ### v0.4.0 - Scaffolding
156
+
157
+ #### `servcraft scaffold <resource>`
158
+ Generate complete CRUD with single command.
159
+ ```bash
160
+ servcraft scaffold product --fields "name:string price:number category:relation"
161
+ ```
162
+
163
+ Generates:
164
+ - Prisma model
165
+ - Controller with CRUD endpoints
166
+ - Service with business logic
167
+ - Repository with data access
168
+ - Routes with validation
169
+ - Types/DTOs
170
+ - Tests
171
+
172
+ **Estimated complexity:** High
173
+
174
+ ---
175
+
176
+ ### v0.4.1 - Custom Templates
177
+
178
+ #### Template System
179
+ Allow users to customize generated code.
180
+
181
+ ```bash
182
+ servcraft templates init # Create .servcraft/templates/
183
+ servcraft templates list # List available templates
184
+ servcraft generate module --template custom-module
185
+ ```
186
+
187
+ Template locations:
188
+ 1. Project `.servcraft/templates/`
189
+ 2. User `~/.servcraft/templates/`
190
+ 3. Built-in defaults
191
+
192
+ **Estimated complexity:** High
193
+
194
+ ---
195
+
196
+ ### v0.4.2 - Plugin System
197
+
198
+ #### Third-party Plugins
199
+ ```bash
200
+ servcraft plugin install servcraft-graphql
201
+ servcraft plugin list
202
+ servcraft plugin remove servcraft-graphql
203
+ ```
204
+
205
+ Plugin capabilities:
206
+ - Add new commands
207
+ - Add new module types
208
+ - Extend existing generators
209
+ - Add new templates
210
+
211
+ **Estimated complexity:** Very High
212
+
213
+ ---
214
+
215
+ ## Phase 4: Enterprise Features (v0.5.x)
216
+
217
+ ### v0.5.0 - Deployment
218
+
219
+ #### `servcraft deploy`
220
+ Deploy to cloud platforms.
221
+ ```bash
222
+ servcraft deploy vercel
223
+ servcraft deploy railway
224
+ servcraft deploy fly
225
+ servcraft deploy docker
226
+ ```
227
+
228
+ Features:
229
+ - Auto-detect platform
230
+ - Generate platform-specific configs
231
+ - Environment variable management
232
+ - Database provisioning guides
233
+
234
+ **Estimated complexity:** High
235
+
236
+ ---
237
+
238
+ ### v0.5.1 - Monorepo Support
239
+
240
+ #### Workspace Support
241
+ ```bash
242
+ servcraft init my-monorepo --monorepo
243
+ servcraft workspace add api
244
+ servcraft workspace add admin
245
+ ```
246
+
247
+ Structure:
248
+ ```
249
+ my-monorepo/
250
+ ├── packages/
251
+ │ ├── api/
252
+ │ ├── admin/
253
+ │ └── shared/
254
+ ├── package.json
255
+ └── pnpm-workspace.yaml
256
+ ```
257
+
258
+ **Estimated complexity:** Very High
259
+
260
+ ---
261
+
262
+ ### v0.5.2 - Eject
263
+
264
+ #### `servcraft eject`
265
+ Expose all internal configurations.
266
+ ```bash
267
+ servcraft eject # Eject everything
268
+ servcraft eject --config-only # Only configuration files
269
+ ```
270
+
271
+ Ejects:
272
+ - Build configuration
273
+ - ESLint/Prettier configs
274
+ - Docker configurations
275
+ - CI/CD templates
276
+
277
+ **Estimated complexity:** Medium
278
+
279
+ ---
280
+
281
+ ## Phase 5: Ecosystem (v1.0.x)
282
+
283
+ ### v1.0.0 - Stable Release
284
+
285
+ #### Requirements for v1.0:
286
+ - [ ] All Phase 1-3 features complete
287
+ - [ ] 90%+ test coverage
288
+ - [ ] Comprehensive documentation
289
+ - [ ] Migration guide from v0.x
290
+ - [ ] Performance benchmarks
291
+ - [ ] Security audit
292
+
293
+ ---
294
+
295
+ ### Future Considerations
296
+
297
+ #### GUI Dashboard
298
+ Web-based project management interface.
299
+ - Visual module management
300
+ - Database schema designer
301
+ - API documentation browser
302
+ - Log viewer
303
+
304
+ #### Fastify 5 Migration
305
+ - Update all dependencies
306
+ - Test compatibility
307
+ - Provide migration guide
308
+
309
+ #### GraphQL Support
310
+ - `servcraft add graphql`
311
+ - Schema generation
312
+ - Resolver templates
313
+
314
+ #### Microservices
315
+ - Service mesh templates
316
+ - Message queue integration
317
+ - Service discovery
318
+
319
+ ---
320
+
321
+ ## Contributing
322
+
323
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for how to contribute to this roadmap.
324
+
325
+ ## Feedback
326
+
327
+ Have suggestions? Open an issue on [GitHub](https://github.com/Le-Sourcier/servcraft/issues).