blockend-cli 2.0.1 → 2.0.2

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.
@@ -1,704 +1,704 @@
1
- # Blockend CLI
2
-
3
- > **shadcn/ui for your backend.**
4
-
5
- Generate production-ready TypeScript backend blocks — rate limiting, validation, logging, error handling, configuration, health checks, and more — directly into your project from the terminal.
6
-
7
- **You own the code.**
8
-
9
- Blockend detects your framework, then copies audited, fully typed infrastructure source files directly into your repository. No runtime wrapper. No black box in `node_modules`. No lock-in.
10
-
11
- ---
12
-
13
- ## Quick Start
14
-
15
- In any TypeScript backend project:
16
-
17
- ```bash
18
- npx blockend-cli init
19
- npx blockend-cli add rate-limiter
20
- ```
21
-
22
- `init` detects your framework and creates a `blockend.json` configuration.
23
-
24
- `add` copies the selected block into your project.
25
-
26
- For example:
27
-
28
- ```text
29
- src/
30
- └── blocks/
31
- └── rate-limiter/
32
- ├── core.ts
33
- ├── express.ts
34
- └── ...
35
- ```
36
-
37
- Open the files. Read them. Edit them. Commit them.
38
-
39
- They're yours.
40
-
41
- Blockend does not run inside your application and does not lock your project into a runtime dependency.
42
-
43
- ---
44
-
45
- ## Why Blockend?
46
-
47
- Backend infrastructure is repetitive, but it still needs to be reliable, typed, and easy to customize.
48
-
49
- Blockend gives you production-ready infrastructure as source code:
50
-
51
- - Rate limiting
52
- - Request validation
53
- - Error handling
54
- - Structured logging
55
- - API response formatting
56
- - Environment configuration
57
- - Health checks
58
- - Password hashing
59
-
60
- Instead of installing another backend framework or runtime abstraction, Blockend generates the implementation directly into your repository.
61
-
62
- ---
63
-
64
- ## Installation
65
-
66
- You don't need to install Blockend globally.
67
-
68
- Run it directly with your package manager:
69
-
70
- ```bash
71
- npx blockend-cli init
72
- ```
73
-
74
- Or:
75
-
76
- ```bash
77
- pnpm dlx blockend-cli init
78
- ```
79
-
80
- ```bash
81
- yarn dlx blockend-cli init
82
- ```
83
-
84
- ```bash
85
- bunx blockend-cli init
86
- ```
87
-
88
- ---
89
-
90
- # Commands
91
-
92
- ## `init`
93
-
94
- Detect your framework and initialize Blockend.
95
-
96
- ```bash
97
- npx blockend-cli init
98
- ```
99
-
100
- This creates:
101
-
102
- ```text
103
- blockend.json
104
- ```
105
-
106
- Blockend uses your project structure and detected framework to determine how blocks should be generated.
107
-
108
- ### Skip prompts
109
-
110
- ```bash
111
- npx blockend-cli init --yes
112
- ```
113
-
114
- or:
115
-
116
- ```bash
117
- npx blockend-cli init -y
118
- ```
119
-
120
- ### JSON output
121
-
122
- ```bash
123
- npx blockend-cli init --json
124
- ```
125
-
126
- ---
127
-
128
- ## `add`
129
-
130
- Generate a specific backend block into your project.
131
-
132
- ```bash
133
- npx blockend-cli add rate-limiter
134
- ```
135
-
136
- Other examples:
137
-
138
- ```bash
139
- npx blockend-cli add request-validator
140
- ```
141
-
142
- ```bash
143
- npx blockend-cli add error-handler
144
- ```
145
-
146
- ```bash
147
- npx blockend-cli add logger
148
- ```
149
-
150
- ### Interactive mode
151
-
152
- Run `add` without specifying a block:
153
-
154
- ```bash
155
- npx blockend-cli add
156
- ```
157
-
158
- Blockend will display compatible blocks and let you choose one interactively.
159
-
160
- ### Add multiple blocks
161
-
162
- ```bash
163
- npx blockend-cli add --multi
164
- ```
165
-
166
- or:
167
-
168
- ```bash
169
- npx blockend-cli add -m
170
- ```
171
-
172
- ### Skip confirmation
173
-
174
- ```bash
175
- npx blockend-cli add rate-limiter --yes
176
- ```
177
-
178
- or:
179
-
180
- ```bash
181
- npx blockend-cli add rate-limiter -y
182
- ```
183
-
184
- ### JSON output
185
-
186
- ```bash
187
- npx blockend-cli add rate-limiter --json
188
- ```
189
-
190
- This is useful for automation and CI environments.
191
-
192
- ---
193
-
194
- ## `list`
195
-
196
- List all available backend blocks.
197
-
198
- ```bash
199
- npx blockend-cli list
200
- ```
201
-
202
- Example:
203
-
204
- ```text
205
- Available Blocks
206
-
207
- rate-limiter
208
- request-validator
209
- error-handler
210
- logger
211
- response-formatter
212
- env-config
213
- health-check
214
- password-hash
215
- ```
216
-
217
- ### JSON output
218
-
219
- ```bash
220
- npx blockend-cli list --json
221
- ```
222
-
223
- ---
224
-
225
- ## `detect`
226
-
227
- Detect information about your current project.
228
-
229
- ```bash
230
- npx blockend-cli detect
231
- ```
232
-
233
- Blockend can inspect:
234
-
235
- - Framework
236
- - Package manager
237
- - TypeScript configuration
238
- - Project structure
239
- - Workspace configuration
240
- - Runtime environment
241
- - Relevant project directories
242
-
243
- ### JSON output
244
-
245
- ```bash
246
- npx blockend-cli detect --json
247
- ```
248
-
249
- ---
250
-
251
- ## `diff`
252
-
253
- Preview the files that a block would generate without modifying your project.
254
-
255
- ```bash
256
- npx blockend-cli diff rate-limiter
257
- ```
258
-
259
- This lets you inspect changes before adding a block.
260
-
261
- ### JSON output
262
-
263
- ```bash
264
- npx blockend-cli diff rate-limiter --json
265
- ```
266
-
267
- ---
268
-
269
- ## `doctor`
270
-
271
- Diagnose Blockend configuration and project issues.
272
-
273
- ```bash
274
- npx blockend-cli doctor
275
- ```
276
-
277
- Blockend checks your project for problems such as:
278
-
279
- - Missing `blockend.json`
280
- - Unsupported or undetected frameworks
281
- - Invalid configuration
282
- - Missing dependencies
283
- - Invalid generated block layouts
284
- - Project integration issues
285
-
286
- ### JSON output
287
-
288
- ```bash
289
- npx blockend-cli doctor --json
290
- ```
291
-
292
- ---
293
-
294
- ## `update`
295
-
296
- Check installed blocks for newer versions.
297
-
298
- ```bash
299
- npx blockend-cli update
300
- ```
301
-
302
- Blockend compares your installed blocks with newer available versions and shows their differences.
303
-
304
- ### Apply updates
305
-
306
- ```bash
307
- npx blockend-cli update --apply
308
- ```
309
-
310
- Blockend will let you select which blocks to update.
311
-
312
- ### JSON output
313
-
314
- ```bash
315
- npx blockend-cli update --json
316
- ```
317
-
318
- ### Disable diff output
319
-
320
- ```bash
321
- npx blockend-cli update --no-diff
322
- ```
323
-
324
- ---
325
-
326
- # MCP Integration
327
-
328
- Blockend ships with an MCP server so AI assistants can use vetted, framework-native backend blocks instead of generating infrastructure from scratch.
329
-
330
- Supported clients include:
331
-
332
- - Claude
333
- - Cursor
334
- - Codex
335
- - VS Code
336
- - Windsurf
337
-
338
- ## Configure MCP
339
-
340
- Run:
341
-
342
- ```bash
343
- npx blockend-cli mcp init
344
- ```
345
-
346
- Or target a specific client:
347
-
348
- ```bash
349
- npx blockend-cli mcp init --client claude
350
- ```
351
-
352
- Supported client profiles:
353
-
354
- ```text
355
- claude
356
- codex
357
- cursor
358
- vscode
359
- windsurf
360
- ```
361
-
362
- ### Preview configuration
363
-
364
- ```bash
365
- npx blockend-cli mcp init --dry-run
366
- ```
367
-
368
- ### Force configuration
369
-
370
- ```bash
371
- npx blockend-cli mcp init --force
372
- ```
373
-
374
- ### Skip confirmation
375
-
376
- ```bash
377
- npx blockend-cli mcp init --yes
378
- ```
379
-
380
- ### Start the MCP server
381
-
382
- ```bash
383
- npx blockend-cli mcp
384
- ```
385
-
386
- Running `mcp` without a subcommand starts the Blockend MCP server.
387
-
388
- ---
389
-
390
- # Available Blocks
391
-
392
- | Block | What it solves |
393
- | -------------------- | ---------------------------------------------------------- |
394
- | `rate-limiter` | Token bucket rate limiting with pluggable storage adapters |
395
- | `request-validator` | Zod-based input validation with framework adapters |
396
- | `error-handler` | Centralized error pipeline with typed errors |
397
- | `logger` | Structured request logging with async context propagation |
398
- | `response-formatter` | Standard API response shapes for success/error payloads |
399
- | `env-config` | Type-safe environment validation with Zod schemas |
400
- | `health-check` | Liveness/readiness probes for app and dependency health |
401
- | `password-hash` | Argon2id password hashing with PHC-string output |
402
-
403
- ---
404
-
405
- # Supported Frameworks
406
-
407
- Blockend currently supports:
408
-
409
- - **Next.js**
410
- - **Express**
411
- - **Fastify**
412
- - **Hono**
413
-
414
- Each block ships with typed, framework-native adapters where appropriate.
415
-
416
- More frameworks are coming soon.
417
-
418
- ---
419
-
420
- # Example: Rate Limiter
421
-
422
- Initialize Blockend:
423
-
424
- ```bash
425
- npx blockend-cli init
426
- ```
427
-
428
- Add the rate limiter:
429
-
430
- ```bash
431
- npx blockend-cli add rate-limiter
432
- ```
433
-
434
- You may get a structure similar to:
435
-
436
- ```text
437
- src/
438
- └── blocks/
439
- └── rate-limiter/
440
- ├── core.ts
441
- ├── express.ts
442
- ├── fastify.ts
443
- └── ...
444
- ```
445
-
446
- The core implementation contains the framework-agnostic rate-limiting logic, while framework adapters integrate it with your application.
447
-
448
- For example:
449
-
450
- ```ts
451
- import { rateLimiter } from "./blocks/rate-limiter/express.js";
452
- ```
453
-
454
- The implementation lives inside your repository.
455
-
456
- You can modify it however you need.
457
-
458
- ---
459
-
460
- # Source Ownership
461
-
462
- Blockend follows a simple principle:
463
-
464
- > **Generate it. Own it.**
465
-
466
- Blockend does not hide your infrastructure behind a runtime package.
467
-
468
- Instead of:
469
-
470
- ```ts
471
- import { rateLimiter } from "blockend";
472
- ```
473
-
474
- your application gets source code:
475
-
476
- ```ts
477
- import { rateLimiter } from "./blocks/rate-limiter/express.js";
478
- ```
479
-
480
- You can:
481
-
482
- - Read the implementation
483
- - Change the implementation
484
- - Add your own features
485
- - Remove code you don't need
486
- - Commit it to Git
487
- - Review it in pull requests
488
- - Customize it for your architecture
489
-
490
- ---
491
-
492
- # Automatic Dependencies
493
-
494
- Blockend detects your package manager automatically.
495
-
496
- Supported package managers include:
497
-
498
- - npm
499
- - pnpm
500
- - yarn
501
- - bun
502
-
503
- When a block requires dependencies, Blockend installs the required packages using the detected package manager.
504
-
505
- For example, a block using Zod can automatically install its required dependency.
506
-
507
- You don't need to manually figure out which packages are required.
508
-
509
- ---
510
-
511
- # TypeScript First
512
-
513
- Blockend is designed for TypeScript backend projects.
514
-
515
- Generated blocks are:
516
-
517
- - Fully typed
518
- - Framework-aware
519
- - Production-oriented
520
- - Designed for direct source ownership
521
- - Compatible with strict TypeScript configurations
522
-
523
- ---
524
-
525
- # Configuration
526
-
527
- After running:
528
-
529
- ```bash
530
- npx blockend-cli init
531
- ```
532
-
533
- Blockend creates a project configuration file:
534
-
535
- ```text
536
- blockend.json
537
- ```
538
-
539
- A configuration may look like:
540
-
541
- ```json
542
- {
543
- "framework": "express",
544
- "language": "typescript",
545
- "blocksDir": "src/blocks"
546
- }
547
- ```
548
-
549
- The exact configuration is determined from your project during initialization.
550
-
551
- ---
552
-
553
- # CLI Overview
554
-
555
- ```text
556
- blockend
557
- │
558
- ├── init
559
- │ ├── --yes
560
- │ └── --json
561
- │
562
- ├── add [block]
563
- │ ├── --yes
564
- │ ├── --json
565
- │ └── --multi
566
- │
567
- ├── list
568
- │ └── --json
569
- │
570
- ├── detect
571
- │ └── --json
572
- │
573
- ├── diff <block>
574
- │ └── --json
575
- │
576
- ├── doctor
577
- │ └── --json
578
- │
579
- ├── update
580
- │ ├── --json
581
- │ ├── --diff
582
- │ └── --apply
583
- │
584
- └── mcp
585
- └── init
586
- ├── --client
587
- ├── --force
588
- ├── --dry-run
589
- └── --yes
590
- ```
591
-
592
- ---
593
-
594
- # Typical Workflow
595
-
596
- ### 1. Initialize
597
-
598
- ```bash
599
- npx blockend-cli init
600
- ```
601
-
602
- ### 2. Check your project
603
-
604
- ```bash
605
- npx blockend-cli detect
606
- ```
607
-
608
- ### 3. Browse available blocks
609
-
610
- ```bash
611
- npx blockend-cli list
612
- ```
613
-
614
- ### 4. Preview a block
615
-
616
- ```bash
617
- npx blockend-cli diff rate-limiter
618
- ```
619
-
620
- ### 5. Add the block
621
-
622
- ```bash
623
- npx blockend-cli add rate-limiter
624
- ```
625
-
626
- ### 6. Check your project
627
-
628
- ```bash
629
- npx blockend-cli doctor
630
- ```
631
-
632
- ### 7. Keep blocks updated
633
-
634
- ```bash
635
- npx blockend-cli update
636
- ```
637
-
638
- ### 8. Connect your AI assistant
639
-
640
- ```bash
641
- npx blockend-cli mcp init
642
- ```
643
-
644
- ---
645
-
646
- # Roadmap
647
-
648
- The following blocks and capabilities are planned:
649
-
650
- - JWT authentication
651
- - CORS
652
- - Security headers
653
- - Idempotency
654
- - Webhooks
655
- - Additional framework adapters
656
- - More storage adapters
657
- - More AI/MCP integrations
658
-
659
- ---
660
-
661
- # Documentation
662
-
663
- Full documentation:
664
-
665
- [https://blockend.noorulhassan.com/docs](https://blockend.noorulhassan.com/docs)
666
-
667
- ---
668
-
669
- # Repository
670
-
671
- Source code, issues, block implementations, and contribution guides:
672
-
673
- [https://github.com/codewithnuh/blockend](https://github.com/codewithnuh/blockend)
674
-
675
- If Blockend saves you from rewriting backend boilerplate, consider giving the project a star.
676
-
677
- ---
678
-
679
- # Contributing
680
-
681
- Contributions are welcome.
682
-
683
- You can contribute by:
684
-
685
- - Adding new backend blocks
686
- - Improving existing blocks
687
- - Adding framework adapters
688
- - Improving documentation
689
- - Reporting bugs
690
- - Suggesting new infrastructure primitives
691
- - Improving the CLI
692
- - Improving MCP integrations
693
-
694
- See the repository for contribution guidelines.
695
-
696
- ---
697
-
698
- # License
699
-
700
- MIT © CodeWithNuh
701
-
702
- See the full license:
703
-
704
- [https://github.com/codewithnuh/blockend/blob/master/LICENSE](https://github.com/codewithnuh/blockend/blob/master/LICENSE)
1
+ # Blockend CLI
2
+
3
+ > **shadcn/ui for your backend.**
4
+
5
+ Generate production-ready TypeScript backend blocks — rate limiting, validation, logging, error handling, configuration, health checks, and more — directly into your project from the terminal.
6
+
7
+ **You own the code.**
8
+
9
+ Blockend detects your framework, then copies audited, fully typed infrastructure source files directly into your repository. No runtime wrapper. No black box in `node_modules`. No lock-in.
10
+
11
+ ---
12
+
13
+ ## Quick Start
14
+
15
+ In any TypeScript backend project:
16
+
17
+ ```bash
18
+ npx blockend-cli init
19
+ npx blockend-cli add rate-limiter
20
+ ```
21
+
22
+ `init` detects your framework and creates a `blockend.json` configuration.
23
+
24
+ `add` copies the selected block into your project.
25
+
26
+ For example:
27
+
28
+ ```text
29
+ src/
30
+ └── blocks/
31
+ └── rate-limiter/
32
+ ├── core.ts
33
+ ├── express.ts
34
+ └── ...
35
+ ```
36
+
37
+ Open the files. Read them. Edit them. Commit them.
38
+
39
+ They're yours.
40
+
41
+ Blockend does not run inside your application and does not lock your project into a runtime dependency.
42
+
43
+ ---
44
+
45
+ ## Why Blockend?
46
+
47
+ Backend infrastructure is repetitive, but it still needs to be reliable, typed, and easy to customize.
48
+
49
+ Blockend gives you production-ready infrastructure as source code:
50
+
51
+ - Rate limiting
52
+ - Request validation
53
+ - Error handling
54
+ - Structured logging
55
+ - API response formatting
56
+ - Environment configuration
57
+ - Health checks
58
+ - Password hashing
59
+
60
+ Instead of installing another backend framework or runtime abstraction, Blockend generates the implementation directly into your repository.
61
+
62
+ ---
63
+
64
+ ## Installation
65
+
66
+ You don't need to install Blockend globally.
67
+
68
+ Run it directly with your package manager:
69
+
70
+ ```bash
71
+ npx blockend-cli init
72
+ ```
73
+
74
+ Or:
75
+
76
+ ```bash
77
+ pnpm dlx blockend-cli init
78
+ ```
79
+
80
+ ```bash
81
+ yarn dlx blockend-cli init
82
+ ```
83
+
84
+ ```bash
85
+ bunx blockend-cli init
86
+ ```
87
+
88
+ ---
89
+
90
+ # Commands
91
+
92
+ ## `init`
93
+
94
+ Detect your framework and initialize Blockend.
95
+
96
+ ```bash
97
+ npx blockend-cli init
98
+ ```
99
+
100
+ This creates:
101
+
102
+ ```text
103
+ blockend.json
104
+ ```
105
+
106
+ Blockend uses your project structure and detected framework to determine how blocks should be generated.
107
+
108
+ ### Skip prompts
109
+
110
+ ```bash
111
+ npx blockend-cli init --yes
112
+ ```
113
+
114
+ or:
115
+
116
+ ```bash
117
+ npx blockend-cli init -y
118
+ ```
119
+
120
+ ### JSON output
121
+
122
+ ```bash
123
+ npx blockend-cli init --json
124
+ ```
125
+
126
+ ---
127
+
128
+ ## `add`
129
+
130
+ Generate a specific backend block into your project.
131
+
132
+ ```bash
133
+ npx blockend-cli add rate-limiter
134
+ ```
135
+
136
+ Other examples:
137
+
138
+ ```bash
139
+ npx blockend-cli add request-validator
140
+ ```
141
+
142
+ ```bash
143
+ npx blockend-cli add error-handler
144
+ ```
145
+
146
+ ```bash
147
+ npx blockend-cli add logger
148
+ ```
149
+
150
+ ### Interactive mode
151
+
152
+ Run `add` without specifying a block:
153
+
154
+ ```bash
155
+ npx blockend-cli add
156
+ ```
157
+
158
+ Blockend will display compatible blocks and let you choose one interactively.
159
+
160
+ ### Add multiple blocks
161
+
162
+ ```bash
163
+ npx blockend-cli add --multi
164
+ ```
165
+
166
+ or:
167
+
168
+ ```bash
169
+ npx blockend-cli add -m
170
+ ```
171
+
172
+ ### Skip confirmation
173
+
174
+ ```bash
175
+ npx blockend-cli add rate-limiter --yes
176
+ ```
177
+
178
+ or:
179
+
180
+ ```bash
181
+ npx blockend-cli add rate-limiter -y
182
+ ```
183
+
184
+ ### JSON output
185
+
186
+ ```bash
187
+ npx blockend-cli add rate-limiter --json
188
+ ```
189
+
190
+ This is useful for automation and CI environments.
191
+
192
+ ---
193
+
194
+ ## `list`
195
+
196
+ List all available backend blocks.
197
+
198
+ ```bash
199
+ npx blockend-cli list
200
+ ```
201
+
202
+ Example:
203
+
204
+ ```text
205
+ Available Blocks
206
+
207
+ rate-limiter
208
+ request-validator
209
+ error-handler
210
+ logger
211
+ response-formatter
212
+ env-config
213
+ health-check
214
+ password-hash
215
+ ```
216
+
217
+ ### JSON output
218
+
219
+ ```bash
220
+ npx blockend-cli list --json
221
+ ```
222
+
223
+ ---
224
+
225
+ ## `detect`
226
+
227
+ Detect information about your current project.
228
+
229
+ ```bash
230
+ npx blockend-cli detect
231
+ ```
232
+
233
+ Blockend can inspect:
234
+
235
+ - Framework
236
+ - Package manager
237
+ - TypeScript configuration
238
+ - Project structure
239
+ - Workspace configuration
240
+ - Runtime environment
241
+ - Relevant project directories
242
+
243
+ ### JSON output
244
+
245
+ ```bash
246
+ npx blockend-cli detect --json
247
+ ```
248
+
249
+ ---
250
+
251
+ ## `diff`
252
+
253
+ Preview the files that a block would generate without modifying your project.
254
+
255
+ ```bash
256
+ npx blockend-cli diff rate-limiter
257
+ ```
258
+
259
+ This lets you inspect changes before adding a block.
260
+
261
+ ### JSON output
262
+
263
+ ```bash
264
+ npx blockend-cli diff rate-limiter --json
265
+ ```
266
+
267
+ ---
268
+
269
+ ## `doctor`
270
+
271
+ Diagnose Blockend configuration and project issues.
272
+
273
+ ```bash
274
+ npx blockend-cli doctor
275
+ ```
276
+
277
+ Blockend checks your project for problems such as:
278
+
279
+ - Missing `blockend.json`
280
+ - Unsupported or undetected frameworks
281
+ - Invalid configuration
282
+ - Missing dependencies
283
+ - Invalid generated block layouts
284
+ - Project integration issues
285
+
286
+ ### JSON output
287
+
288
+ ```bash
289
+ npx blockend-cli doctor --json
290
+ ```
291
+
292
+ ---
293
+
294
+ ## `update`
295
+
296
+ Check installed blocks for newer versions.
297
+
298
+ ```bash
299
+ npx blockend-cli update
300
+ ```
301
+
302
+ Blockend compares your installed blocks with newer available versions and shows their differences.
303
+
304
+ ### Apply updates
305
+
306
+ ```bash
307
+ npx blockend-cli update --apply
308
+ ```
309
+
310
+ Blockend will let you select which blocks to update.
311
+
312
+ ### JSON output
313
+
314
+ ```bash
315
+ npx blockend-cli update --json
316
+ ```
317
+
318
+ ### Disable diff output
319
+
320
+ ```bash
321
+ npx blockend-cli update --no-diff
322
+ ```
323
+
324
+ ---
325
+
326
+ # MCP Integration
327
+
328
+ Blockend ships with an MCP server so AI assistants can use vetted, framework-native backend blocks instead of generating infrastructure from scratch.
329
+
330
+ Supported clients include:
331
+
332
+ - Claude
333
+ - Cursor
334
+ - Codex
335
+ - VS Code
336
+ - Windsurf
337
+
338
+ ## Configure MCP
339
+
340
+ Run:
341
+
342
+ ```bash
343
+ npx blockend-cli mcp init
344
+ ```
345
+
346
+ Or target a specific client:
347
+
348
+ ```bash
349
+ npx blockend-cli mcp init --client claude
350
+ ```
351
+
352
+ Supported client profiles:
353
+
354
+ ```text
355
+ claude
356
+ codex
357
+ cursor
358
+ vscode
359
+ windsurf
360
+ ```
361
+
362
+ ### Preview configuration
363
+
364
+ ```bash
365
+ npx blockend-cli mcp init --dry-run
366
+ ```
367
+
368
+ ### Force configuration
369
+
370
+ ```bash
371
+ npx blockend-cli mcp init --force
372
+ ```
373
+
374
+ ### Skip confirmation
375
+
376
+ ```bash
377
+ npx blockend-cli mcp init --yes
378
+ ```
379
+
380
+ ### Start the MCP server
381
+
382
+ ```bash
383
+ npx blockend-cli mcp
384
+ ```
385
+
386
+ Running `mcp` without a subcommand starts the Blockend MCP server.
387
+
388
+ ---
389
+
390
+ # Available Blocks
391
+
392
+ | Block | What it solves |
393
+ | -------------------- | ---------------------------------------------------------- |
394
+ | `rate-limiter` | Token bucket rate limiting with pluggable storage adapters |
395
+ | `request-validator` | Zod-based input validation with framework adapters |
396
+ | `error-handler` | Centralized error pipeline with typed errors |
397
+ | `logger` | Structured request logging with async context propagation |
398
+ | `response-formatter` | Standard API response shapes for success/error payloads |
399
+ | `env-config` | Type-safe environment validation with Zod schemas |
400
+ | `health-check` | Liveness/readiness probes for app and dependency health |
401
+ | `password-hash` | Argon2id password hashing with PHC-string output |
402
+
403
+ ---
404
+
405
+ # Supported Frameworks
406
+
407
+ Blockend currently supports:
408
+
409
+ - **Next.js**
410
+ - **Express**
411
+ - **Fastify**
412
+ - **Hono**
413
+
414
+ Each block ships with typed, framework-native adapters where appropriate.
415
+
416
+ More frameworks are coming soon.
417
+
418
+ ---
419
+
420
+ # Example: Rate Limiter
421
+
422
+ Initialize Blockend:
423
+
424
+ ```bash
425
+ npx blockend-cli init
426
+ ```
427
+
428
+ Add the rate limiter:
429
+
430
+ ```bash
431
+ npx blockend-cli add rate-limiter
432
+ ```
433
+
434
+ You may get a structure similar to:
435
+
436
+ ```text
437
+ src/
438
+ └── blocks/
439
+ └── rate-limiter/
440
+ ├── core.ts
441
+ ├── express.ts
442
+ ├── fastify.ts
443
+ └── ...
444
+ ```
445
+
446
+ The core implementation contains the framework-agnostic rate-limiting logic, while framework adapters integrate it with your application.
447
+
448
+ For example:
449
+
450
+ ```ts
451
+ import { rateLimiter } from "./blocks/rate-limiter/express.js";
452
+ ```
453
+
454
+ The implementation lives inside your repository.
455
+
456
+ You can modify it however you need.
457
+
458
+ ---
459
+
460
+ # Source Ownership
461
+
462
+ Blockend follows a simple principle:
463
+
464
+ > **Generate it. Own it.**
465
+
466
+ Blockend does not hide your infrastructure behind a runtime package.
467
+
468
+ Instead of:
469
+
470
+ ```ts
471
+ import { rateLimiter } from "blockend";
472
+ ```
473
+
474
+ your application gets source code:
475
+
476
+ ```ts
477
+ import { rateLimiter } from "./blocks/rate-limiter/express.js";
478
+ ```
479
+
480
+ You can:
481
+
482
+ - Read the implementation
483
+ - Change the implementation
484
+ - Add your own features
485
+ - Remove code you don't need
486
+ - Commit it to Git
487
+ - Review it in pull requests
488
+ - Customize it for your architecture
489
+
490
+ ---
491
+
492
+ # Automatic Dependencies
493
+
494
+ Blockend detects your package manager automatically.
495
+
496
+ Supported package managers include:
497
+
498
+ - npm
499
+ - pnpm
500
+ - yarn
501
+ - bun
502
+
503
+ When a block requires dependencies, Blockend installs the required packages using the detected package manager.
504
+
505
+ For example, a block using Zod can automatically install its required dependency.
506
+
507
+ You don't need to manually figure out which packages are required.
508
+
509
+ ---
510
+
511
+ # TypeScript First
512
+
513
+ Blockend is designed for TypeScript backend projects.
514
+
515
+ Generated blocks are:
516
+
517
+ - Fully typed
518
+ - Framework-aware
519
+ - Production-oriented
520
+ - Designed for direct source ownership
521
+ - Compatible with strict TypeScript configurations
522
+
523
+ ---
524
+
525
+ # Configuration
526
+
527
+ After running:
528
+
529
+ ```bash
530
+ npx blockend-cli init
531
+ ```
532
+
533
+ Blockend creates a project configuration file:
534
+
535
+ ```text
536
+ blockend.json
537
+ ```
538
+
539
+ A configuration may look like:
540
+
541
+ ```json
542
+ {
543
+ "framework": "express",
544
+ "language": "typescript",
545
+ "blocksDir": "src/blocks"
546
+ }
547
+ ```
548
+
549
+ The exact configuration is determined from your project during initialization.
550
+
551
+ ---
552
+
553
+ # CLI Overview
554
+
555
+ ```text
556
+ blockend
557
+ │
558
+ ├── init
559
+ │ ├── --yes
560
+ │ └── --json
561
+ │
562
+ ├── add [block]
563
+ │ ├── --yes
564
+ │ ├── --json
565
+ │ └── --multi
566
+ │
567
+ ├── list
568
+ │ └── --json
569
+ │
570
+ ├── detect
571
+ │ └── --json
572
+ │
573
+ ├── diff <block>
574
+ │ └── --json
575
+ │
576
+ ├── doctor
577
+ │ └── --json
578
+ │
579
+ ├── update
580
+ │ ├── --json
581
+ │ ├── --diff
582
+ │ └── --apply
583
+ │
584
+ └── mcp
585
+ └── init
586
+ ├── --client
587
+ ├── --force
588
+ ├── --dry-run
589
+ └── --yes
590
+ ```
591
+
592
+ ---
593
+
594
+ # Typical Workflow
595
+
596
+ ### 1. Initialize
597
+
598
+ ```bash
599
+ npx blockend-cli init
600
+ ```
601
+
602
+ ### 2. Check your project
603
+
604
+ ```bash
605
+ npx blockend-cli detect
606
+ ```
607
+
608
+ ### 3. Browse available blocks
609
+
610
+ ```bash
611
+ npx blockend-cli list
612
+ ```
613
+
614
+ ### 4. Preview a block
615
+
616
+ ```bash
617
+ npx blockend-cli diff rate-limiter
618
+ ```
619
+
620
+ ### 5. Add the block
621
+
622
+ ```bash
623
+ npx blockend-cli add rate-limiter
624
+ ```
625
+
626
+ ### 6. Check your project
627
+
628
+ ```bash
629
+ npx blockend-cli doctor
630
+ ```
631
+
632
+ ### 7. Keep blocks updated
633
+
634
+ ```bash
635
+ npx blockend-cli update
636
+ ```
637
+
638
+ ### 8. Connect your AI assistant
639
+
640
+ ```bash
641
+ npx blockend-cli mcp init
642
+ ```
643
+
644
+ ---
645
+
646
+ # Roadmap
647
+
648
+ The following blocks and capabilities are planned:
649
+
650
+ - JWT authentication
651
+ - CORS
652
+ - Security headers
653
+ - Idempotency
654
+ - Webhooks
655
+ - Additional framework adapters
656
+ - More storage adapters
657
+ - More AI/MCP integrations
658
+
659
+ ---
660
+
661
+ # Documentation
662
+
663
+ Full documentation:
664
+
665
+ [https://blockend.noorulhassan.com/docs](https://blockend.noorulhassan.com/docs)
666
+
667
+ ---
668
+
669
+ # Repository
670
+
671
+ Source code, issues, block implementations, and contribution guides:
672
+
673
+ [https://github.com/codewithnuh/blockend](https://github.com/codewithnuh/blockend)
674
+
675
+ If Blockend saves you from rewriting backend boilerplate, consider giving the project a star.
676
+
677
+ ---
678
+
679
+ # Contributing
680
+
681
+ Contributions are welcome.
682
+
683
+ You can contribute by:
684
+
685
+ - Adding new backend blocks
686
+ - Improving existing blocks
687
+ - Adding framework adapters
688
+ - Improving documentation
689
+ - Reporting bugs
690
+ - Suggesting new infrastructure primitives
691
+ - Improving the CLI
692
+ - Improving MCP integrations
693
+
694
+ See the repository for contribution guidelines.
695
+
696
+ ---
697
+
698
+ # License
699
+
700
+ MIT © CodeWithNuh
701
+
702
+ See the full license:
703
+
704
+ [https://github.com/codewithnuh/blockend/blob/master/LICENSE](https://github.com/codewithnuh/blockend/blob/master/LICENSE)