Home Documentation Templates Examples Showcase GitHub
Theme

Platform target

Netlify

Netlify can deploy Nift's normal public/ tree. The target keeps that standard output layout and creates the project-level build configuration Netlify understands.

Create and build

nift init --target=netlify
nift build --all
nift status

Commit authored source, templates, .nift/ project configuration and netlify.toml. Whether generated public/ is committed is a repository policy; Netlify only needs it as the publish artifact produced by the build.

What Nift creates

[build]
  command = "nift build"
  publish = "public"

netlify.toml is user-owned after initialization. File-based configuration overrides conflicting UI build settings, so treat the committed file as the source of truth if you adopt it.

Make Nift available to the build

The generated command assumes nift is on the build image's PATH. Choose a reproducible installation policy: pin a release archive/checksum in a repository script, use an approved package channel, or build the reviewed Nift source. Do not rely silently on whichever “latest” version happens to exist when the deploy runs.

[build]
  command = "./scripts/install-nift 4.0.7 && nift build --all"
  publish = "public"

The example names a project-owned installer contract; implement it according to your repository's trust and platform policy. Confirm the build log reports the intended nift version.

Deploy Preview and production flow

  1. Connect the Git repository and let Netlify read netlify.toml.
  2. Open a pull request and inspect its Deploy Preview, including nested links and generated assets.
  3. Verify the log used the pinned Nift version and published public/.
  4. Merge through the branch configured for production deployment.
  5. Fresh-load the production URL and inspect response headers for HTML and hashed assets.

Redirects, rewrites and proxies

Define routing in netlify.toml or a published _redirects file. A rewrite can proxy an API while the Nift site remains static:

[[redirects]]
  from = "/api/*"
  to = "https://api.example.com/:splat"
  status = 200

[[redirects]]
  from = "/old-docs/*"
  to = "/docs/:splat"
  status = 301

Do not add an SPA catch-all to an ordinary multi-page Nift site: it can conceal missing files and turn useful 404s into the wrong page. Add one only when a client router genuinely owns that route space.

Headers and caching

[[headers]]
  for = "/*.html"
  [headers.values]
    Cache-Control = "public, max-age=0, must-revalidate"

[[headers]]
  for = "/assets/*"
  [headers.values]
    Cache-Control = "public, max-age=31536000, immutable"
    X-Content-Type-Options = "nosniff"

Use long immutable caching only for filenames that change with their content. Stable names such as app.js need revalidation or a shorter lifetime. Add security headers deliberately and test the composed application; a strict Content Security Policy can break inline scripts or third-party resources.

Functions and Edge Functions

Netlify Functions normally live under netlify/functions, and Edge Functions under netlify/edge-functions. They sit beside the publish directory. Nift builds the frontend files; the Netlify runtimes own requests, secrets and server-side behavior.

Custom domains and HTTPS

Add the domain through Netlify's domain management, apply the DNS records it provides, choose the canonical apex/www behavior, and wait for DNS and certificate provisioning. If HTTPS remains pending, inspect stale DNS records and TTL propagation before changing application code.

Troubleshooting

SymptomCheck
nift: command not foundThe build-image installation step and resulting PATH; print nift version before building.
Deploy succeeds but site is emptypublish = "public", repository base directory and whether Nift actually generated files there.
Nested page/assets 404Use @path for project-local links and inspect accidental absolute-root URLs.
Every unknown URL shows the homepageRemove an inappropriate SPA rewrite.
Old JavaScript persistsCache policy versus filename strategy; do not mark stable filenames immutable.
Custom domain/certificate pendingDNS target, conflicting records and TTL propagation.

Official references: file-based configuration, routing, headers, and domains.

Next platformAWS Amplify →