Domain Routing
Domain Routing
This document describes the subdomain routing patterns used across the autom8y platform infrastructure.
Domain Structure
The autom8y platform uses subdomains to route traffic to different services:
autom8y.io # Main landing page├── docs.autom8y.io # Documentation (this site)├── api.autom8y.io # API gateway├── app.autom8y.io # Web application (future)└── status.autom8y.io # Status page (future)Subdomain Conventions
Naming Patterns
| Pattern | Purpose | Example |
|---|---|---|
docs.* | Documentation sites | docs.autom8y.io |
api.* | API endpoints | api.autom8y.io |
app.* | Web applications | app.autom8y.io |
status.* | Status pages | status.autom8y.io |
cdn.* | Static assets | cdn.autom8y.io |
Environment Prefixes
Non-production environments use prefixes:
| Environment | Pattern | Example |
|---|---|---|
| Production | <service>.autom8y.io | api.autom8y.io |
| Staging | <service>.staging.autom8y.io | api.staging.autom8y.io |
| Development | <service>.dev.autom8y.io | api.dev.autom8y.io |
DNS Configuration
Record Types
| Record | Purpose | Example |
|---|---|---|
A | IPv4 address | Root domain |
AAAA | IPv6 address | Root domain |
CNAME | Alias to another domain | Subdomains |
TXT | Verification records | Domain ownership |
MX | Email routing | Mail configuration |
Cloudflare Integration
All DNS is managed through Cloudflare, providing:
- DDoS protection
- SSL termination
- Edge caching
- WAF rules
Terraform Management
DNS records are managed via Terraform in the autom8y_platform repository:
resource "cloudflare_record" "docs" { zone_id = var.cloudflare_zone_id name = "docs" content = "docs-site.pages.dev" type = "CNAME" proxied = true}SSL/TLS
Certificate Management
SSL certificates are automatically provisioned via Cloudflare:
- Free universal SSL for all subdomains
- Automatic renewal
- Full (strict) encryption mode
Security Headers
All sites include security headers:
Strict-Transport-Security: max-age=31536000; includeSubDomainsX-Content-Type-Options: nosniffX-Frame-Options: DENYContent-Security-Policy: default-src 'self'Routing Rules
Path-Based Routing
Within a subdomain, paths route to different handlers:
api.autom8y.io/├── /v1/workflows → Workflow service├── /v1/analytics → Analytics service├── /health → Health check endpoint└── /metrics → Prometheus metricsHeader-Based Routing
API version can also be specified via header:
curl -H "API-Version: 2024-01-15" https://api.autom8y.io/workflowsCORS Configuration
Allowed Origins
Production CORS allows:
const allowedOrigins = [ 'https://autom8y.io', 'https://app.autom8y.io', 'https://docs.autom8y.io'];Preflight Handling
OPTIONS requests return:
Access-Control-Allow-Origin: <origin>Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONSAccess-Control-Allow-Headers: Authorization, Content-Type, X-Request-IDAccess-Control-Max-Age: 86400Load Balancing
Geographic Distribution
Traffic is distributed across Cloudflare’s edge network:
- Automatic geo-routing to nearest edge
- Failover to alternate regions
- Health checks for origin servers
Session Affinity
For stateful applications (future):
- Cookie-based session affinity
- Configurable TTL
- Graceful failover
Monitoring
Metrics Collected
| Metric | Description |
|---|---|
| Request count | Total requests per subdomain |
| Latency | p50, p95, p99 response times |
| Error rate | 4xx and 5xx responses |
| Bandwidth | Data transfer in/out |
Alerting
Alerts trigger on:
- Error rate > 1% for 5 minutes
- Latency p95 > 500ms for 5 minutes
- Availability < 99.9% over 1 hour
Future Considerations
Planned Subdomains
| Subdomain | Purpose | Timeline |
|---|---|---|
app.autom8y.io | Web application | Phase 2 |
status.autom8y.io | Status page | Phase 2 |
webhooks.autom8y.io | Webhook receiver | Phase 3 |
Migration Path
When adding new subdomains:
- Add Terraform configuration
- Apply DNS changes
- Configure SSL (automatic)
- Deploy service to Cloudflare Pages/Workers
- Update CORS and routing rules
- Monitor for 24 hours before announcing
Next Steps
- Review API Standards for endpoint conventions
- Explore the Architecture for service details