# Where to Find Component Type Definitions in Archify Schemas

> Locate component type definitions in Archify schemas within the common schema file under $defs. Discover how these definitions are referenced across your project for efficient management.

- Repository: [tt-a1i/archify](https://github.com/tt-a1i/archify)
- Tags: api-reference
- Published: 2026-07-15

---

**The component type definitions in Archify schemas are centrally defined in [`archify/schemas/common.schema.json`](https://github.com/tt-a1i/archify/blob/main/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`](https://github.com/tt-a1i/archify/blob/main/archify/schemas/common.schema.json) within the `$defs` object:

```json
{
  "$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:

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

```

For example, in [`archify/schemas/workflow.schema.json`](https://github.com/tt-a1i/archify/blob/main/archify/schemas/workflow.schema.json), the reference appears within component array definitions:

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

```

The same reference pattern appears in:

- [`archify/schemas/sequence.schema.json`](https://github.com/tt-a1i/archify/blob/main/archify/schemas/sequence.schema.json)
- [`archify/schemas/dataflow.schema.json`](https://github.com/tt-a1i/archify/blob/main/archify/schemas/dataflow.schema.json)
- [`archify/schemas/architecture.schema.json`](https://github.com/tt-a1i/archify/blob/main/archify/schemas/architecture.schema.json)

## 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

```javascript
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

- **Component type definitions** in Archify are centralized in [`archify/schemas/common.schema.json`](https://github.com/tt-a1i/archify/blob/main/archify/schemas/common.schema.json) under `$defs/componentType`.
- The enumeration includes: `frontend`, `backend`, `database`, `cloud`, `security`, `messagebus`, and `external`.
- Diagram schemas reference these definitions using `"$ref": "common.schema.json#/$defs/componentType"` to maintain a single source of truth.
- Key files using this reference include [`workflow.schema.json`](https://github.com/tt-a1i/archify/blob/main/workflow.schema.json), [`sequence.schema.json`](https://github.com/tt-a1i/archify/blob/main/sequence.schema.json), [`dataflow.schema.json`](https://github.com/tt-a1i/archify/blob/main/dataflow.schema.json), and [`architecture.schema.json`](https://github.com/tt-a1i/archify/blob/main/architecture.schema.json).

## 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`](https://github.com/tt-a1i/archify/blob/main/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`](https://github.com/tt-a1i/archify/blob/main/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`](https://github.com/tt-a1i/archify/blob/main/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.