10 / 15 · Build & deploy

Build and deploy

Forma uses Next.js static export: output: 'export' in next.config.mjs. A successful build creates ready-to-host files in out/. The exported landing page needs a host that serves static files, not a running Next.js application server, database or CMS.

These instructions explain the build and upload model. Provider control-panel screens and optional hosting features vary; use your host's current static-site instructions for its upload, domain and HTTPS controls.

1. Finish content and production settings

Before building, replace the sample brand, logo, product/gallery media, testimonials, prices and product claims in both languages. Configure your pair, conversion destinations and both billing periods. Update each language's title/description, favicon and social image. Review the theme/language inventory, translated cookie copy and your own policy link. See Languages, SEO and Cookies. If collecting email, complete Email signup and Kit using your own provider account or receiver; the supplied preview collects nothing.

Set NEXT_PUBLIC_SITE_URL to the final public HTTPS website origin before the build, using a project-root .env.local or a host build variable:

NEXT_PUBLIC_SITE_URL=https://www.your-domain.example

Replace the example with your real URL. The build uses this origin for page metadata, the sitemap and robots.txt; a variable set in your terminal or host build settings takes priority over the file. See SEO and site settings for the exact metadata workflow. Do not upload .env.local; the public metadata is already embedded in the generated files.

The supplied static-export/ in the buyer bundle is a generic demonstration. Publishing your branded source requires a new build; changing source files does not update that supplied export.

2. Build and check locally

Use the documented Node/npm versions and run these commands in source/, the folder containing package.json. Dependencies must already be installed with npm ci.

npm run format
npm run check

format applies Prettier across the editable project under its ignore rules; review its changes. check validates language settings/content, generated documentation, formatting, lint, TypeScript, tests and build. Fix any failure before upload.

Expected result: all checks pass and out/index.html, both language directories (initially out/en/index.html and out/el/index.html), out/404.html, _next/, sitemap.xml and robots.txt exist. Set the final public origin before publishing these metadata files. The build copies LICENSE.txt, NOTICE.txt, THIRD-PARTY-NOTICES.txt and MANROPE-LICENSE.txt into out/; preserve them. npm run build can rebuild after checks pass; building alone does not review your links/content.

If you edited documentation Markdown, regenerate HTML first with npm run docs, then repeat the check. The guides' HTML is generated; edit its Markdown source rather than the HTML itself.

3. Preview the production output

Stop any development server in its own terminal with Ctrl+C, then run:

npm run start

Open http://127.0.0.1:3100. This serves the existing out/ folder on your local computer. It does not rebuild or automatically refresh edited source. Stop it with Ctrl+C when finished.

The preview negotiates gzip for supported text files when the browser accepts it and compression reduces their size; already compressed images, fonts and video keep their original bytes. GET and HEAD responses describe the same selected representation, while video byte ranges remain available. Keep scripts/serve.mjs with its imported response, media-range and security helpers when applying an update. This loopback server is still a local inspection tool, not a production hosting service.

The production preview loads the exported security manifest, checks each requested HTML document against its recorded digest and applies that document's generated Content Security Policy. A missing manifest or changed requested document fails this check. It serves the existing build, so it does not check newly edited source settings or the entire _headers file at startup; use npm run security:check for that broader comparison. Rebuild after changing source or security settings. This ordinary HTTP loopback preview intentionally sends no HSTS header; HTTPS transport behavior requires a separate test on the intended HTTPS host. See HSTS and Content Security Policy.

Complete the Launch checklist. Also open a nonexistent address such as http://127.0.0.1:3100/missing-page/: you should see the 404 page. Preview through HTTP rather than double-clicking out/index.html; exported application asset paths are designed for a web server.

Open both direct language URLs and refresh each. Test root default/remembered-language behaviour separately; a working root page alone does not prove language directories were uploaded correctly.

Expected result: the production page, CSS, JavaScript and bundled font load; themes and interactive controls work; intentional conversion links reach the intended destinations. The source has no unexpected console errors.

4A. Manual upload to static hosting

