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 smelt extracts duplicated or cross-cutting code from your features and consolidates it in src/shared/ — the one layer in Forge’s architecture that every other layer is allowed to import from. When two or more features contain the same error class, type definition, or utility function, leaving that code in place creates hidden coupling: any change to the duplicated code must be applied in multiple places, and the risk of drift grows with every sprint. Smelting the code into shared/ gives it a single, stable home and makes the dependency explicit and auditable.
Usage
Shared Layer Structure
After smelting, extracted artefacts are placed in the appropriate subdirectory ofsrc/shared/:
What Belongs in Shared
| Type | File Pattern | Example |
|---|---|---|
| Errors | <Name>Error.ts | NotFoundError.ts, ValidationError.ts |
| Contracts | I<Name>.ts | IPaginatedResponse.ts, IResponse.ts |
| Types | <domain>.types.ts | api.types.ts, user.types.ts |
| Utils | <util>.ts | formatDate.ts, pagination.ts |
smelt share three properties: they are used by two or more features, they contain no business logic specific to any single feature, and they carry no dependency on infrastructure (databases, external clients, ORMs).
What Must NOT Be in Shared
Smelt Workflow
Identify candidates
Look for types, interfaces, error classes, or utility functions that appear in more than one feature, or that a feature contains but that have no business-logic dependency.
Verify purity
Confirm the candidate has no imports from
src/features/, src/infra/, or src/platform/. If it does, it cannot safely live in shared/.Move to the correct subdirectory
Place the file in
src/shared/errors/, src/shared/contracts/, src/shared/types/, or src/shared/utils/ according to the table above, using the correct naming convention.Update all imports
Replace every import across features that referenced the old location with the new
src/shared/… path.After smelting, update
ARCHITECTURE.md by running forge inscribe so the shared layer inventory stays accurate.