Install a self-hosted Strukt service
A self-hosted installation serves administration and hosted websites on separate listeners. Build on a machine with Bun and Node 22; the compiled server embeds its client and documentation assets. Use a private persistent directory and independent random secrets for every installation.
Before you start
Section titled “Before you start”- Prepare two DNS namespaces: for example
admin.example.comand hosted basesites.example.net. The admin hostname must be outside the hosted base namespace. Start with SQLite unless you have planned PostgreSQL operations.
-
Build from the reviewed release:
Terminal window bun install --frozen-lockfilebun run build:cmsbun run build:binBuild CMS before the binary so the embedded admin and docs are current. Run the repository’s release checks before distributing artifacts.
-
Create an operator-owned private environment file with STRUKT_ORIGIN, STRUKT_PUBLIC_ORIGIN, STRUKT_DATA_DIR, a random STRUKT_SETUP_CODE, STRUKT_ANALYTICS_SALT of at least 32 characters and STRUKT_SECRET_KEY containing exactly 32 random bytes encoded as base64. Follow the environment reference for complete examples; do not reuse development secrets.
-
Create a restricted persistent data directory and run the binary as an unprivileged service using that environment. Default internal listeners are loopback ports 3000 and 3100. Route the configured HTTPS admin host to the first listener and registered hosted subdomains to the second, preserving Host.
-
Complete first-account setup at the configured admin origin using the setup code. Remove/disable first-setup enrollment after success and keep general registration closed unless intentionally configured. Create a synthetic site and verify save, publication and anonymous hosted routing.
-
Configure optional audit/iii, custom-domain provisioning, account SMTP and payment services only when needed. Verify each actual worker and transport outcome separately; a healthy core service does not prove those integrations work.
Check the result
Section titled “Check the result”- Correct Hosts serve admin/public content, unknown Hosts are rejected, state survives restart and the docs load at
/docs/and/docs/id/.
Troubleshooting
Section titled “Troubleshooting”Startup rejects missing or malformed required values. Fix the reported setting rather than copying production credentials. If public pages fail while admin works, inspect the second listener, wildcard DNS/TLS, Host forwarding and active publication.
Related guides
Section titled “Related guides”- Environment variable reference
- SQLite and PostgreSQL operations
- Workers, reverse proxy and health checks
- Back up, upgrade and restore safely
Applies to Strukt c02552848c92 · 2026-10-31