Production-grade backend engineering patterns, checklists & AI adapters
npm install production-backend-kit





A comprehensive knowledge base + CLI + adapters for AI-powered backend development
ā” 60s Quickstart ā¢
š§ CLI Reference ā¢
š Adapters ā¢
š Patterns ā¢
š¤ Contributing
---
``bash1. Install
npm install -g production-backend-kit
That's it! You now have production-grade patterns and checklists in your project.
---
š¦ Installation
$3
- Node.js 18 or higher
- npm, yarn, or pnpm
$3
#### Option 1: Install from npm (recommended)
`bash
npm install -g production-backend-kitVerify installation
bek --versionCheck environment
bek doctor
`#### Option 2: Install from GitHub Release
`bash
Download and install the latest release
npm install -g https://github.com/ThanhNguyxn/backend-engineering-kit/releases/latest/download/production-backend-kit.tgz
`#### Option 3: Install from source (for development)
`bash
git clone https://github.com/ThanhNguyxn/backend-engineering-kit.git
cd backend-engineering-kit/cli
npm install && npm run build
npm link
`Expected output from
bek doctor:
`
𩺠Environment Check ā Operating System: win32 10.0.22631 (x64)
ā Node.js: v20.10.0 (>= 18 required)
ā Package Manager: npm@10.2.3
ā Git: 2.43.0
ā Disk Access: Writable
ā Config File: Not found (using defaults)
ā Project: package.json found
ā Some checks have warnings. Consider addressing them.
`$3
`bash
Navigate to your project
cd your-projectInitialize with standard template
bek init --template standard -ySearch for patterns
bek search "error handling"Run quality gate
bek gate --checklist checklist-api-review
`---
š§ CLI Reference
$3
All commands support these global options:
| Option | Description |
|--------|-------------|
|
--debug | Show debug output and full stack traces |
| --silent | Suppress all output except errors |
| --verbose | Show detailed verbose output |
| --json | Output machine-readable JSON (where supported) |$3
####
bek doctorCheck your environment and dependencies.
`bash
bek doctor # Human-readable output
bek doctor --json # JSON output for CI/CD
`Exit codes:
-
0 - All checks passed
- 1 - Some warnings
- 2 - Critical errors---
####
bek initInitialize a new Backend Kit project.
`bash
Interactive mode
bek initNon-interactive with template
bek init --template standard -yUse a preset (copies real patterns/checklists from source)
bek init --preset node-express
bek init --preset node-fastify
bek init --preset node-minimalDry run (preview without creating files)
bek init --preset node-express --dry-runInitialize with specific AI adapter
bek init --ai claude --target ./my-project
`Options:
| Option | Description |
|--------|-------------|
|
-t, --template | Template: minimal, standard, advanced |
| -p, --preset | Preset: node-express, node-fastify, node-minimal |
| --target | Target directory (default: current) |
| --out | Alias for --target |
| --ai | AI adapters: claude,cursor,copilot,codex,all |
| --force | Overwrite existing files |
| --dry-run | Preview changes without creating files |
| -y, --yes | Skip prompts, use defaults |Templates vs Presets:
- Templates create sample files for you to customize
- Presets copy real patterns and checklists from the kit's knowledge base
Presets:
| Preset | Patterns | Checklists |
|--------|----------|------------|
|
node-express | error-model, validation, logging, correlation-id, rate-limiting | api-review, prod-readiness |
| node-fastify | error-model, validation, logging, timeouts, rate-limiting | api-review, reliability-review |
| node-minimal | error-model, logging | api-review |Output structure (preset):
`
.backend-kit/
āāā patterns/
ā āāā api.error-model.md
ā āāā api.request-validation.md
ā āāā ...
āāā checklists/
ā āāā checklist.api-review.md
ā āāā checklist.prod-readiness.md
āāā bek.config.json
`---
####
bek lintLint content files for issues.
`bash
bek lint # Human-readable output
bek lint --json # JSON output for CI/CD
`Example output:
`
š Linting content...ā¹ Checked 30 files
.shared/production-backend-kit/patterns/api.error-model.md
ā Missing recommended field: scope [frontmatter-recommended]
ā Missing recommended field: maturity [frontmatter-recommended]
Found 0 errors and 90 warnings
`---
####
bek search Search patterns and checklists.
`bash
Basic search
bek search "pagination"With filters
bek search "authentication" --scope security
bek search "database" --level intermediate
bek search "error" --limit 5
`Options:
| Option | Description |
|--------|-------------|
|
-t, --tag | Filter by tag |
| -s, --stack | Filter by stack (postgresql, nodejs, etc.) |
| -l, --level | Filter by level: beginner, intermediate, advanced |
| --scope | Filter by scope: api, database, security, reliability, observability |
| -n, --limit | Limit results (default: 10) |---
####
bek listList all available patterns and checklists.
`bash
bek list # List all
bek list --scope security # Filter by scope
bek list --tag api # Filter by tag
`---
####
bek show Show details of a specific pattern or checklist.
`bash
bek show api-error-model
bek show checklist-api-review --json
`---
####
bek gateRun quality gate checklist.
`bash
bek gate --checklist checklist-api-review
bek gate --checklist checklist-prod-readiness --json
`---
####
bek validateValidate content and rebuild database.
`bash
bek validate # Validate and rebuild
bek validate --fix # Auto-fix issues first
bek validate --json # JSON output
`---
####
bek build-dbBuild/rebuild the search database.
`bash
bek build-db
`---
####
bek syncUpdate BEK kit files in an existing project. Useful when the CLI is upgraded and you want the latest patterns/checklists.
`bash
Interactive sync with backup
bek syncPreview changes without applying
bek sync --dry-runForce sync without confirmation
bek sync --forceJSON output for CI/CD
bek sync --jsonSkip backup
bek sync --no-backup
`Options:
| Option | Description |
|--------|-------------|
|
--target | Target directory (default: current) |
| --dry-run | Preview changes without applying |
| --force | Apply changes without confirmation |
| --backup | Create backup before syncing (default: true) |
| --no-backup | Skip backup |
| --json | Output as JSON |Aliases:
bek update---
####
bek removeRemove BEK kit files from a project. Performs a clean uninstall based on the manifest.
`bash
Interactive removal
bek removePreview what would be removed
bek remove --dry-runSkip confirmation prompt
bek remove -yJSON output
bek remove --json
`Options:
| Option | Description |
|--------|-------------|
|
--target | Target directory (default: current) |
| -y, --yes | Skip confirmation prompt |
| --dry-run | Preview without removing |
| --json | Output as JSON |Aliases:
bek clean, bek uninstallWhat gets removed:
-
.backend-kit/ directory (patterns, checklists, manifest)
- Config files (bek.config.json, .bekrc, etc.)
- AI adapters listed in manifest---
š Adapters
| Adapter | Location | Description |
|---------|----------|-------------|
| š£ Claude |
adapters/claude/ | Full skill definition with YAML frontmatter |
| šµ Cursor | adapters/cursor/ | Rules and commands for Cursor IDE |
| ā« Copilot | adapters/copilot/ | Custom instructions for GitHub Copilot |
| š¢ Codex | adapters/codex/ | Skill guide for OpenAI Codex |$3
`bash
Claude
cp -r adapters/claude/* your-project/.claude/skills/Cursor
cp adapters/cursor/*.md your-project/.cursor/rules/Copilot
cp adapters/copilot/*.md your-project/.github/Codex
cp adapters/codex/*.md your-project/.codex/
`$3
`bash
Initialize all adapters
bek init --ai allInitialize specific adapter
bek init --ai claude --target ./my-project
`---
š Patterns & Checklists
$3
| Category | Patterns |
|----------|----------|
| API | Error Model, Pagination, Versioning, Webhooks, Idempotency |
| Database | Indexing, Migrations, Transactions, N+1 Avoid, Schema Constraints |
| Security | Auth Boundaries, Rate Limiting, Password Storage, Secrets Management |
| Reliability | Timeouts, Retries, Circuit Breaker, Outbox Pattern, DLQ |
| Observability | Correlation ID, Structured Logging, RED/USE Metrics |
$3
| ID | Description |
|----|-------------|
|
checklist-api-review | Comprehensive API review |
| checklist-db-review | Database schema and query review |
| checklist-security-review | Security controls audit |
| checklist-reliability-review | Resilience patterns check |
| checklist-prod-readiness | Pre-deployment checklist |
| checklist-multitenancy-review | Multi-tenant isolation audit |---
š Directory Structure
`
production-backend-kit/
āāā cli/ # CLI source (TypeScript)
ā āāā src/
ā ā āāā commands/ # doctor, init, lint
ā ā āāā lib/ # logger, errors, config
ā ā āāā __tests__/ # Unit & integration tests
ā āāā dist/ # Compiled JavaScript
ā āāā package.json
āāā adapters/ # AI tool adapters
ā āāā claude/
ā āāā cursor/
ā āāā copilot/
ā āāā codex/
āāā .shared/production-backend-kit/
ā āāā patterns/ # Pattern markdown files
ā āāā checklists/ # Checklist markdown files
ā āāā db/ # Generated search index
āāā docs/
ā āāā architecture.md # CLI architecture
ā āāā templates.md # Template system
āāā CONTRIBUTING.md
āāā CHANGELOG.md
āāā SECURITY.md
`---
š ļø Development
`bash
Clone repository
git clone https://github.com/ThanhNguyxn/backend-engineering-kit.git
cd backend-engineering-kitInstall dependencies
cd cli
npm installBuild
npm run buildRun tests
npm testDevelopment mode (watch)
npm run dev
``---
Contributions are welcome! See CONTRIBUTING.md for guidelines.
---
MIT License - see LICENSE for details.
---
Built with ā¤ļø by ThanhNguyxn


ā Star this repo if you find it helpful!