Where to Find Component Type Definitions in Archify Schemas

The component type definitions in Archify schemas are centrally defined in archify/schemas/common.schema.json under the $defs section as componentType and referenced by diagram-specific schemas using JSON Schema $ref pointers.

The Archify project (tt-a1i/archify) validates architecture diagrams using JSON Schema. Component type definitions—such as frontend, backend, and database—are standardized across all diagram types to ensure consistency. Understanding where these definitions live and how they are referenced is essential for extending the schema or validating custom components.

Central Definition in the Common Schema

The componentType enumeration serves as the single source of truth for all valid component categories in Archify. Rather than duplicating these values across multiple files, the project centralizes them in a shared definitions file.

Location and Structure

The canonical definition resides in archify/schemas/common.schema.json within the $defs object:

{
  "$defs": {
    "componentType": {
      "type": "string",
      "enum": [
        "frontend",
        "backend",
        "database",
        "cloud",
        "security",
        "messagebus",
        "external"
      ]
    }
  }
}

This structure defines all allowed values as an enumerated type, preventing invalid component classifications across the system.

Referencing Component Types in Diagram Schemas

Individual diagram schemas—including workflow, sequence, dataflow, and architecture—reference the common definition rather than redefining it. They use the JSON Schema $ref keyword to point to the centralized definition.

Reference Pattern

The $ref pointer follows this format:

"$ref": "common.schema.json#/$defs/componentType"

For example, in archify/schemas/workflow.schema.json, the reference appears within component array definitions:

{
  "$id": "workflow.schema.json",
  "type": "object",
  "properties": {
    "components": {
      "type": "array",
      "items": {
        "$ref": "common.schema.json#/$defs/componentType"
      }
    }
  }
}

The same reference pattern appears in:

Accessing Component Types Programmatically

When building tools that consume Archify schemas, you can extract the allowed component types directly from the common schema file.

Node.js Example

import fs from "fs";
import path from "path";

const commonSchemaPath = path.join(
  __dirname,
  "archify",
  "schemas",
  "common.schema.json"
);
const commonSchema = JSON.parse(fs.readFileSync(commonSchemaPath, "utf8"));
const componentType = commonSchema.$defs.componentType.enum;

console.log("Allowed component types:", componentType);
// → Allowed component types: [
//      "frontend","backend","database","cloud","security",
//      "messagebus","external"
//    ]

This approach ensures your application stays synchronized with the schema definitions without hardcoding the enumeration values.

Summary

Frequently Asked Questions

What are the allowed component types in Archify?

The allowed component types are defined as an enumeration in archify/schemas/common.schema.json. The current valid values are: frontend, backend, database, cloud, security, messagebus, and external.

How do I add a new component type to Archify schemas?

To add a new component type, modify the enum array within $defs.componentType in archify/schemas/common.schema.json. All schemas referencing this definition will automatically recognize the new type without requiring individual updates.

Why are component types defined in a common schema instead of individual schemas?

Archify uses a common schema to enforce single source of truth principles. This prevents type drift across diagram definitions and ensures that validation rules remain consistent across workflow, sequence, dataflow, and architecture diagrams.

How do I validate that a component type is valid against Archify schemas?

You can validate component types using any JSON Schema validator by loading archify/schemas/common.schema.json and checking if the value exists in $defs.componentType.enum. Alternatively, resolve the $ref pointer in the specific diagram schema you are validating against.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →