Skip to main content

Static files scope

The Static files scope lets you deploy single-page apps (SPAs), static websites, and front-end bundles directly from nullplatform. It provisions a CDN distribution, configures DNS and HTTPS, and manages deployments using OpenTofu.

When to use it

Use the Static files scope when your application only ships static file assets (HTML, CSS, JS, images), doesn't need a server-side runtime, and needs to be distributed through public custom domains.

Supported cloud providers

The Static files scope works with the following cloud providers:

Cloud providerCDN / DistributionDNSStorage
AWSCloudFrontRoute 53S3
AzureAzure CDNAzure DNSBlob Storage

You can add support for other cloud providers. See Extend the scope for details.

What gets provisioned

When you deploy a Static files scope, nullplatform provisions and manages the following infrastructure:

AWS (CloudFront + Route 53)

  • CloudFront distribution with HTTPS, gzip compression, and SPA-friendly error handling (404/403 → index.html)
  • S3 bucket policy for secure CloudFront-only access via Origin Access Control (OAC)
  • Route 53 DNS record (A alias) pointing your custom domain to the distribution
  • Automatic cache invalidation on each deployment

Azure (Azure CDN + Azure DNS)

  • Azure CDN profile and endpoint serving content from Blob Storage, with SPA routing, HTTPS redirect, and cache rules
  • Azure DNS CNAME record pointing your custom domain to the CDN endpoint
  • CDN-managed HTTPS certificate for custom domains (TLS 1.2)
  • Blob Storage path-based origin for asset isolation

How it works

When you trigger a deployment, the scope runs through the following steps using OpenTofu:

  1. Nullplatform resolves your DNS zone and computes the subdomain ({app-slug}-{scope-slug}.{domain}).
  2. The scope provisions a CDN distribution pointed at your assets in storage and creates a bucket policy for secure access.
  3. OpenTofu applies the infrastructure changes (tofu init + tofu apply).
  4. DNS is updated and traffic starts flowing to the new release.

Deployment strategies

  • Initial deployment: provisions all infrastructure from scratch (CDN, DNS, bucket policy) and points the distribution to the release's asset path in your storage bucket.

  • Blue-green deployment: reuses the initial deployment setup. Since Static files are immutable and stored at versioned paths in the bucket, each deployment updates the CDN origin path to point to the new release.

Switching traffic is not supported

The switch traffic step is not supported for Static files. Traffic switches instantly when the CDN origin path is updated. To roll back, trigger a new deployment pointing to the previous release.

Custom domains

Nullplatform configures custom domains automatically:

  • AWS: the scope reads the hosted_public_zone_id from your cloud-provider configuration, resolves the domain from Route 53, and creates an alias record. If a wildcard ACM certificate exists for the domain, HTTPS is enabled automatically.

  • Azure: the scope reads public_dns_zone_name and public_dns_zone_resource_group_name from your cloud-provider configuration, verifies the DNS zone exists, and creates a CNAME record pointing to the Azure CDN endpoint.

The subdomain follows the pattern {application-slug}-{scope-slug}, resulting in URLs like my-app-production.example.com.

Lifecycle actions

ActionDescription
start-initialProvisions all infrastructure (CDN, DNS, bucket policy) for the first deployment
start-blue-greenUpdates the CDN origin path to point to the new release
delete-deploymentDestroys all provisioned infrastructure

Next steps