Use your host's file manager, static deployment tool or documented upload method:

  1. Choose the public document root for your intended domain or subdomain.
  2. Upload the contents of source/out/ directly into that public directory, preserving filenames and subdirectories, including _next/.
  3. Ensure index.html is at the website root. Do not put it one unnecessary out/ directory below that root.
  4. Configure directory URLs to serve their index.html file. Use 404.html for missing URLs with an HTTP 404 status where the host supports this.
  5. Follow the host's instructions to connect your domain and enable HTTPS.
  6. Verify the published page and assets before directing visitors to it.

Preserve both language directories. If changing language codes, publish a complete clean export so an old directory is not accidentally left public. Arrange any old-to-new redirects using your host's existing configuration; Forma does not install host-level redirects. Directory-index serving is enough for the configured language pages—no backend language router is required.

Do not upload the source, node_modules/, .next/, .env.local or documentation as the website. The build includes the template licence, publisher notice and full runtime/font notices in out/ automatically; preserve them when uploading the complete export. The buyer bundle's static-export/ includes the same legal files. Packaging checks they match the canonical files and asks you to rebuild if they are missing or stale.

This guide assumes hosting at a domain or subdomain root, such as https://product.example/. Deployment under /some-folder/ requires base-path and asset-path configuration and separate testing; copying the default export into a subdirectory is not equivalent.

4B. Hosting with repository-based builds

For a provider that builds your source from a repository, use the following settings:

SettingValue
Project rootThe folder containing package.json; use source if committing the whole buyer bundle.
Install commandnpm ci
Build commandnpm run build
Publish/output directoryout relative to the project root
Node.jsA version compatible with package.json; Node.js 24 is recommended.
Public build variableNEXT_PUBLIC_SITE_URL with the final HTTPS origin

Select the host's static/export mode. A Next.js preset that assumes a server application may need explicit adjustment to publish out/. The template does not provide an account, hosting plan or provider-specific deployment automation.

Your repository needs source, assets, manifests, lockfile, build helper and project configuration. Omit dependencies, caches and private environment files. Retain third-party notices with the final published output.

Existing VPS or web hosting

A VPS can serve these same static files using its existing web server or reverse-proxy/static-hosting arrangement. No particular server product is required by Forma. Uploading out/ is separate from administering a server's domains, TLS, permissions or routing; follow that server's established configuration.

The included preview server deliberately listens on 127.0.0.1 and is for local inspection. Do not expose it as your production hosting service. Docker, database provisioning and operating-system configuration are unnecessary for the template's local buyer workflow or static output.

Check compression and caching on your actual static host/CDN separately. Verify that HTML, CSS and JavaScript use negotiated gzip or Brotli where supported, and that the host preserves correct media types and video ranges. Keep HTML able to refresh after deployments; long-lived immutable caching is suitable for fingerprinted assets such as /_next/static/ files. A successful local preview does not configure your host's headers, HTTPS or caching, and its speed is not a guarantee of live delivery speed.

HSTS and Content Security Policy

These protections are delivered as HTTP response headers. HSTS helps browsers keep using HTTPS; Content Security Policy (CSP) tells the browser which code and resource sources a page may use. A static export cannot make every hosting provider apply them automatically. Configure the server or CDN that actually serves the website, then inspect its responses. No server, certificate, account change or deployment is performed by the build.

The editable settings are in src/config/security.ts. The default HSTS configuration is enabled with maxAgeSeconds: 2592000 (30 days), includeSubDomains: false and no preload. HSTS tells a browser that has received this header over a valid HTTPS connection to keep using HTTPS for that host during the stated period. It does not install HTTPS, replace an HTTP-to-HTTPS redirect or protect a first visit that has never learned the policy. Confirm a reliable certificate and HTTPS service before enabling it on a real host. Include subdomains only after checking that every affected subdomain can support HTTPS; preload is not part of the supplied workflow. Do not add HSTS to ordinary HTTP localhost preview responses.

