Getting Started

Install DNA, write your first document, and learn the three layers.

What is DNA?

DNA is a description language for business systems. You describe what your business does, what gets built on top of it, and how that's deployed — all in JSON / YAML, all in one place. From that description, you can generate documentation, workflows, validation, and increasingly, working software.

DNA is split across three intentionally decoupled layers:

  • Operational — the people, structures, and activities your business is built on.
  • Product — the resources, APIs, and UI your product surfaces.
  • Technical — how the system is deployed: cells, providers, environments.

Layers flow downstream only — Operational → Product → Technical. Upper layers never depend on lower ones.

Install

The packages live under the @dna-codes npm scope:

npm install @dna-codes/dna-core @dna-codes/dna-schemas

No .npmrc or auth token required — they're published to the public npm registry.

Quickstart: validate a tiny Operational DNA

Create my-business.json:

{
  "domain": {
    "name": "lending",
    "path": "acme.finance.lending",
    "resources": [
      {
        "name": "Loan",
        "attributes": [
          { "name": "amount", "type": "number", "required": true },
          { "name": "status", "type": "enum", "values": ["pending", "active", "repaid"] }
        ],
        "actions": [
          { "name": "Apply",   "type": "write" },
          { "name": "Approve", "type": "write" }
        ]
      }
    ],
    "persons": [
      { "name": "Borrower" },
      { "name": "Employee" }
    ],
    "groups": [{ "name": "BankDepartment" }],
    "roles": [{ "name": "Underwriter", "scope": "BankDepartment" }]
  },
  "memberships": [
    { "name": "EmployeeUnderwriter", "person": "Employee", "role": "Underwriter" }
  ],
  "operations": [
    {
      "target": "Loan",
      "action": "Approve",
      "name": "Loan.Approve",
      "changes": [{ "attribute": "status", "set": "active" }]
    }
  ],
  "rules": [
    { "operation": "Loan.Approve", "type": "access", "allow": [{ "role": "Underwriter" }] }
  ]
}

Validate it with dna-core:

import { validateOperational } from '@dna-codes/dna-core';
import doc from './my-business.json';

const result = validateOperational(doc);
if (!result.valid) {
  console.error(result.errors);
} else {
  console.log('Valid Operational DNA');
}

Where next?