nodehexagen
v0.1.0
Published
Enterprise-Grade Hexagonal Architecture Scaffolding for Node.js
Downloads
123
Maintainers
Readme
NodeHexaGen: The Architectural Guardian for Node.js 🛡️🚀
"Don't build a Big Ball of Mud. Scaffold a Citadel."
🚀 Why NodeHexaGen?
Node.js projects often suffer from "Big Ball of Mud" syndrome as they scale, with frameworks bleeding into business logic. NodeHexaGen enforces Software Engineering Excellence from Day 1 by providing a professional-grade scaffolding that implements the Ports & Adapters (Hexagonal) pattern with high rigour.
As part of the HexaGen family (Elixir, Python, .NET), NodeHexaGen brings enterprise patterns to the JavaScript ecosystem.
Key Value Pillars:
- Framework Agnostic: Supports Fastify, Express, and Koa without coupling your domain.
- Enforced Boundaries: Pure Domain logic with zero external dependencies.
- Dynamic Scaffolding: Generate full vertical slices (Domain, Infra, API) in seconds.
- TypeScript First: Leverage strict typing for robust Port interfaces.
✨ Killer Features
1. Architectural Guardrails
- Interface Segregation: Enforces formal contracts (
IUserRepository) so your Adapters never miss a required method. - Pure Domain Models: Your business logic lives in vanilla TypeScript classes. No ORM decorators in the core. Pure, testable, and immortal.
2. Enterprise Out-of-the-Box
- Dockerization: Instantly scaffolds an optimized
Dockerfileanddocker-compose.yml(PostgreSQL ready). - Dependency Injection: Ships with
awilixpre-configured for elegant IoC containers. - Global Error Handling: Built-in
DomainExceptionto cleanly map business logic errors to HTTP status codes. - Quality Tooling: Strict
eslintandprettierconfigurations generated automatically.
3. Intelligent Scaffolding
Initialize a complete project with a single command:
npx nodehexagen init MyAwesomeProject(You will be prompted to choose Fastify, Express, or Koa for your application layer)
Generate a full enterprise-grade vertical slice resource:
cd MyAwesomeProject
npx nodehexagen gen:resource Product name:string price:number stock:numberNodeHexaGen automatically creates:
- ✅ Domain Entities with typed fields.
- ✅ Infrastructure Adapters (HTTP Controllers).
- ✅ Application Layer (UseCases/Interactors).
- ✅ Ports (Repository Interfaces).
📖 Quick Start
1. Initialize your Project
npx nodehexagen init ECommerceAPI2. Generate a Resource
cd ECommerceAPI
npx nodehexagen gen:resource Order totalAmount:number status:string3. Run Your Server
npm run dev🛡️ The Architectural Promise
NodeHexaGen doesn't just give you files; it gives you a System. It sets the boundaries that prevent code rot and ensures your application remains maintainable for years to come.
Built by Architects, for Architects.
📄 License
This project is licensed under the MIT License.
Developed by rbaezc. Licensed to Vortex Solutions.
