@archforge/core-engine
v1.2.0
Published
Core engine for ArchForge — template rendering, architecture rules, and project generation
Maintainers
Readme
🔨 @archforge/core-engine
Template Rendering, Rules Engine & Project Generation
The core engine behind ArchForge — handles template rendering, architecture rules validation, and project generation.
📦 Installation
npm install @archforge/core-engineLooking for the CLI? Use
@archforge/cliinstead:npx @archforge/cli init
🧩 What's Included
Template Engine
EJS-based template renderer that interpolates project configuration into file content and paths.
import { TemplateEngine } from '@archforge/core-engine';
const engine = new TemplateEngine();
const context = engine.buildContext(projectConfig);
const rendered = engine.render(templateContent, context);Template Registry
Maps (stack, architecture) combinations to template manifests — 42 built-in templates across 11 stacks and 10 architecture styles.
import { TemplateRegistry } from '@archforge/core-engine';
const registry = new TemplateRegistry();
const templates = registry.getAll(); // All 42 templates
const template = registry.get('react', 'clean'); // Specific templateRules Engine
Validates projects against 9 architecture rules that enforce real dependency constraints.
import { RulesEngine } from '@archforge/core-engine';
const engine = new RulesEngine();
const violations = await engine.validate('./my-project', 'clean');
// Returns: RuleViolation[] with file, rule, and descriptionProject Generator
Orchestrates end-to-end project generation: template rendering, file writing, and tooling add-ons.
import { ProjectGenerator } from '@archforge/core-engine';
const generator = new ProjectGenerator();
await generator.generate({
name: 'my-api',
stack: 'java',
architecture: 'clean',
database: 'postgresql',
auth: 'jwt',
tooling: ['docker', 'ci', 'tests'],
// ... more options
});📋 Supported Stacks & Architectures (42 templates)
Frontend
| Stack | Architectures | | ----------- | ---------------------------------------------------- | | React | Clean, Layered, Feature-based, Feature-Sliced Design | | Next.js | Clean, Feature-based | | Angular | Clean, Layered | | Vue.js | Feature-based |
Backend
| Stack | Architectures | | ----------- | -------------------------------------------------------------------------- | | Node.js | Clean, Layered, MVC, Hexagonal, Microservices | | Java | Clean, Layered, Hexagonal, DDD, MVC, CQRS, Microservices, Modular Monolith | | .NET | Clean, Layered, Hexagonal, DDD, MVC, CQRS, Microservices, Modular Monolith | | Django | MVC, Layered, Clean | | Laravel | MVC, Layered, Modular Monolith |
Mobile
| Stack | Architectures | | ---------------- | -------------------- | | React Native | Clean, Feature-based | | Flutter | Clean, Feature-based |
Recommended (baseline): Clean · Layered · MVC · Feature-based · Modular Monolith
Advanced (situational): Hexagonal · DDD · CQRS · Microservices · Feature-Sliced
🧪 Architecture Rules (9 total)
| Rule | Description |
| ----------------------------- | -------------------------------------------------------- |
| clean/domain-isolation | Domain cannot import from infrastructure or presentation |
| clean/application-isolation | Application cannot import from presentation |
| feature/isolation | Features cannot cross-import |
| naming/no-impl-in-domain | No "Impl" files in domain |
| hexagonal/port-isolation | Ports cannot import from adapters |
| ddd/aggregate-isolation | Aggregates cannot cross-import |
| fsd/layer-order | FSD layers enforce import hierarchy |
| cqrs/segregation | Commands and queries stay separate |
| modular/module-isolation | Modules use public API only |
🔗 Links
- GitHub: github.com/mr-kasper/archforge
- CLI package: @archforge/cli
- Docs: Architecture Rules · Creating Templates
📄 License
MIT © mr-kasper
