Skip to content

Henabakos/archforge-x

Repository files navigation

ArchForge X

Enterprise Architecture Engine — A CLI tool that turns software architecture into executable, validated code.


What Does It Do?

ArchForge X helps you:

  1. Generate production-ready Node.js projects with proper architecture (Express or NestJS)
  2. Validate that your code follows architectural rules (layer boundaries)
  3. Audit existing code for violations and get fix suggestions
  4. Visualize your project's dependency graph

Installation

# Install globally
npm install -g archforge-x

# Or install in your project
npm install --save-dev archforge-x

# Verify it works
archforge --version

Getting Started

Option 1: Create a New Project (Interactive)

archforge init

The wizard will ask you:

  • Project name
  • Framework: Express or NestJS
  • Architecture: Clean, DDD, or Layered
  • ORM: Prisma, TypeORM, or none
  • Database: PostgreSQL, MySQL, SQLite
  • Include authentication module? (yes/no)

Option 2: Create with Command Line Options

# NestJS with Clean Architecture and Prisma
archforge generate --framework nestjs --architecture clean --orm prisma

# Express with DDD and TypeORM
archforge generate --framework express --architecture ddd --orm typeorm

What Gets Generated?

my-project/
├── src/
│   ├── domain/           # Entities, repository interfaces
│   ├── application/      # Use cases, DTOs
│   ├── infrastructure/   # Database, external services
│   └── interfaces/       # Controllers, routes
├── prisma/               # (if using Prisma)
│   └── schema.prisma
├── .env                  # Environment variables
├── .env.example
├── Dockerfile
├── docker-compose.yml
├── .github/
│   └── workflows/ci.yml  # GitHub Actions CI
├── archforge.yaml        # Architecture definition
├── package.json
└── README.md             # Project documentation

How It Works

1. Architecture Definition

ArchForge uses a YAML config file (archforge.yaml) to define your architecture:

version: "1.0"
project:
  name: "my-api"

layers:
  - name: "domain"
    path: "src/domain"
    canImport: []           # Domain has no dependencies

  - name: "application"
    path: "src/application"
    canImport: ["domain"]   # Can only import domain

  - name: "infrastructure"
    path: "src/infrastructure"
    canImport: ["domain", "application"]

  - name: "interfaces"
    path: "src/interfaces"
    canImport: ["domain", "application"]

rules:
  enforceLayerBoundaries: true

2. Validate Your Code

Check if your code follows the rules:

archforge validate

If everything is correct:

✅ Architecture validation passed!
   Layers: 4
   Files: 47
   Violations: 0

If there's a violation:

❌ Violation in src/domain/user.entity.ts:15
   Domain layer imports from Infrastructure

3. Get Fix Suggestions

archforge audit

The audit command gives you intelligent suggestions:

💡 Fix Suggestion (Dependency Inversion):
   1. Define an interface in Domain (IUserRepository)
   2. Implement it in Infrastructure
   3. Inject via constructor

4. Visualize Dependencies

archforge graph --output architecture.svg

Generates an SVG diagram showing layer relationships.

CLI Commands

Command What It Does
archforge init Interactive wizard to create a project
archforge generate Generate project from config
archforge validate Check for architecture violations
archforge audit Deep scan with fix suggestions
archforge graph Generate dependency graph
archforge sync Sync config with existing code

Supported Options

Framework Architectures ORMs Databases
Express Clean, DDD, Layered Prisma, TypeORM PostgreSQL, MySQL, SQLite
NestJS Clean, DDD, Layered Prisma, TypeORM PostgreSQL, MySQL, SQLite

Use in CI/CD

Add validation to your pipeline:

# .github/workflows/ci.yml
- name: Check Architecture
  run: npx archforge validate

Documentation

Contributing

git clone https://github.com/Henabakos/archforge-x.git
cd archforge-x
npm install
npm test
npm run build

License

MIT

About

A configuration-driven architecture generator and enforcement tool that creates production-ready projects with consistent structure, rules, CI/CD, and Docker support.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors