Celerity
Design Notes

Celerity Gateway

Celerity resource type for a shared ingress entry point that several applications attach their routes to

celerity/gateway

Spec Version: v2026-02-27-draft
Ecosystem Compatibility: Vision

blueprint transform: celerity-2026-02-27-draft

Ecosystem Compatibility

  • Vision: A shared ingress entry point on Amazon ECS and AWS Lambda, Google Cloud and Azure, owned by a platform project or an application and used by several applications.

Read more about Celerity versions here.

Design note

celerity/gateway is part of the vision and is not available yet. This page sets out the current design, which is not committed and may change before it is built. It is one of the platform primitives, which share the modes, ownership and access rules described there.

The celerity/gateway resource type defines a shared ingress entry point that several applications attach their routes to. The gateway owns the listener, the TLS certificates, the ingress allowlist and the response for requests that no application matches. Applications attach routes derived from their existing domain configuration.

A gateway names a capability rather than a product. It would be an Application Load Balancer on Amazon ECS, an API Gateway custom domain on AWS Lambda, a global external Application Load Balancer on Google Cloud and an Application Gateway on Azure. Where a capability has no sensible equivalent on a target, the specification says so rather than approximating it.

Without a gateway, nothing changes: an API deployed to Amazon ECS keeps its own load balancer, which is in effect a private gateway of its own.

Specification

The specification is the structure of the resource definition that comes under the spec field of the resource in a blueprint.

name (required)

The name of the gateway, used to find it from other applications in referenced mode and to tag the resources it creates. It must be unique per account and region.

type

string

mode

Whether this blueprint provisions the gateway (managed), uses one owned by another Celerity project (referenced), or uses one created outside Celerity (external). See managed, referenced and external modes.

In referenced mode only name is accepted. In external mode only name and external are accepted.

allowed values

managed | referenced | external

default value

managed

type

string

visibility

Whether the gateway accepts traffic from the internet (public) or only from inside the network (internal). An internal gateway is placed in the network's private subnets.

Only used in managed mode.

allowed values

public | internal

default value

public

type

string

tls

The certificates the gateway serves and its minimum TLS policy.

Only used in managed mode.

type

tlsConfiguration

ingress

Who may connect to the gateway. By default, anyone can connect.

Only used in managed mode.

type

ingressConfiguration

defaultResponse

The response for requests that no attached application matches.

Only used in managed mode.

type

defaultResponseConfiguration

default value

A 404 status with an empty body.

redirectHttp

Whether plain HTTP requests are redirected to HTTPS.

Only used in managed mode.

type

boolean

default value

true

external

Target-specific identifiers for a gateway created outside Celerity. They are declared because they can't be reliably inferred.

Required in external mode and rejected in the other modes.

type

externalGatewayConfiguration

Annotations

celerity/gateway 🔗 celerity/api

The following annotation applies to a celerity/api linked to a gateway. The same annotation would apply to a celerity/website as celerity.website.gateway.priority.

celerity.api.gateway.priority

Overrides where the API's routing rules are placed among the rules of every application attached to the gateway. It is only needed in the rare case that the default ordering, described in rule ordering, gets it wrong.

type

integer

Outputs

id

The ID of the gateway: the load balancer ARN on Amazon ECS, or the first custom domain name on AWS Lambda.

type

string

dnsName

The hostname to point DNS at, such as the CNAME target for any DNS provider. On AWS Lambda there is one per domain, exposed as dnsNames.

type

string

Data Types

tlsConfiguration

FIELDS

certificateIds

The certificates the gateway serves, selected by SNI. On AWS, these are ACM certificate ARNs. They are typically wildcard certificates, supplied as variables.

Certificates are referenced, not created. This avoids a DNS validation step that Celerity can't complete when DNS is hosted elsewhere.

field type

array[string]

securityPolicy

The minimum TLS version and cipher set.

field type

string

allowed values

TLS_1_2 | TLS_1_3

default value

TLS_1_2


ingressConfiguration

FIELDS

allowedCidrs

The IPv4 and IPv6 ranges allowed to connect. When omitted, anyone can connect.

field type

array[string]


defaultResponseConfiguration

FIELDS

status

The status code of the response.

field type

integer

default value

404

contentType

The content type of the response.

field type

string

default value

text/plain

body

The response body. Size limits depend on the target environment; an Application Load Balancer allows 1 KB in a fixed response.

field type

string

default value

Empty.


externalGatewayConfiguration

FIELDS

listenerId

The ARN of the HTTPS listener. Required on Amazon ECS.

field type

string

securityGroupIds

The load balancer's security groups, so that attaching applications can allow traffic from the gateway into their services. Required on Amazon ECS.

field type

array[string]

domainNames

Existing API Gateway custom domain names. Required on AWS Lambda.

field type

array[string]


Linked From

celerity/vpc

When a VPC links to a gateway in managed mode, the VPC places the gateway's load balancer: in its public subnets, or its private subnets for an internal gateway.

celerity/api