Setting hsts.enabled: false omits the generated header; it does not erase a policy a browser already remembers. To retire this host's previously sent policy deliberately, keep HTTPS working and serve maxAgeSeconds: 0 with HSTS enabled, then verify the real response. An inherited parent-domain or preload policy needs its own separate review.

Every successful npm run build creates two matching artifacts in out/:

ArtifactPurpose
forma-security.jsonRecords each exported HTML document's digest, inline-script SHA-256 hashes, generated CSP and production headers. The local production preview uses this manifest. It contains public policy metadata, not credentials.
_headersSupplies a static-host header recipe using the union of this build's inline-script hashes. A host must explicitly support this file format; otherwise translate the generated values into that host's response-header configuration.

The local preview applies a document-specific hash list. The _headers recipe permits the hashes needed across the complete export so it can use one policy for the static host. Neither uses a per-request nonce or requires dynamic Next.js rendering. HTML is not rewritten to add nonces, and the template remains a static export.

The CSP permits same-origin scripts and the hashes of the inline scripts present at build time. It blocks inline event-handler attributes and does not use script unsafe-inline or unsafe-eval. Inline styles remain permitted for React rendering, configurable colors, player behavior and optional Kit output. Images and media use local sources plus the exact external origins derived from configured assets; there is no blanket HTTPS permission. Supported image data/blob sources and media blob sources remain allowed. Workers and plugins are blocked. This is hardening, not a claim that an allowed third-party script is sandboxed. COOP and Trusted Types enforcement are not included in this update.

The generator reads the configured collection modes. With both newsletter and demo access in preview, it adds no external Kit destinations. An enabled Kit mode adds the supported provider handler and Form origins; a configured endpoint adds its receiving origin to form-action. Path-limited Google reCAPTCHA permissions are included for the standard Kit embed, or when an enabled native Form's copied reCAPTCHA setting is true. Custom Kit fonts, analytics and other added services are not enabled automatically; review their actual destinations and add the necessary origins deliberately. These permissions do not initialize Kit, submit a form, grant marketing consent or approve the advanced adapter's production use. Keep the Kit approval and consent boundaries intact.

Configured external image and media URLs contribute their exact origins automatically, including dark image variants, testimonial avatars, video posters and caption files. Keep those settings correct and rebuild after replacing them. An image or video introduced elsewhere in custom code needs its own policy review.

For an additional reviewed service, use the additionalSources arrays in security.ts: script, connect, frame, style, font, form, image and media. For example, a service's required connection origin belongs in connect: ['https://forms.your-provider.example'], replacing that example with the real origin and preserving other entries. Production entries must be exact HTTPS origins rather than paths, wildcard hosts or script snippets. HTTP loopback origins are accepted for local testing only, not for a production receiver. Add only destinations observed in the service's actual resource behavior. Do not put API keys, form secrets or private URLs in the policy. A normal link to an external page does not by itself require that destination in script or connect sources.

After configuring the site and integrations:

npm run build
npm run security:check
npm run start

security:check compares the exported HTML and current integration/security settings with the manifest and _headers; it catches stale policy artifacts after a settings change. It does not change hosting settings or prove an external provider journey works. Do not edit out/, its HTML, _headers or the manifest by hand. Content changes, script changes and added HTML documents require regeneration from source. A CDN that injects or rewrites script content can invalidate hashes; configure that transformation deliberately rather than weakening the script policy.

On a host supporting _headers, publish the complete export and verify that the file is interpreted as configuration. On another host, apply the generated production headers through its own server/CDN controls. Do not assume placing _headers or the JSON file in the document root is enough. Publish the HTML, assets and policy from the same build together. Avoid adding a second unrelated CSP: browsers enforce multiple policies together, so an older extra policy can still block a destination allowed by the new one.

Check the actual Content-Security-Policy header on both language pages, the root entry and the missing-page response. On HTTPS, also check Strict-Transport-Security and the intended max age. Then test themes, language selection, preference allow/decline/withdrawal, menus, both forms, video controls/captions and any active provider verification/fallback. Inspect the browser console for CSP violations. A clean local test proves local behavior only; complete the HTTPS/header and performance checks on the actual host before claiming production acceptance.

