Threadly Subdomains (Type A)
Threadly allows site creators to claim branded subdomains under the primary Threadly domain (e.g. my-manga.threadly.com).
How It Works
- User enters or auto-generates a subdomain during Site creation or via the Client Dashboard.
- Backend Normalization & Validation:
- Converts to lowercase.
- Ensures length is between 3 and 63 characters.
- Validates regex:
^[a-z0-9]([a-z0-9-]{1,61}[a-z0-9])?$. - Rejects spaces, slashes, underscores, and protocol prefixes.
- Enforces the Reserved Names List (e.g.,
api,admin,app,docs,auth,support,billing).
- Availability & Atomic Reservation:
- Pre-flight check via
GET /api/v1/sites/:siteId/subdomain/availability?subdomain=.... - Guaranteed atomic reservation via MongoDB unique index on
normalizedHostname.
- Pre-flight check via
- Cloudflare DNS Creation:
- The server calls Cloudflare Zone DNS API to create a
CNAMErecord:- Name:
my-manga - Target:
THREADLY_DOMAIN_TARGET(e.g.app.threadly.com) - Proxied:
true(Orange-clouded for CDN caching and DDoS protection).
- Name:
- The server calls Cloudflare Zone DNS API to create a
- CORS Origin Integration:
https://my-manga.threadly.comis automatically added to the Site'sallowedOriginslist.
API Endpoints
Check Subdomain Availability
http
GET /api/v1/sites/:siteId/subdomain/availability?subdomain=my-manga
Authorization: Bearer <jwt_token>Response:
json
{
"success": true,
"data": {
"available": true,
"hostname": "my-manga.threadly.com"
}
}Provision Subdomain
http
POST /api/v1/sites/:siteId/subdomain
Content-Type: application/json
Authorization: Bearer <jwt_token>
{
"subdomain": "my-manga"
}If
subdomainis omitted, Threadly automatically generates an available slug from the site name (e.g. "My Manga" ->my-manga, ormy-manga-2if taken).
Response:
json
{
"success": true,
"hostname": "my-manga.threadly.com",
"status": "active",
"data": {
"id": "6648bfa9...",
"siteId": "site_123",
"hostname": "my-manga.threadly.com",
"type": "threadly_subdomain",
"status": "active",
"isPrimary": true,
"provider": "cloudflare",
"sslStatus": "active"
}
}