When a gateway links to a celerity/api, the API's HTTP and WebSocket routes are attached to the gateway:

  • Routing is derived from domain. domainName becomes a host condition, and each entry in basePaths other than / becomes a path condition. There are no new routing fields.
  • domain.certificateId becomes optional. If the gateway's certificates cover domainName, no certificate is attached. If the API supplies its own certificateId, it is added to the gateway's listener as an additional SNI certificate, owned and removed by the API's application. Validation fails if neither covers the domain.
  • The API does not provision its own load balancer.
  • Load balancer annotations are rejected. Annotations that configure a per-application load balancer, such as celerity.api.vpc.lbSubnetType, are rejected on an API linked to a gateway, since the gateway's owner decides its placement.
  • The network has to match. On Amazon ECS, the gateway and the attaching service must be in the same VPC, so an application attaching to a referenced gateway normally also references the gateway owner's celerity/vpc. A mismatch fails validation when changes are staged.

celerity/website

When a gateway links to a celerity/website with mode: server, the website's routes are attached in the same way as an API's. Websites with mode: static are served by their own CDN and can't attach to a gateway.

Rule Ordering

Several independently deployed applications attach rules to one listener, so no single application can decide the order of the rules. On an Application Load Balancer, every rule needs a unique priority on the listener.

Rules would be ordered as follows:

  1. By specificity. Rules with both host and path conditions come before host-only rules, which come before path-only rules. Within each group, a longer path pattern comes first. This reproduces what people write by hand, with an API's host-and-path rule ahead of a website's host-only rule on the same hostname.
  2. Stably within a group. A rule's place within its group comes from a hash of the application name, domainName and base path, moving to the next free place if that one is taken.
  3. By explicit override, with the celerity.api.gateway.priority annotation, for the rare case where the default order is wrong.

Two applications claiming the same host and path is an error when they are deployed, naming both applications. One never silently shadows the other.

Other targets use ordered rule lists, such as URL maps on Google Cloud and path-based rules on Azure, where the same ordering by specificity applies.

Target Environments

Local Development

🧭 Vision

Locally, the gateway would be the local reverse proxy. Under lo1, it is the Caddy proxy that already fronts a multi-project workspace with real hostnames and TLS, and the Celerity plugin for lo1 would derive the host and path routes from each project's attached components.

Under celerity dev run, which runs a single application, a gateway link is ignored and the application is served directly. ingress and defaultResponse are not emulated locally.

AWS

🧭 Vision

On Amazon ECS, the gateway's owner and each attaching application would create the following:

Gateway (owner)Attachment (each application)
An Application Load Balancer in the VPC's public subnets, or private subnets for an internal gatewayA target group for the application's ECS service, with a health check on /runtime/health/check
An HTTPS listener with tls.certificateIds (by SNI) and tls.securityPolicy, whose default action comes from defaultResponseA listener rule with host and path conditions, at the priority from rule ordering
An HTTP listener redirecting to HTTPS, when redirectHttp is trueA listener certificate, when the application supplies its own certificateId
A security group allowing ports 443 and 80 from ingress.allowedCidrsA security group rule allowing traffic from the gateway's security group into the service's security group
A celerity:gateway:name tag on the load balancer and listener

Validation would check against the default AWS quotas of 100 rules and 25 certificates per listener.

Listener rules have historically forwarded paths unchanged, so base paths that need to be stripped, as described for celerity/api domains, would need either ALB URL rewrite transforms, if they are available, or the runtime's router handling the prefix.

AWS Serverless

🧭 Vision

API Gateway has no listener that unrelated APIs can attach rules to. The closest equivalent is a custom domain name with API mappings.

Gateway (owner)Attachment (each application)
One API Gateway custom domain name per hostname the gateway serves, with its certificateAn API mapping from the API's stage to the domain, keyed by base path
A celerity:gateway:name tag

This mapping has consequences:

  • A serverless gateway routes by base path only, within one hostname. Hostnames belong to the gateway, so the domainName of an attaching API must match one of them. A managed serverless gateway would therefore need its hostnames declared, with a domainNames field on this target or derived from its certificates.
  • ingress.allowedCidrs is not supported, since HTTP APIs have neither resource policies nor WAF. Setting it on a gateway deployed with aws-serverless is a validation error rather than something silently ignored.
  • defaultResponse is not supported. Unmapped base paths return API Gateway's own 404.

Google Cloud

🧭 Vision

On Google Cloud, the gateway would be a global external Application Load Balancer: a forwarding rule, a target HTTPS proxy, SSL certificates and a URL map owned by the gateway, with a Cloud Armor policy for ingress. Each application attaches a host rule, a path matcher and a backend service, using a serverless network endpoint group for Cloud Run or a network endpoint group for GKE.

A URL map is a single resource, so attaching applications have to modify a shared resource rather than create their own. This needs a provider resource that patches part of the URL map, unlike AWS, where listener rules are independent resources.

Azure

🧭 Vision

On Azure, the gateway would be an Application Gateway, with a listener per hostname, certificates, and a network security group or WAF policy for ingress. Each application attaches a routing rule and a backend pool. As on Google Cloud, the rules live inside the Application Gateway resource, so attaching is a patch to a shared resource.

Last updated on