---
title: Hosting the site on Netlify | Space Works Machines docs
description: Space Works Machines can run as one server (a VPS with the installer), or split : the public pages and dashboards render on Netlify, and every database…
url: https://spaceworkslabs.tech/docs/machines/deployment-netlify/
updated: 2026-10-29
---

[Space Works Machines](https://spaceworkslabs.tech/docs/machines/) Overview
- [Overview](https://spaceworkslabs.tech/docs/machines/overview/)
- [Email and chat notifications](https://spaceworkslabs.tech/docs/machines/notifications/)
Install and run
- [Deploying on a server (VPS)](https://spaceworkslabs.tech/docs/machines/deployment-vps/)
- [Deploying with managed services (cloud)](https://spaceworkslabs.tech/docs/machines/deployment-cloud/)
- [Hosting the site on Netlify](https://spaceworkslabs.tech/docs/machines/deployment-netlify/)
- [Configuration reference](https://spaceworkslabs.tech/docs/machines/configuration/)
Developers
- [Space Works Machines REST API and webhooks](https://spaceworkslabs.tech/docs/machines/api/)
[All docs](https://spaceworkslabs.tech/docs/)

Space Works Machines · Install and run

# Hosting the site on Netlify

Space Works Machines can run as one server (a VPS with the installer), or**split**: the public pages and dashboards render on Netlify, and every database, payment, email and background job runs on your backend server. This guide covers the split setup, which is how the public landing page is hosted.

## How the split works
- The`frontend/`workspace builds the same UI as the main app. Its`proxy.ts`forwards page data reads and Server Actions to the backend through a fixed allowlist (`frontend/catalog.json`), signed with a shared secret. No database URL or payment secret is ever set on Netlify.
- The landing page (`/`) needs no backend data, so it renders even while the backend is down. Sign-in,`/start`,`/spaces`, space pages, dashboards and accounts need the backend. The worker and beat run only next to the backend; Netlify runs no background work.

## 1. Run the backend

Install the backend on a VPS with the one-line installer ([DEPLOYMENT_VPS.md](https://spaceworkslabs.tech/docs/machines/deployment-vps/) ) and answer**Run the website on this server? 2) No, backend only**. It asks for the Netlify website's HTTPS origin, requires HTTPS for the backend's own domain, and writes to the install's`.env`:
- `DEPLOYMENT_MODE=backend`, so it serves only the API and Server Actions.
- `FRONTEND_GATEWAY_SECRET`: 64 random hex characters, also set on Netlify (copy it from`.env`).
- `PUBLIC_APP_BASE_URL`: the public site address (the Netlify domain or your own), which becomes`NEXT_PUBLIC_BASE_URL`and`AUTH_URL`.

In the cloud topology set the same three values in`cloud.env`([DEPLOYMENT_CLOUD.md](https://spaceworkslabs.tech/docs/machines/deployment-cloud/) ).

## 2. Create the Netlify site
- In Netlify, add a new site from the GitHub repository`SpaceWorks-Labs/SpaceWorks-Machines`.
- **Base directory:**leave empty (the repository root).**Package directory:** `frontend`.
- The build command and publish directory come from`frontend/netlify.toml`.
- Set these environment variables in the Netlify UI (Site configuration → Environment variables):

| Variable | Value |
| --- | --- |
| `BACKEND_ORIGIN` | Your backend's HTTPS origin, for example`https://api.example.org` |
| `NEXT_PUBLIC_BACKEND_ORIGIN` | The same value as`BACKEND_ORIGIN` |
| `NEXT_PUBLIC_BASE_URL` | The site's public address, for example`https://space-works-machines.netlify.app` |
| `FRONTEND_GATEWAY_SECRET` | The same secret as on the backend |
| `NEXT_SERVER_ACTIONS_ENCRYPTION_KEY` | A stable base64 key of 16, 24 or 32 bytes (`openssl rand -base64 32`) |
| `NEXT_PUBLIC_HOSTED_BY` | Optional footer credit, for example`Shaan Shoukath, Systems Engineer` |

`FRONTEND_TRUSTED_IP_HEADER`and the Node version are already set in`frontend/netlify.toml`.
- Deploy. Public`NEXT_PUBLIC_*`values are inlined at build time, so redeploy after changing them.

## 3. Check it
- `/`shows the landing page with "Hosted by …" in the footer when`NEXT_PUBLIC_HOSTED_BY`is set.
- `/login`signs in through the backend, by password or an emailed link (the link points at`NEXT_PUBLIC_BASE_URL`, so it opens on the website).
- `/start`submits an application, and the backend's outbox emails the applicant.

## The website as a container instead of Netlify

The same build is published as`ghcr.io/spaceworks-labs/spaceworks-machines-frontend`. Run it with the variables in the table above and`FRONTEND_TRUSTED_IP_HEADER=x-real-ip`behind a proxy that overwrites`X-Real-IP`; the public origins are applied when the container starts, so one image serves any domain.

## Hosting on one server instead

Answer**Run the website on this server? 1) Yes**in the installer (`DEPLOYMENT_MODE`stays unset) and point your domain at the VPS; the same app then serves the landing page, dashboards and API together.`NEXT_PUBLIC_HOSTED_BY`works the same way there.

For an existing split installation,`setup.sh`preserves its existing`.env`; rerunning the questionnaire does not change the layout. Set`DEPLOYMENT_MODE='monolith'`and`PUBLIC_APP_BASE_URL`to the website's new complete origin, including any nonstandard port. Set`SITE_ADDRESS`(or the existing reverse proxy's host) to that same hostname, retaining the matching HTTPS layer. Remove`FRONTEND_GATEWAY_SECRET`from the monolith's settings.`AUTH_URL`and`NEXT_PUBLIC_BASE_URL`are both derived from`PUBLIC_APP_BASE_URL`by Compose. Run`scripts/spaceworks-compose.sh bundled up -d`, then cut traffic over and retire the separate frontend. Keep the database, Redis, storage and encryption keys in place.

From[SpaceWorks-Machines/docs/DEPLOYMENT_NETLIFY.md](https://github.com/SpaceWorks-Labs/SpaceWorks-Machines/blob/b60fee1002f713b8c045e5eca202ac17565a11ab/docs/DEPLOYMENT_NETLIFY.md) at b60fee1, updated 2026-10-29.[Suggest a change](https://github.com/SpaceWorks-Labs/SpaceWorks-Machines/edit/main/docs/DEPLOYMENT_NETLIFY.md)  [PreviousDeploying with managed services (cloud)](https://spaceworkslabs.tech/docs/machines/deployment-cloud/) [NextConfiguration reference](https://spaceworkslabs.tech/docs/machines/configuration/)

On this page
- [How the split works](#how-the-split-works)
- [1. Run the backend](#1-run-the-backend)
- [2. Create the Netlify site](#2-create-the-netlify-site)
- [3. Check it](#3-check-it)
- [The website as a container instead of Netlify](#the-website-as-a-container-instead-of-netlify)
- [Hosting on one server instead](#hosting-on-one-server-instead)