What works after static deployment

The two static language pages, language switcher, themes, cookie controls, menu, video player or alternative image gallery, testimonials, pricing switch, FAQ and demo-access/signup dialog work after export. The themed video bar enhances the browser's video element; native controls provide a fallback without JavaScript and after playback failure. No streaming or video backend is required. The default Get started scenario validates name/email locally, reveals a demo confirmation and links to the configured destination without sending or saving the fields; it is not authentication. Newsletter placement can be a page section or a separate newsletter popup opened by exact #newsletter actions. { kind: 'demo' } stays demo access; its optional demoAccess.mode: 'kit' adds consented mailing-list signup without protecting the demo URL. The popups require JavaScript but no Forma server. Normal conversion links need real destinations. Optional theme/language memory needs valid permission; switching remains available after decline. Each language navigation loads fresh transient interface state.

Upload your configured video, poster and any WebVTT track with the complete export. Verify their direct URLs return the actual files with appropriate types, such as video/webm, video/mp4 and text/vtt; a missing-file HTML response cannot play as video. Forma's local production preview supplies these media types. Playback capabilities depend on the browser and chosen codec; test your actual files on the production host. preload="none" defers requested video loading, while the poster is still an image to optimize. Fullscreen requires browser permission/support, and embedded previews can restrict it; in-page playback must remain usable.

Use a static host that supports HTTP byte-range requests for video files, as well as the correct media types. Byte ranges let the browser request part of a clip for reliable seeking and metadata retrieval rather than waiting for a complete download. For a valid partial request, the host should return 206 Partial Content with Content-Range; range support is advertised with Accept-Ranges: bytes. Forma's supplied npm run start helper supports these requests for local production review. This does not require a new production Node.js server: your existing static hosting/CDN must serve the exported media correctly. Check the actual published video response and seek behavior; a working first Play does not prove seeking works.

Newsletter preview collects nothing. Embedded kit mode loads provider code at section mount or first popup opening by default; kitLoad: 'interaction' waits for a loading choice. Native newsletter and demo-access Kit signup load the handler only after a valid, consented submission. Both need the actual provider script, connection and verification destinations allowed by the host's content-security policy; endpoint mode needs a separately hosted working receiver for its normal HTML POST. Review any content-security policy for those actual destinations. No authentication, real billing, transactional email service, consent database or persistent customer backend is included. Adding a server API or CMS to this project can change hosting requirements; static export does not run backend handlers.

The font is served locally. Server image optimization is disabled for static export, so optimize any new image assets before building.

Verify the live website

  • Confirm HTTPS and that the site opens at the intended domain or subdomain root.
  • Check CSS, JavaScript, images and fonts return successfully, including _next/ paths.
  • Check the configured video, poster and caption track URLs and media response types. Verify video byte-range responses and test Play/Pause, seeking, replay, sound, captions and supported fullscreen on desktop/phone browsers. Also test image-gallery mode if you selected it.
  • Check desktop/mobile navigation, each CTA, monthly/yearly destinations, FAQ and themes.
  • Open and refresh both direct language URLs; check switcher labels, translations, direction, root default and allowed remembered-language behaviour.
  • Test preference allow/decline, footer withdrawal, reload behaviour and your privacy-policy destination over HTTPS.
  • Inspect the page source for your real title, description, language, canonical and social-image URLs.
  • Verify both language alternates and the generated sitemap against the actual public URLs.
  • Open the favicon and social image directly; check a missing page returns the intended 404.
  • Confirm accurate testimonials, prices and product claims; remove all unrelated sample content.
  • Test the complete newsletter journey, consent choice, confirmation, provider failure/fallback and unsubscribe if enabled. Test checkout destinations and actual charges separately from displayed sample pricing.
  • Retain the working source, lockfile and a copy of the deployed export for rollback.

After further source, asset or environment changes, rebuild and upload the resulting complete export again. See Troubleshooting if the live page differs from the local production preview.