domain-structure.md (5505B)
1 --- 2 icon: file-code 3 route: /domain-structure 4 tags: useful 5 --- 6 7 # Domain Structure 8 9 To register a subdomain, submit a pull request with a new JSON file in the `domains` directory. 10 For example, to register `example.is-a.dev`, create a file named `example.json` in `domains/`: 11 12 ``` 13 domains/example.json 14 ``` 15 16 --- 17 18 ## Filename Guidelines 19 20 To register a nested subdomain like `blog.example.is-a.dev`, use dots (`.`) in the filename: 21 `blog.example.json` 22 23 Each part of the filename (i.e., each subdomain label) must follow these rules: 24 25 * Must be **alphanumeric and lowercase**. Dashes (`-`) are allowed as separators, but **not consecutively** (e.g., `--` is invalid). 26 * Minimum of **1 character**, maximum of **244 characters** (excluding `.json`). 27 * Each label (segment between dots) must be **≤ 63 characters**. 28 * File must **end with `.json`**. 29 * **Must not contain `is-a.dev`**. 30 * **Must not begin with a dot**, or contain spaces or invalid characters. 31 32 ### Invalid Filenames 33 34 | Filename | Issue | 35 | ----------------------------- | ----------------------------------- | 36 | `.json` | Empty filename | 37 | `A.json` | Uppercase letters | 38 | `a..json` | Consecutive dots | 39 | `.a.json` | Starts with a dot | 40 | `a .json` | Contains a space | 41 | `a$.json` | Non-alphanumeric character | 42 | `a.json.json` | Multiple extensions | 43 | `a.is-a.dev.json` | Contains reserved string `is-a.dev` | 44 | `a--a.json` | Consecutive dashes | 45 | `blog._a.json` | Label starts with an underscore | 46 | `abc123.aaaaaaaa...aaaa.json` | Label exceeds 63 characters | 47 | `very.long.filename...json` | Filename exceeds 244 characters | 48 49 ### Valid Filenames 50 51 | Filename | Why It's Valid | 52 | ------------------------------ | ----------------------------------- | 53 | `a.json` | Minimum 1 character | 54 | `example.json` | Lowercase and alphanumeric | 55 | `blog.example.json` | Nested subdomain | 56 | `my-blog.json` | Uses dashes correctly | 57 | `mail._domainkey.example.json` | Underscore is not in the root label | 58 | `_vercel.example.json` | Valid underscore usage | 59 | `abc123.json` | Alphanumeric | 60 61 > **Note:** Users may only register *one* single-letter subdomain to prevent domain squatting. 62 63 --- 64 65 ## Example JSON File 66 67 `domains/docs.json`: 68 69 ```json 70 { 71 "owner": { 72 "username": "is-a-dev" 73 }, 74 "records": { 75 "CNAME": "is-a-dev-docs.pages.dev" 76 }, 77 "proxied": true 78 } 79 ``` 80 81 --- 82 83 ## JSON Structure 84 85 ### `owner` (required) 86 87 Provides contact information. Required fields: 88 89 * `username`: Your GitHub username. 90 91 Example: 92 93 ```json 94 { 95 "owner": { 96 "username": "your-github-username" 97 } 98 } 99 ``` 100 101 --- 102 103 ### `records` (required) 104 105 Specify your domain's DNS records. 106 107 See all supported record types in the [FAQ](./faq#which-records-are-supported). 108 109 #### Record Type Examples 110 111 * **A** 112 Points to IPv4 addresses: 113 114 ```json 115 "A": ["192.0.2.1", "198.51.100.1"] 116 ``` 117 118 * **AAAA** 119 Points to IPv6 addresses: 120 121 ```json 122 "AAAA": ["2001:db8::1", "2001:db8::2"] 123 ``` 124 125 * **CAA** 126 Controls which CAs can issue certificates: 127 128 ```json 129 "CAA": [ 130 { "flags": 0, "tag": "issue", "value": "letsencrypt.org" } 131 ] 132 ``` 133 134 * **CNAME** 135 Points to another hostname: 136 137 ```json 138 "CNAME": "your-site.example.com" 139 ``` 140 141 * **DS** 142 DNSSEC delegation signer: 143 144 ```json 145 "DS": [ 146 { 147 "key_tag": 2371, 148 "algorithm": 13, 149 "digest_type": 2, 150 "digest": "..." 151 } 152 ] 153 ``` 154 155 * **MX** 156 Email servers for your domain: 157 158 Simple form: 159 160 ```json 161 "MX": [ 162 "mx1.example.com", 163 "mx2.example.com" 164 ] 165 ``` 166 167 With priority: 168 169 ```json 170 "MX": [ 171 { "target": "mx1.example.com", "priority": 10 }, 172 { "target": "mx2.example.com", "priority": 20 } 173 ] 174 ``` 175 176 * **NS** 177 Delegates DNS to other nameservers: 178 179 ```json 180 "NS": ["ns1.example.com", "ns2.example.com"] 181 ``` 182 183 > Refer to the [FAQ](https://docs.is-a.dev/faq/#who-can-use-ns-records) for guidance on valid use cases. 184 185 * **SRV** 186 Defines service records: 187 188 ```json 189 "SRV": [ 190 { 191 "priority": 10, 192 "weight": 5, 193 "port": 8080, 194 "target": "service.example.com" 195 } 196 ] 197 ``` 198 199 * **TLSA** 200 Validates a TLS/SSL certificate: 201 202 ```json 203 "TLSA": [ 204 { 205 "usage": 1, 206 "selector": 1, 207 "matching_type": 1, 208 "certificate": "..." 209 } 210 ] 211 ``` 212 213 * **TXT** 214 Used for verification and other metadata: 215 216 Single string: 217 218 ```json 219 "TXT": "Some verification text" 220 ``` 221 222 List format: 223 224 ```json 225 "TXT": ["part1", "part2"] 226 ``` 227 228 * **URL** 229 Redirects your subdomain to a URL: 230 231 ```json 232 "URL": "https://example.com" 233 ``` 234 235 --- 236 237 ### `proxied` (optional) 238 239 Enable Cloudflare proxy: 240 241 ```json 242 "proxied": true 243 ``` 244 245 --- 246 247 ### `redirect_config` (optional) 248 249 Custom redirect paths for your domain: 250 251 ```json 252 "redirect_config": { 253 "custom_paths": { 254 "/github": "https://github.com/is-a-dev" 255 }, 256 "redirect_paths": true 257 } 258 ``` 259 260 > See full example: [`william.json`](https://github.com/is-a-dev/register/blob/main/domains/william.json)