Skip to content

verikt.yaml

Every verikt project has an verikt.yaml at its root. This file defines the architecture rules that verikt check enforces.

language: go
architecture: hexagonal
capabilities:
- platform
- bootstrap
- http-api
- mysql
- migrations
- health
components:
- name: domain
in: ["domain/**"]
may_depend_on: []
- name: ports
in: ["port/**"]
may_depend_on: [domain]
- name: service
in: ["service/**"]
may_depend_on: [domain, ports]
- name: adapters
in: ["adapter/**"]
may_depend_on: [ports, domain]
rules:
max_function_lines: 80
max_function_params: 5
max_function_returns: 3
required_dirs: []
forbidden_dirs: []

The project’s programming language. Supported values: go, typescript.

The architecture pattern used to scaffold the project (hexagonal, flat).

List of capabilities composed into the project. Used for documentation and future verikt update support.

The core of architecture enforcement. Each component defines:

FieldTypeDescription
namestringComponent identifier
instring[]Glob patterns matching this component’s packages
may_depend_onstring[]Other components this one is allowed to import from

Optional rules for function complexity and project structure:

FieldTypeDefaultDescription
max_function_linesint80Maximum lines per function
max_function_paramsint5Maximum parameters per function
max_function_returnsint3Maximum return values per function
required_dirsstring[][]Directories that must exist
forbidden_dirsstring[][]Directories that must not exist

Architecture and capability manifests support two fields for integrating with the feature matrix.

A list of feature names that must be enabled for the manifest to apply. If any required feature is disabled (because the target Go version is too old), verikt skips or warns about the capability.

capability.yaml
name: safepath
description: Kernel-level path traversal safety
requires_features:
- os_root

A map of feature names to file inclusion/exclusion rules. This controls which template files are rendered based on resolved features — allowing a single capability to ship both modern and fallback implementations.

capability.yaml
name: platform
conditional:
os_root:
include:
- internal/safepath/root.go.tmpl
exclude:
- internal/safepath/fallback.go.tmpl

When os_root is true (Go >= 1.24): root.go.tmpl is rendered, fallback.go.tmpl is skipped. When false: the opposite. Files not mentioned in any conditional rule are always included. If a file appears in conflicting rules from different features, exclude wins.

The configuration is validated when running verikt check:

  • Component names must be unique
  • Components cannot depend on themselves
  • Dependencies must reference existing components
  • in patterns must be valid globs