{
  "$id": "https://json.schemastore.org/up.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "properties": {
    "name": {
      "type": "string",
      "title": "Name of the project.",
      "description": "A machine-friendly project name.",
      "examples": ["apex-site", "apex-api", "ping-app"]
    },
    "description": {
      "type": "string",
      "title": "Description of the project.",
      "description": "An optional project description.",
      "examples": ["Marketing site", "Public API"]
    },
    "type": {
      "type": "string",
      "title": "Type of project.",
      "description": "The type of project.",
      "default": "server",
      "enum": ["static", "server"],
      "examples": ["static"]
    },
    "profile": {
      "type": "string",
      "title": "AWS profile.",
      "description": "AWS credentials profile name, these are stored in ~/.aws/credentials.",
      "examples": ["apex-prod", "apex-dev", "personal"]
    },
    "regions": {
      "type": "array",
      "description": "List of target AWS regions for deployment.",
      "minItems": 1,
      "items": {
        "type": "string",
        "title": "AWS Region.",
        "description": "AWS region.",
        "enum": [
          "us-east-2",
          "us-east-1",
          "us-west-1",
          "us-west-2",
          "ap-south-1",
          "ap-northeast-2",
          "ap-southeast-1",
          "ap-southeast-2",
          "ap-northeast-1",
          "ca-central-1",
          "eu-central-1",
          "eu-west-1",
          "eu-west-2",
          "eu-west-3",
          "sa-east-1"
        ],
        "examples": ["us-west-2", "us-*", "eu-*", "*"]
      }
    },
    "lambda": {
      "type": "object",
      "properties": {
        "accelerate": {
          "type": "boolean",
          "title": "Enables S3 acceleration.",
          "description": "Enable S3 acceleration for faster uploads via the CloudFront CDN.",
          "default": false
        },
        "warm": {
          "type": "boolean",
          "title": "Enables active warming.",
          "description": "Active warming mitigates cold starts when enabled.",
          "default": false
        },
        "warm_rate": {
          "type": "string",
          "title": "Active warming rate.",
          "description": "Active warming sends requests to your application at this interval.",
          "default": "15m",
          "examples": ["5m", "30m"]
        },
        "warm_count": {
          "type": "integer",
          "title": "Active warming container count.",
          "description": "Number of concurrent containers to warm.",
          "default": "15"
        },
        "memory": {
          "type": "integer",
          "title": "Memory.",
          "description": "Lambda memory size.",
          "default": 512,
          "enum": [
            128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896,
            960, 1024, 1088, 1152, 1216, 1280, 1344, 1408, 1472, 1536, 1600,
            1664, 1728, 1792, 1856, 1920, 1984, 2048, 2112, 2176, 2240, 2304,
            2368, 2432, 2496, 2560, 2624, 2688, 2752, 2816, 2880, 2944, 3008
          ]
        }
      }
    },
    "stages": {
      "type": "object",
      "properties": {
        "production": {
          "type": "object",
          "properties": {
            "domain": {
              "type": "string",
              "title": "Domain name.",
              "description": "Domain hostname for the stage.",
              "default": "",
              "examples": ["gh-polls.com", "api.gh-polls.com"]
            }
          }
        },
        "staging": {
          "type": "object",
          "properties": {
            "domain": {
              "type": "string",
              "title": "Domain name.",
              "description": "Domain hostname for the stage.",
              "default": "",
              "examples": ["stage.gh-polls.com", "gh-polls-staging.com"]
            }
          }
        },
        "development": {
          "type": "object",
          "properties": {
            "domain": {
              "type": "string",
              "title": "Domain name.",
              "description": "Domain hostname for the stage.",
              "default": "",
              "examples": ["dev.gh-polls.com"]
            }
          }
        }
      }
    },
    "hooks": {
      "type": "object",
      "properties": {
        "build": {
          "type": "string",
          "title": "Build hook.",
          "description": "Hook command(s) to run."
        },
        "clean": {
          "type": "string",
          "title": "Clean hook.",
          "description": "Hook command(s) to run."
        },
        "prebuild": {
          "type": "string",
          "title": "Prebuild hook.",
          "description": "Hook command(s) to run."
        },
        "postbuild": {
          "type": "string",
          "title": "Postbuild hook.",
          "description": "Hook command(s) to run."
        },
        "predeploy": {
          "type": "string",
          "title": "Predeploy hook.",
          "description": "Hook command(s) to run."
        },
        "postdeploy": {
          "type": "string",
          "title": "Postdeploy hook.",
          "description": "Hook command(s) to run."
        }
      }
    },
    "static": {
      "type": "object",
      "properties": {
        "dir": {
          "type": "string",
          "title": "Directory path.",
          "description": "Path to directory from which assets are served.",
          "default": ".",
          "examples": ["public", "./dist"]
        },
        "prefix": {
          "type": "string",
          "title": "URL prefix.",
          "description": "Optional URL path prefix.",
          "examples": ["/public/", "/static/"]
        }
      }
    },
    "proxy": {
      "type": "object",
      "properties": {
        "command": {
          "type": "string",
          "title": "Command.",
          "description": "Command run to start your application.",
          "default": "./server",
          "examples": ["node app.js"]
        },
        "timeout": {
          "type": "integer",
          "title": "Request timeout.",
          "description": "Timeout in seconds per request.",
          "default": 15
        },
        "listen_timeout": {
          "type": "integer",
          "title": "Listen timeout.",
          "description": "Timeout in seconds Up will wait for your app to boot and listen on `PORT`.",
          "default": 15
        },
        "shutdown_timeout": {
          "type": "integer",
          "title": "Shutdown timeout.",
          "description": "Timeout in seconds Up will wait after sending a SIGINT to your server, before sending a SIGKILL.",
          "default": 15
        },
        "backoff": {
          "type": "object",
          "properties": {
            "min": {
              "type": "integer",
              "title": "Minimum delay.",
              "description": "Minimum time in milliseconds before retrying.",
              "default": 500
            },
            "max": {
              "type": "integer",
              "title": "Max delay.",
              "description": "Maximum time in milliseconds before retrying.",
              "default": 1500
            },
            "factor": {
              "type": "number",
              "title": "Factor.",
              "description": "Factor applied to each attempt.",
              "default": 1.5
            },
            "attempts": {
              "type": "integer",
              "title": "Retry attempts.",
              "description": "Attempts made before failing.",
              "default": 5
            },
            "jitter": {
              "type": "boolean",
              "title": "Jitter.",
              "description": "Apply jitter.",
              "default": false
            }
          }
        }
      }
    },
    "dns": {
      "type": "object"
    },
    "environment": {
      "type": "object"
    },
    "headers": {
      "type": "object"
    },
    "error_pages": {
      "type": "object",
      "properties": {
        "disable": {
          "type": "boolean",
          "title": "Disable error pages.",
          "description": "Disable default error pages.",
          "default": false
        },
        "dir": {
          "type": "string",
          "title": "Directory path.",
          "description": "Path to directory from which error pages are served.",
          "default": ".",
          "examples": ["public", "./dist"]
        },
        "variables": {
          "type": "object",
          "properties": {
            "support_email": {
              "type": "string",
              "title": "Support email.",
              "description": "Support email for contact link.",
              "examples": ["support@apex.sh"]
            },
            "color": {
              "type": "string",
              "title": "Color.",
              "description": "Theme color.",
              "examples": ["#228ae6"]
            }
          }
        }
      }
    },
    "cors": {
      "type": "object",
      "properties": {
        "enable": {
          "type": "boolean",
          "title": "Enable CORS.",
          "description": "Enable Cross-Origin Resource Sharing.",
          "default": false
        },
        "allowed_origins": {
          "type": "array",
          "items": {
            "type": "string",
            "title": "Allowed Origins.",
            "description": "A list of origins a cross-domain request can be executed from. Use `*` to allow any origin, or a wildcard such as `http://*.domain.com`.",
            "default": "*",
            "examples": ["https://*.myapp.com", "https://myapp.com"]
          }
        },
        "allowed_methods": {
          "type": "array",
          "items": {
            "type": "string",
            "title": "Allowed Methods.",
            "description": "A list of methods the client is allowed to use with cross-domain requests.",
            "examples": ["GET", "HEAD"]
          }
        },
        "allowed_headers": {
          "type": "array",
          "items": {
            "type": "string",
            "title": "Allowed Headers.",
            "description": "A list of headers the client is allowed to use with cross-domain requests. If the special `*` value is present in the list, all headers will be allowed.",
            "examples": ["Content-Type"]
          }
        },
        "exposed_headers": {
          "type": "array",
          "items": {
            "type": "string",
            "title": "Exposed Headers.",
            "description": "A list of headers which are safe to expose to the API of a CORS response.",
            "examples": ["Content-Type"]
          }
        },
        "max_age": {
          "type": "integer",
          "title": "Max Age.",
          "description": "A number indicating how long (in seconds) the results of a preflight request can be cached.",
          "default": 0
        },
        "allowed_credentials": {
          "type": "boolean",
          "title": "Allow Credentials.",
          "description": "A boolean indicating whether the request can include user credentials such as cookies, HTTP authentication or client side SSL certificates. Defaults to true.",
          "default": true
        }
      }
    },
    "inject": {
      "type": "object"
    },
    "redirects": {
      "type": "object"
    },
    "actions": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["name", "type"],
        "properties": {
          "name": {
            "type": "string",
            "title": "Action Name.",
            "description": "Name of the action for reference from alert definitions.",
            "examples": [
              "slack",
              "email.backend",
              "text.frontend",
              "text_frontend",
              "email.tj",
              "email tj",
              "Text backend team"
            ]
          },
          "type": {
            "type": "string",
            "title": "Action Type.",
            "description": "Type of action to perform.",
            "examples": ["email", "sms"]
          },
          "emails": {
            "type": "array",
            "items": {
              "type": "string",
              "title": "Email addresses.",
              "description": "Email addresses when using the email action.",
              "examples": ["tj@apex.sh"]
            }
          },
          "numbers": {
            "type": "array",
            "items": {
              "type": "string",
              "title": "Phone numbers.",
              "description": "Phone numbers when using the sms action.",
              "examples": ["+12508004123"]
            }
          }
        }
      }
    },
    "alerts": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["metric", "statistic", "threshold", "action"],
        "properties": {
          "metric": {
            "type": "string",
            "title": "Metric name.",
            "description": "Name of the metric.",
            "examples": ["http.count", "http.latency", "http.4xx", "http.5xx"]
          },
          "statistic": {
            "type": "string",
            "title": "Statistics name.",
            "description": "Name of statistic to perform.",
            "enum": ["min", "max", "avg", "sum", "count"],
            "examples": ["avg", "sum"]
          },
          "threshold": {
            "type": "integer",
            "title": "Value Threshold.",
            "description": "Threshold which is compared to the operator.",
            "default": 0
          },
          "action": {
            "type": "string",
            "title": "Action Name.",
            "description": "Name of the action to perform.",
            "examples": ["email.backend", "sms backend team"]
          },
          "period": {
            "type": ["integer", "string"],
            "title": "Period.",
            "description": "Period is the alert query time-span.",
            "default": "1m"
          },
          "evaluation_periods": {
            "type": "integer",
            "title": "Evaluation Periods.",
            "description": "Number of periods to evaluate over.",
            "default": 1
          },
          "operator": {
            "type": "string",
            "title": "Operator.",
            "description": "Operator is the comparison operator.",
            "default": ">",
            "enum": [">", "<", ">=", "<="]
          },
          "namespace": {
            "type": "string",
            "title": "Namespace.",
            "description": "Metric namespace.",
            "examples": ["AWS/ApiGateway"]
          },
          "description": {
            "type": "string",
            "title": "Description.",
            "description": "Informative alert description, displayed in the email, sms, or slack.",
            "examples": ["Huge traffic spike"]
          },
          "disable": {
            "type": "boolean",
            "title": "Disable.",
            "description": "Disable the alert.",
            "default": false
          }
        }
      }
    }
  },
  "required": ["name"],
  "title": "JSON schema for Apex Up configuration files",
  "type": "object"
}