Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ronaldjdev/forge/llms.txt

Use this file to discover all available pages before exploring further.

Forge’s dependency rule system turns architectural intent into automated enforcement. Every import in your codebase is an edge in the architecture graph. During each operation, the quench command validates all 13 rules (R1–R13) against every edge, assigning a severity to each violation. This happens automatically — you do not need to configure anything or write custom lint rules. Violations appear in the quench output with file path, line number, violated rule, and severity, and they feed directly into the Layers (25 pts) and Import Conventions (20 pts) categories of forge inspect.

Allowed Dependencies

These import directions are explicitly permitted by the architecture model:
Import DirectionPermitted?Notes
feature → platformFeatures may use platform services (logger, config, DI tokens)
feature → sharedFeatures may use shared errors, contracts, types, and utils
platform → infraPlatform bootstraps and configures infrastructure clients
adapter → infraFeature adapters (persistence) implement domain ports using infra
feature → domain (own feature)Application and adapter layers import from their own domain/

Dependency Rules Table

RuleDescriptionSeverity
R1feature → infra — A feature layer file directly imports from src/infra/. Use a domain port and inject the infra implementation instead.CRITICAL
R2platform → feature — A platform file imports from src/features/. Platform must not know about any business feature.CRITICAL
R3shared → feature — A shared file imports from src/features/. Shared must be pure and direction-agnostic.ERROR
R4shared → infra — A shared file imports from src/infra/. Shared must have zero infrastructure dependencies.ERROR
R5domain → infra — A domain entity or repository interface imports from src/infra/. The domain must be infrastructure-free.CRITICAL
R6domain → platform — A domain file imports from src/platform/. Domain must depend on nothing external.CRITICAL
R7infra → feature — An infrastructure file imports from a feature. Infra implements ports; it must not reach back into features.WARNING
R8Cross-feature direct imports — A file in src/features/A/ imports directly from src/features/B/. Inter-feature coupling must go through shared interfaces or event bus.ERROR
R9Dependency cycles — A circular dependency exists between any two or more nodes in the architecture graph.ERROR

Import Convention Rules (R10–R13) in Practice

Rules R10–R13 apply to every file Forge generates and every file it audits. R10–R12 exist because Node.js ESM with moduleResolution: "nodenext" requires explicit, fully-resolved import paths. R12b and R13 guard against DI wiring mistakes and domain artifacts leaking into platform.
// ✅ Correct — relative path with .js extension
import { UserEntity } from './domain/entities/User.entity.js';

// ✅ Correct — going up the tree, still .js
import { NotFoundError } from '../../shared/errors/NotFoundError.js';

// ✅ Correct — path alias for cross-layer imports
import { Tokens } from '@/platform/di/Tokens.js';
import { IPaginatedResponse } from '@/shared/contracts/IPaginatedResponse.js';

Path Aliases for Cross-Layer Imports

When an import must cross a layer boundary, use a @/ path alias instead of a long relative path:
Target LayerAliasExample
Platform@/platform/@/platform/config/App.config.js
Shared@/shared/@/shared/errors/NotFoundError.js
Infrastructure@/infra/@/infra/mongodb/Mongo.config.js
Shared domain entities@/domain/@/domain/entities/Task.js

Inline Ignores

When a specific import genuinely needs to cross a boundary (for example, during a phased migration from a legacy codebase), Forge supports inline suppression comments. Ignores are narrow by design — they apply to the next line or to specific named rules only.
// Suppress all rules for the next line
// forge-ignore-next-line
import { something } from '../infra/prisma/index.js';

// Suppress only R1 for the next line
// forge-ignore: R1
import { PrismaClient } from '../../infra/prisma/client.js';

// Suppress R1 and R8 together
// forge-ignore: R1, R8
import { crossFeature } from '../other-feature/domain/Entity.js';
To audit all active ignores across the codebase:
forge quench --show-ignores
Inline ignores hide violations from the quench output but they do not remove the edges from the architecture graph. The violated rules are still tracked in ARCHITECTURE.md with an [ignored] marker so the technical debt remains visible.

Violation Severity

Forge uses three severity levels, each with a distinct impact on the development workflow:
Rules: R1, R2, R5, R6, R12, R12b, R13A CRITICAL violation represents a fundamental breach of architectural boundaries — typically an import that couples the domain to infrastructure, or platform to business logic. In Cursor, the forgeSmith preToolUse hook denies the write operation before the file is saved. In forge inspect, CRITICAL violations contribute the highest penalty to the scoring system. They must be resolved, not suppressed.

Run forge quench --fix to automatically correct WARNING and INFO violations — including missing @injectable() and @inject() decorators, incorrect tsconfig.json settings, naming convention violations, and stray container.resolve() calls inside business logic.

Build docs developers (and LLMs) love