# MX Record Format in is-a.dev: Configuring Mail Exchange Records

> Learn the MX record format in is-a.dev. Explore simple hostname arrays or objects with explicit target and priority values for efficient mail exchange configuration.

- Repository: [is-a.dev/register](https://github.com/is-a-dev/register)
- Tags: api-reference
- Published: 2026-03-09

---

**MX records in is-a.dev support two JSON formats: a simple array of hostnames with auto-assigned priorities starting at 10, or an array of objects specifying explicit target and priority values.**

When registering a subdomain under the is-a-dev/register repository, you define DNS records inside JSON files stored in the `domains/` directory. The registry's DNS generation pipeline processes these configurations to create live Cloudflare records, making correct MX syntax essential for functional mail routing.

## Supported MX Record Formats in is-a.dev

The registry accepts two interchangeable structures for the `MX` field within a domain's `records` object. Both formats are handled by the transformation logic in [`dnsconfig.js`](https://github.com/is-a-dev/register/blob/main/dnsconfig.js) (lines 66-84).

### Simple Array Format (Auto-Assigned Priority)

Use a JSON array of strings when you want the registry to automatically calculate priority values. According to the source code in [`dnsconfig.js`](https://github.com/is-a-dev/register/blob/main/dnsconfig.js) (lines 66-74), the script assigns priority using the formula `10 + index`, where index is the zero-based position in the array. The first entry receives priority 10, the second receives 11, and so on.

```json
{
  "records": {
    "MX": ["mx1.improvmx.com", "mx2.improvmx.com"]
  }
}

```

This format appears in production domains such as [`domains/youfoundalpha.json`](https://github.com/is-a-dev/register/blob/main/domains/youfoundalpha.json) (lines 9-11), demonstrating its use with ImprovMX servers.

### Explicit Object Format (Custom Priority)

For precise control over mail routing order, define MX records as an array of objects. Each object must contain a `target` property (the mail server hostname) and a `priority` property (the numeric preference). The registry script processes these entries at lines 75-82 of [`dnsconfig.js`](https://github.com/is-a-dev/register/blob/main/dnsconfig.js), using the supplied values directly without additional calculation.

```json
{
  "records": {
    "MX": [
      { "target": "mx1.improvmx.com", "priority": 10 },
      { "target": "mx2.improvmx.com", "priority": 20 }
    ]
  }
}

```

## How the Registry Processes MX Records

The DNS compilation logic resides in the root-level [`dnsconfig.js`](https://github.com/is-a-dev/register/blob/main/dnsconfig.js) file. During the build process, the script iterates over `data.records.MX` and performs type detection on each entry:

- **String entries**: Treated as hostnames and wrapped in an auto-priority calculation (`10 + index`).
- **Object entries**: Validated for `target` and `priority` properties and passed directly to the DNS builder.

This dual-path implementation (lines 66-84) ensures backward compatibility for legacy string arrays while supporting modern explicit configurations.

## Complete Configuration Examples

Here are full domain file implementations showing both approaches in context.

**Simple array with auto-priorities:**

```json
{
  "owner": { "username": "exampleuser" },
  "records": {
    "MX": ["mx1.improvmx.com", "mx2.improvmx.com"]
  }
}

```

**Explicit objects with custom priorities:**

```json
{
  "owner": { "username": "exampleuser" },
  "records": {
    "MX": [
      { "target": "aspmx.l.google.com", "priority": 1 },
      { "target": "alt1.aspmx.l.google.com", "priority": 5 }
    ]
  }
}

```

## Summary

- The **is-a.dev** registry accepts two MX formats: simple string arrays or explicit target/priority objects.
- Simple arrays receive auto-calculated priorities starting at 10 and incrementing by 1 for each index position.
- Object arrays require `target` and `priority` properties for direct control over mail routing preferences.
- All processing occurs in [`dnsconfig.js`](https://github.com/is-a-dev/register/blob/main/dnsconfig.js) (lines 66-84) during the DNS configuration generation phase.

## Frequently Asked Questions

### What priority values does is-a.dev assign to simple MX arrays?

The registry script assigns priorities starting at 10 and incrementing by 1 for each subsequent entry. The first hostname in the array receives priority 10, the second receives 11, and so forth, as implemented in [`dnsconfig.js`](https://github.com/is-a-dev/register/blob/main/dnsconfig.js) lines 66-74.

### Can I mix string hostnames and objects in the same MX array?

While the code at [`dnsconfig.js`](https://github.com/is-a-dev/register/blob/main/dnsconfig.js) processes each entry individually by checking its type, best practice is to use a consistent format throughout the array—either all strings or all objects—to ensure predictable priority assignment and maintain configuration readability.

### Where are MX records defined in the is-a.dev repository?

MX records are defined within individual JSON files located in the `domains/` directory, specifically inside the `records` object using the `MX` key. For example, [`domains/youfoundalpha.json`](https://github.com/is-a-dev/register/blob/main/domains/youfoundalpha.json) demonstrates the simple array format at lines 9-11.

### What file controls how MX records are rendered to DNS?

The transformation logic resides in [`dnsconfig.js`](https://github.com/is-a-dev/register/blob/main/dnsconfig.js) at the repository root. This script iterates through domain configurations, detects whether each MX entry is a string or object, and generates the appropriate Cloudflare MX records accordingly (lines 66-84).