Skip to content

Beautiful Open-Source Form Builder

Add a dedicated self-hosted welcome page and marketing redirects (#1361)

Julien Nahum4650dc835ead
diff --git a/client/components/global/Navbar.vue b/client/components/global/Navbar.vue
index 956618c6b..0dc5c4ec8 100644
--- a/client/components/global/Navbar.vue
+++ b/client/components/global/Navbar.vue
@@ -7,10 +7,10 @@
:to="{ name: user ? 'home' : 'index' }"
class="shrink-0 font-semibold hover:no-underline flex items-center"
>
- <img src="/img/logo.svg" alt="notion tools logo" class="w-6 h-6" />
+ <img :src="isSelfHosted ? instanceLogoUrl : '/img/logo.svg'" :alt="isSelfHosted ? instanceName : 'OpnForm'" class="w-6 h-6 object-contain" />
<span
- class="ml-2 text-md hidden sm:inline text-gray-950 dark:text-white"
- >OpnForm</span
+ class="ml-2 max-w-48 truncate text-md hidden sm:inline text-gray-950 dark:text-white"
+ >{{ isSelfHosted ? instanceName : 'OpnForm' }}</span
>
</NuxtLink>
<WorkspaceDropdown class="ml-6">
@@ -30,7 +30,10 @@
</template>
</WorkspaceDropdown>
</div>
- <div class="hidden md:flex items-center gap-x-1 lg:gap-x-2 ml-auto">
+ <NuxtLink v-if="isSelfHosted" :to="{ name: 'templates' }" :class="navLinkClasses" class="ml-auto !w-auto">
+ Templates
+ </NuxtLink>
+ <div class="hidden md:flex items-center gap-x-1 lg:gap-x-2" :class="{ 'ml-auto': !isSelfHosted }">
<NuxtLink
v-if="user"
:to="{ name: 'home' }"
@@ -40,7 +43,7 @@
My Forms
</NuxtLink>
<NuxtLink
- v-if="$route.name !== 'enterprise'"
+ v-if="!isSelfHosted && $route.name !== 'enterprise'"
:to="{ name: 'enterprise' }"
:class="navLinkClasses"
class="hidden lg:block"
@@ -48,7 +51,7 @@
Enterprise
</NuxtLink>
<NuxtLink
- v-if="$route.name !== 'integrations'"
+ v-if="!isSelfHosted && $route.name !== 'integrations'"
:to="{ name: 'integrations' }"
:class="navLinkClasses"
class="hidden md:block"
@@ -188,6 +191,7 @@ const { current: workspace } = useCurrentWorkspace()
const { data: user } = useAuth().user()
const isIframe = useIsIframe()
const isSelfHosted = computed(() => useFeatureFlag("self_hosted"))
+const { name: instanceName, logoUrl: instanceLogoUrl } = useSelfHostedPresentation()
const { workspaceIsPaid } = useBillingUpsell()
const route = useRoute()
@@ -209,6 +213,7 @@ const navLinkClasses =
const hasNavbar = computed(() => {
if (isIframe.value) return false
+ if (isSelfHosted.value && route.name === 'index') return false
if (route.name && route.name === "forms-slug") {
if (form.value || import.meta.server) {
diff --git a/client/components/pages/OpenFormFooter.vue b/client/components/pages/OpenFormFooter.vue
index 95c0c59a2..cefb74a34 100644
--- a/client/components/pages/OpenFormFooter.vue
+++ b/client/components/pages/OpenFormFooter.vue
@@ -1,4 +1,6 @@
<template>
+ <SelfHostedFooter v-if="isSelfHosted" />
+ <template v-else>
<section v-if="showCta" class="relative px-8 lg:px-12">
<div class="max-w-336 mx-auto">
<div
@@ -256,6 +258,7 @@
</div>
</div>
</footer>
+ </template>
</template>
<script setup>
@@ -269,6 +272,7 @@ defineProps({
})
const { isAuthenticated: authenticated } = useIsAuthenticated()
+const isSelfHosted = computed(() => !!useFeatureFlag('self_hosted'))
const { data: user } = useAuth().user()
const currYear = ref(new Date().getFullYear())
diff --git a/client/components/pages/SelfHostedFooter.vue b/client/components/pages/SelfHostedFooter.vue
new file mode 100644
index 000000000..bf911babb
--- /dev/null
+++ b/client/components/pages/SelfHostedFooter.vue
@@ -0,0 +1,20 @@
+<template>
+ <footer class="mx-auto flex w-full max-w-5xl flex-col items-center justify-between gap-4 px-6 py-8 text-sm text-muted sm:flex-row">
+ <a :href="cloudUrl" target="_blank" rel="noopener noreferrer" class="inline-flex items-center gap-2 hover:text-highlighted">
+ <img src="/img/logo.svg" alt="" class="size-4" />
+ Powered by OpnForm
+ <UIcon name="i-heroicons-arrow-up-right" class="size-3.5" />
+ </a>
+ <nav aria-label="Instance resources" class="flex flex-wrap justify-center gap-x-5 gap-y-2">
+ <a href="https://docs.opnform.com" target="_blank" rel="noopener noreferrer" class="hover:text-highlighted">Documentation</a>
+ <a href="https://github.com/OpnForm/OpnForm" target="_blank" rel="noopener noreferrer" class="hover:text-highlighted">GitHub</a>
+ <a v-if="privacyPolicyUrl" :href="privacyPolicyUrl" class="hover:text-highlighted">Privacy policy</a>
+ <a v-if="termsUrl" :href="termsUrl" class="hover:text-highlighted">Terms</a>
+ </nav>
+ </footer>
+</template>
+
+<script setup>
+const { privacyPolicyUrl, termsUrl } = useSelfHostedPresentation()
+const cloudUrl = 'https://opnform.com?utm_source=self_hosted&utm_medium=instance&utm_campaign=footer'
+</script>
diff --git a/client/components/pages/SelfHostedWelcome.vue b/client/components/pages/SelfHostedWelcome.vue
new file mode 100644
index 000000000..a2ff59bf0
--- /dev/null
+++ b/client/components/pages/SelfHostedWelcome.vue
@@ -0,0 +1,7 @@
+<template>
+ <SplitWelcome />
+</template>
+
+<script setup>
+import SplitWelcome from './self-hosted/SplitWelcome.vue'
+</script>
diff --git a/client/components/pages/self-hosted/SplitWelcome.vue b/client/components/pages/self-hosted/SplitWelcome.vue
new file mode 100644
index 000000000..0ffb69bf7
--- /dev/null
+++ b/client/components/pages/self-hosted/SplitWelcome.vue
@@ -0,0 +1,246 @@
+<template>
+ <main class="split-welcome">
+ <section class="instance" aria-labelledby="access-title">
+ <div class="instance-access">
+ <div class="instance-address">
+ <span class="instance-symbol"><img v-if="logoUrl !== '/img/logo.svg'" :src="logoUrl" alt="" /><UIcon v-else name="i-heroicons-server-stack" /></span>
+ <span class="instance-identity"><span v-if="name !== 'OpnForm'" class="instance-name">{{ name }}</span><span>{{ instanceHost }}</span></span>
+ </div>
+ <h1 id="access-title">Your team’s<br />form workspace.</h1>
+ <p class="instance-description">Sign in to create forms and manage<br class="desktop-break" /> responses on this instance.</p>
+ <UButton :to="{ name: 'login' }" trailing-icon="i-heroicons-arrow-right" label="Sign in" class="instance-sign-in" />
+ <NuxtLink :to="{ name: 'templates' }" class="instance-templates">Browse templates</NuxtLink>
+ <p class="instance-note"><UIcon name="i-heroicons-information-circle" /><span>Looking for a form? Use the link shared with you.</span></p>
+ </div>
+ <footer class="instance-footer">
+ <p>Hosted independently · Powered by <a :href="cloudUrl" target="_blank" rel="noopener noreferrer">OpnForm</a></p>
+ <div v-if="privacyPolicyUrl || termsUrl" class="instance-legal">
+ <a v-if="privacyPolicyUrl" :href="privacyPolicyUrl">Privacy policy</a>
+ <a v-if="termsUrl" :href="termsUrl">Terms</a>
+ </div>
+ </footer>
+ </section>
+
+ <section class="studio" aria-labelledby="studio-title">
+ <img src="/img/self-hosted/studio-background.webp" alt="" class="studio-background" width="1122" height="1402" decoding="async" />
+ <a :href="cloudUrl" target="_blank" rel="noopener noreferrer" class="studio-brand">
+ <img src="/img/logo.svg" alt="" />
+ <span>OpnForm</span>
+ </a>
+ <div class="studio-copy">
+ <h2 id="studio-title">Your forms.<br />Your way.</h2>
+ <p>The open-source form builder.</p>
+ </div>
+ <div class="studio-scene" aria-hidden="true">
+ <div class="studio-cluster">
+ <img
+ src="/img/self-hosted/feedback-card.webp"
+ srcset="/img/self-hosted/feedback-card-640.webp 640w, /img/self-hosted/feedback-card.webp 950w"
+ sizes="(max-width: 600px) 62vw, (max-width: 960px) 350px, 28vw"
+ width="950"
+ height="1253"
+ alt=""
+ class="studio-card feedback-card"
+ decoding="async"
+ />
+ <img
+ src="/img/self-hosted/project-card.webp"
+ srcset="/img/self-hosted/project-card-640.webp 640w, /img/self-hosted/project-card.webp 948w"
+ sizes="(max-width: 600px) 74vw, (max-width: 960px) 420px, 34vw"
+ width="948"
+ height="1173"
+ alt=""
+ class="studio-card project-card"
+ decoding="async"
+ fetchpriority="high"
+ />
+ </div>
+ </div>
+ <div class="studio-bottom">
+ <a :href="cloudUrl" target="_blank" rel="noopener noreferrer" class="studio-discover">
+ Build your own forms with OpnForm <UIcon name="i-heroicons-arrow-up-right" />
+ </a>
+ </div>
+ </section>
+ </main>
+</template>
+
+<script setup>
+const instanceHost = useRequestURL().host
+const { name, logoUrl, privacyPolicyUrl, termsUrl } = useSelfHostedPresentation()
+const cloudUrl = 'https://opnform.com?utm_source=self_hosted&utm_medium=instance&utm_campaign=welcome_split'
+</script>
+
+<style scoped>
+.split-welcome {
+ display: grid;
+ grid-template-columns: minmax(0, 1.402fr) minmax(0, 1fr);
+ min-height: 100svh;
+ background: #fff;
+ color: #10131b;
+}
+
+.studio {
+ grid-column: 1;
+ grid-row: 1;
+ position: relative;
+ isolation: isolate;
+ display: flex;
+ flex-direction: column;
+ min-width: 0;
+ min-height: max(100svh, 760px);
+ overflow: hidden;
+ padding: clamp(28px, 4svh, 44px) clamp(32px, 5.38vw, 96px) clamp(28px, 4.5svh, 48px);
+ color: #fff;
+ background: #3261ff;
+}
+
+.studio-background {
+ position: absolute;
+ z-index: -1;
+ width: 100%;
+ height: 100%;
+ inset: 0;
+ object-fit: cover;
+ pointer-events: none;
+ filter: hue-rotate(-7deg);
+}
+
+.studio-brand {
+ display: inline-flex;
+ align-items: center;
+ align-self: flex-start;
+ gap: 12px;
+ font-size: 27px;
+ font-weight: 600;
+ letter-spacing: -.8px;
+ color: #fff;
+}
+
+.studio-brand img { width: 38px; height: 38px; filter: brightness(0) invert(1); }
+.studio-copy { margin-top: clamp(28px, 5.5svh, 58px); }
+.studio-copy h2 {
+ color: #fff;
+ font-size: clamp(50px, min(5.5vw, 8svh), 86px);
+ font-weight: 500;
+ letter-spacing: -2.8px;
+ line-height: 1.04;
+}
+.studio-copy p {
+ margin-top: 12px;
+ font-size: clamp(18px, min(2.17vw, 3.2svh), 34px);
+ line-height: 1.4;
+ letter-spacing: -.6px;
+}
+
+.studio-scene {
+ position: relative;
+ flex: 1;
+ min-height: 300px;
+ margin-top: 32px;
+ margin-bottom: 40px;
+ pointer-events: none;
+}
+.studio-cluster { position: absolute; top: 0; left: 50%; height: 100%; width: auto; max-width: 100%; aspect-ratio: 1.25; transform: translateX(-50%); }
+.studio-card { position: absolute; object-fit: contain; }
+.feedback-card {
+ --card-angle: -9deg;
+ height: 83%;
+ width: auto;
+ max-width: 67%;
+ left: 6%;
+ top: 8%;
+ transform: rotate(var(--card-angle));
+}
+.project-card {
+ --card-angle: 7deg;
+ height: 96%;
+ width: auto;
+ max-width: 79%;
+ right: 2%;
+ bottom: 1%;
+ transform: rotate(var(--card-angle));
+}
+.studio-bottom { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: auto; }
+.studio-discover {
+ display: inline-flex;
+ align-items: center;
+ align-self: flex-start;
+ gap: 10px;
+ padding-bottom: 10px;
+ border-bottom: 1px solid #ffffff99;
+ font-size: clamp(13px, 1.08vw, 16px);
+ color: #fff;
+}
+.studio-discover .iconify { flex-shrink: 0; width: 16px; height: 16px; }
+
+.instance {
+ grid-column: 2;
+ grid-row: 1;
+ display: flex;
+ flex-direction: column;
+ min-width: 0;
+ padding: clamp(32px, 6svh, 72px) clamp(32px, 5.5vw, 88px) clamp(28px, 5svh, 62px) clamp(40px, 8.07vw, 120px);
+}
+.instance-access { width: 100%; max-width: 480px; margin-block: auto; }
+.instance-address { display: flex; align-items: center; gap: 20px; font-size: clamp(16px, 1.28vw, 19px); font-weight: 500; color: #788296; }
+.instance-symbol { flex-shrink: 0; display: flex; align-items: center; justify-content: center; width: 54px; height: 54px; border-radius: 14px; background: #f1f2f6; color: #111827; }
+.instance-symbol .iconify { width: 28px; height: 28px; }
+.instance-symbol img { width: 30px; height: 30px; object-fit: contain; }
+.instance-identity { display: flex; min-width: 0; flex-direction: column; gap: 3px; overflow-wrap: anywhere; }
+.instance-name { color: #10131b; }
+.instance h1 { color: #10131b; margin-top: clamp(24px, 3.4svh, 36px); font-size: clamp(34px, min(3.37vw, 4.8svh), 53px); line-height: 1.23; font-weight: 600; letter-spacing: -2px; }
+.instance-description { margin-top: 24px; font-size: clamp(16px, 1.4vw, 20px); line-height: 1.5; color: #788296; letter-spacing: -.2px; }
+.instance-sign-in { display: flex; justify-content: center; gap: 16px; width: 100%; min-height: clamp(52px, 6svh, 63px); margin-top: clamp(24px, 3svh, 32px); border-radius: 10px; background: #2674ff; color: #fff; font-size: 20px; font-weight: 500; }
+.instance-sign-in:hover { background: #1761ed; }
+.instance-sign-in :deep(.iconify) { width: 25px; height: 25px; }
+.instance-templates { display: inline-block; margin-top: 22px; font-size: 18px; font-weight: 500; color: #2674ff; }
+.instance-templates:hover { text-decoration: underline; }
+.instance-note { display: flex; gap: 16px; align-items: flex-start; margin-top: clamp(32px, 4.5svh, 48px); padding-top: clamp(24px, 3.8svh, 40px); border-top: 1px solid #d8dfea; font-size: 14px; line-height: 1.7; color: #7b869b; }
+.instance-note .iconify { flex-shrink: 0; width: 24px; height: 24px; }
+.instance-footer { width: 100%; padding-top: 40px; color: #8791a5; font-size: 13px; text-align: center; line-height: 1.6; }
+.instance-footer a:hover { text-decoration: underline; }
+.instance-legal { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 18px; margin-top: 8px; }
+a:focus-visible { outline: 2px solid currentColor; outline-offset: 6px; }
+
+@media (min-width: 1920px) {
+ .studio-scene { max-height: 640px; width: min(100%, 880px); align-self: center; }
+ .studio-copy h2 { font-size: 88px; }
+}
+@media (min-width: 961px) and (max-height: 800px) {
+ .studio { min-height: max(100svh, 700px); }
+ .studio-copy { margin-top: 28px; }
+ .studio-scene { min-height: 280px; margin-top: 24px; margin-bottom: 32px; }
+}
+@media (max-width: 1200px) {
+ .instance { padding-inline: 4vw; }
+ .desktop-break { display: none; }
+ .studio-copy h2 { letter-spacing: -1.7px; }
+}
+@media (max-width: 960px) {
+ .split-welcome { grid-template-columns: minmax(0, 1fr); }
+ .instance { grid-column: 1; grid-row: 1; align-items: center; padding: 44px 28px 28px; }
+ .instance-address { font-size: 16px; gap: 14px; }
+ .instance h1 { font-size: clamp(32px, 10vw, 44px); letter-spacing: -1.5px; margin-top: 26px; }
+ .instance-description { font-size: 18px; }
+ .instance-sign-in { min-height: 56px; }
+ .instance-note { margin-top: 32px; padding-top: 26px; }
+ .instance-footer { max-width: 480px; padding-top: 40px; font-size: 12px; }
+ .studio { grid-column: 1; grid-row: 2; min-height: 0; padding: 28px; }
+ .studio-brand { font-size: 24px; }
+ .studio-brand img { width: 32px; height: 32px; }
+ .studio-copy { margin-top: 32px; }
+ .studio-copy h2 { font-size: clamp(36px, 8.7vw, 58px); line-height: 1.08; letter-spacing: -1.5px; }
+ .studio-copy p { font-size: clamp(16px, 4vw, 24px); margin-top: 15px; }
+ .studio-scene { flex: none; width: 100%; max-width: 620px; height: clamp(280px, 86vw, 470px); min-height: 0; align-self: center; margin-block: 28px 40px; }
+ .studio-discover { font-size: 13px; }
+}
+@media (max-width: 359px) {
+ .studio, .instance { padding-inline: 24px; }
+ .studio-copy h2 { font-size: 34px; }
+ .instance h1 { font-size: 32px; }
+ .instance-description { font-size: 16px; }
+ .studio-discover { font-size: 12px; }
+ .instance-note { gap: 12px; font-size: 13px; }
+}
+</style>
diff --git a/client/composables/useSelfHostedPresentation.js b/client/composables/useSelfHostedPresentation.js
new file mode 100644
index 000000000..9b11f606c
--- /dev/null
+++ b/client/composables/useSelfHostedPresentation.js
@@ -0,0 +1,12 @@
+import { httpUrl } from '~/lib/self-hosted-public.js'
+
+export function useSelfHostedPresentation() {
+ const config = useRuntimeConfig().public
+
+ return {
+ name: config.selfHostedName || 'OpnForm',
+ logoUrl: httpUrl(config.selfHostedLogoUrl) || '/img/logo.svg',
+ privacyPolicyUrl: httpUrl(config.selfHostedPrivacyPolicyUrl),
+ termsUrl: httpUrl(config.selfHostedTermsUrl),
+ }
+}
diff --git a/client/lib/self-hosted-public.js b/client/lib/self-hosted-public.js
new file mode 100644
index 000000000..606f093c3
--- /dev/null
+++ b/client/lib/self-hosted-public.js
@@ -0,0 +1,46 @@
+export const selfHostedMarketingPaths = [
+ '/pricing',
+ '/enterprise',
+ '/industry',
+ '/ai-form-builder',
+ '/mcp',
+ '/self-hosted/license',
+ '/self-hosted/checkout/success',
+ '/self-hosted/checkout/canceled',
+]
+
+const marketingPaths = new Set(selfHostedMarketingPaths)
+
+export function httpUrl(value) {
+ if (!value) return null
+ try {
+ const url = new URL(value)
+ return ['http:', 'https:'].includes(url.protocol) ? url.href : null
+ } catch {
+ return null
+ }
+}
+
+export function getSelfHostedPublicRedirect(path, config = {}) {
+ const normalizedPath = path.replace(/\/+$/, '') || '/'
+
+ if (normalizedPath === '/privacy-policy') return httpUrl(config.privacyPolicyUrl) || '/'
+ if (normalizedPath === '/terms-conditions') return httpUrl(config.termsUrl) || '/'
+
+ const isMarketingPage = marketingPaths.has(normalizedPath)
+ || /^\/integrations(?:\/|$)/.test(normalizedPath)
+ || /^\/opnform-vs-[a-z0-9-]+$/.test(normalizedPath)
+
+ if (!isMarketingPage) return null
+ if (httpUrl(config.rootRedirectUrl)) return httpUrl(config.rootRedirectUrl)
+
+ // Only carry the known page path. Instance queries can contain private data.
+ return `https://opnform.com${normalizedPath}?utm_source=self_hosted&utm_medium=instance&utm_campaign=public_pages`
+}
+
+export function filterSelfHostedSitemapUrls(urls) {
+ return urls.filter(({ loc }) => {
+ const path = new URL(loc, 'https://opnform.com').pathname.replace(/\/+$/, '') || '/'
+ return path !== '/' && path !== '/report-abuse' && !getSelfHostedPublicRedirect(path)
+ })
+}
diff --git a/client/middleware/02.self-hosted-public.global.js b/client/middleware/02.self-hosted-public.global.js
new file mode 100644
index 000000000..3b7789559
--- /dev/null
+++ b/client/middleware/02.self-hosted-public.global.js
@@ -0,0 +1,16 @@
+import { getSelfHostedPublicRedirect } from '~/lib/self-hosted-public.js'
+
+export default defineNuxtRouteMiddleware((to) => {
+ if (!useFeatureFlag('self_hosted') || useFeatureFlag('setup_required', false)) return
+
+ const config = useRuntimeConfig().public
+ const redirect = getSelfHostedPublicRedirect(to.path, {
+ privacyPolicyUrl: config.selfHostedPrivacyPolicyUrl,
+ termsUrl: config.selfHostedTermsUrl,
+ rootRedirectUrl: config.rootRedirectUrl,
+ })
+
+ if (redirect) {
+ return navigateTo(redirect, { external: redirect !== '/', redirectCode: 302 })
+ }
+})
diff --git a/client/middleware/root-redirect.js b/client/middleware/root-redirect.js
index db79938b8..443b3292f 100644
--- a/client/middleware/root-redirect.js
+++ b/client/middleware/root-redirect.js
@@ -1,7 +1,11 @@
-export default defineNuxtRouteMiddleware(async () => {
- const { performRedirect } = useSubdomainRedirect()
+export default defineNuxtRouteMiddleware(async (to) => {
+ const { performRedirect, shouldRedirect } = useSubdomainRedirect()
+
+ if (!shouldRedirect() && to.path === '/' && useFeatureFlag('self_hosted') && useIsAuthenticated().isAuthenticated.value) {
+ return navigateTo({ name: 'home' })
+ }
// Perform redirect with iframe check disabled for root pages
// (root pages should always redirect regardless of iframe context)
await performRedirect({ skipIfIframe: false })
-})
\ No newline at end of file
+})
diff --git a/client/middleware/self-hosted.js b/client/middleware/self-hosted.js
index b8f474d51..69a452bea 100644
--- a/client/middleware/self-hosted.js
+++ b/client/middleware/self-hosted.js
@@ -1,9 +1,9 @@
-export default defineNuxtRouteMiddleware((from, to) => {
+export default defineNuxtRouteMiddleware((to) => {
if (useFeatureFlag('self_hosted')) {
- if (from.name === 'register' && to.query?.email && to.query?.invite_token) {
+ if (to.name === 'register' && to.query?.email && to.query?.invite_token) {
return
}
- if (from.name === 'ai-form-builder' && useFeatureFlag('ai_features')) {
+ if (to.name === 'ai-form-builder' && useFeatureFlag('ai_features')) {
return
}
return navigateTo({ name: "index" })
diff --git a/client/pages/index.vue b/client/pages/index.vue
index f7c9864dd..fd3d1e7cc 100644
--- a/client/pages/index.vue
+++ b/client/pages/index.vue
@@ -1,5 +1,6 @@
<template>
- <div>
+ <SelfHostedWelcome v-if="isSelfHosted" />
+ <div v-else>
<section>
<div class="pt-8 sm:pt-16 px-8 lg:px-12 max-w-7xl mx-auto relative">
<div class="max-w-3xl mx-auto text-center">
@@ -178,13 +179,18 @@ definePageMeta({
middleware: ["root-redirect"],
})
+const { isAuthenticated: authenticated } = useIsAuthenticated()
+const featureFlags = useState('featureFlags', () => ({}))
+const isSelfHosted = computed(() => !!featureFlags.value.self_hosted)
+const { name: instanceName } = useSelfHostedPresentation()
+
useOpnSeoMeta({
- title: "Free Online Form Builder with Unlimited Responses",
- description:
- "Build beautiful online forms with OpnForm. Create forms, surveys, and workflows for free, collect unlimited responses, and keep control of your data.",
+ title: () => isSelfHosted.value ? `${instanceName} workspace` : "Free Online Form Builder with Unlimited Responses",
+ description: () => isSelfHosted.value
+ ? 'Sign in to your self-hosted form workspace.'
+ : "Build beautiful online forms with OpnForm. Create forms, surveys, and workflows for free, collect unlimited responses, and keep control of your data.",
+ robots: () => isSelfHosted.value ? 'noindex, nofollow' : null,
})
-
-const { isAuthenticated: authenticated } = useIsAuthenticated()
</script>
<style lang="scss" scoped>
diff --git a/client/pages/templates/[slug].vue b/client/pages/templates/[slug].vue
index fa2ef6c67..7f331c5b1 100644
--- a/client/pages/templates/[slug].vue
+++ b/client/pages/templates/[slug].vue
@@ -138,7 +138,7 @@
</TrackClick>
</div>
<div class="flex items-center justify-center">
- <div class="text-left mx-auto text-neutral-500 text-xs mt-4">
+ <div v-if="!useFeatureFlag('self_hosted')" class="text-left mx-auto text-neutral-500 text-xs mt-4">
✓ Core features 100% free<br>
✓ No credit card required<br>
✓ No submissions limit on Free plan
@@ -344,7 +344,7 @@ const canEditTemplate = computed(
)
const createFormWithTemplateUrl = computed(() => {
- if (!user.value) {
+ if (!user.value && !useFeatureFlag('self_hosted')) {
return {
name: "register",
query: {
diff --git a/client/public/img/self-hosted/feedback-card-640.webp b/client/public/img/self-hosted/feedback-card-640.webp
new file mode 100644
index 000000000..ee0c661a1
Binary files /dev/null and b/client/public/img/self-hosted/feedback-card-640.webp differ
diff --git a/client/public/img/self-hosted/feedback-card.webp b/client/public/img/self-hosted/feedback-card.webp
new file mode 100644
index 000000000..d422a2516
Binary files /dev/null and b/client/public/img/self-hosted/feedback-card.webp differ
diff --git a/client/public/img/self-hosted/project-card-640.webp b/client/public/img/self-hosted/project-card-640.webp
new file mode 100644
index 000000000..4ec39ad08
Binary files /dev/null and b/client/public/img/self-hosted/project-card-640.webp differ
diff --git a/client/public/img/self-hosted/project-card.webp b/client/public/img/self-hosted/project-card.webp
new file mode 100644
index 000000000..995764cfb
Binary files /dev/null and b/client/public/img/self-hosted/project-card.webp differ
diff --git a/client/public/img/self-hosted/studio-background.webp b/client/public/img/self-hosted/studio-background.webp
new file mode 100644
index 000000000..b2544e20e
Binary files /dev/null and b/client/public/img/self-hosted/studio-background.webp differ
diff --git a/client/runtimeConfig.js b/client/runtimeConfig.js
index c7cfa9337..ca816ef80 100644
--- a/client/runtimeConfig.js
+++ b/client/runtimeConfig.js
@@ -28,6 +28,10 @@ export default {
amplitudeCode: process.env.NUXT_PUBLIC_AMPLITUDE_CODE || null,
crispWebsiteId: process.env.NUXT_PUBLIC_CRISP_WEBSITE_ID || null,
rootRedirectUrl: process.env.NUXT_PUBLIC_ROOT_REDIRECT_URL || null,
+ selfHostedName: process.env.NUXT_PUBLIC_SELF_HOSTED_NAME || '',
+ selfHostedLogoUrl: process.env.NUXT_PUBLIC_SELF_HOSTED_LOGO_URL || '',
+ selfHostedPrivacyPolicyUrl: process.env.NUXT_PUBLIC_SELF_HOSTED_PRIVACY_POLICY_URL || '',
+ selfHostedTermsUrl: process.env.NUXT_PUBLIC_SELF_HOSTED_TERMS_URL || '',
featureBaseOrganization: process.env.NUXT_PUBLIC_FEATURE_BASE_ORGANISATION || null,
diff --git a/client/server/plugins/self-hosted-sitemap.js b/client/server/plugins/self-hosted-sitemap.js
new file mode 100644
index 000000000..0a752c214
--- /dev/null
+++ b/client/server/plugins/self-hosted-sitemap.js
@@ -0,0 +1,16 @@
+import { filterSelfHostedSitemapUrls } from '~/lib/self-hosted-public.js'
+
+export default defineNitroPlugin((nitroApp) => {
+ nitroApp.hooks.hook('sitemap:resolved', (context) => {
+ // Published Docker images discover the deployment mode at runtime. The API
+ // path alone cannot distinguish cloud from a self-hosted installation.
+ return $fetch('/api/feature-flags', { retry: 0 })
+ .then((flags) => {
+ if (flags.self_hosted) {
+ context.urls = filterSelfHostedSitemapUrls(context.urls)
+ }
+ })
+ // Keep the build-time policy if the installation API is unavailable.
+ .catch(() => {})
+ })
+})
diff --git a/client/sitemap.js b/client/sitemap.js
index 71b86f717..ed3443fd9 100644
--- a/client/sitemap.js
+++ b/client/sitemap.js
@@ -2,10 +2,10 @@ import { existsSync, readdirSync, readFileSync } from 'node:fs'
import { join } from 'node:path'
import templateIndustries from './data/forms/templates/industries.json'
import templateTypes from './data/forms/templates/types.json'
+import { selfHostedMarketingPaths } from './lib/self-hosted-public.js'
const isSelfHostedBuild = process.env.SELF_HOSTED === 'true'
|| process.env.NUXT_PUBLIC_SELF_HOSTED === 'true'
- || process.env.NUXT_PUBLIC_API_BASE === '/api'
export default {
exclude: [
@@ -13,7 +13,7 @@ export default {
'/templates/my-templates',
'/setup',
'/self-hosted/checkout/**',
- ...(isSelfHostedBuild ? ['/self-hosted/license'] : []),
+ ...(isSelfHostedBuild ? ['/', ...selfHostedMarketingPaths, '/integrations/**', /^\/opnform-vs-/, '/privacy-policy', '/terms-conditions', '/report-abuse'] : []),
],
sources: [`${(process.env.NUXT_PUBLIC_API_BASE || '').replace(/\/+$/, '')}/sitemap-urls`],
cacheMaxAgeSeconds: 60 * 60 * 2, // 2 hours
@@ -97,6 +97,7 @@ function getTemplateIndustriesUrls () {
}
function getIntegrationsPages () {
+ if (isSelfHostedBuild) return []
const integrationsDir = join(process.cwd(), 'content/integrations')
if (!existsSync(integrationsDir)) return []
diff --git a/client/test/unit/self-hosted-presentation.spec.ts b/client/test/unit/self-hosted-presentation.spec.ts
new file mode 100644
index 000000000..1664cf975
--- /dev/null
+++ b/client/test/unit/self-hosted-presentation.spec.ts
@@ -0,0 +1,41 @@
+import { afterEach, describe, expect, it, vi } from 'vitest'
+import { applyEnv } from 'nitropack/runtime/internal/utils.env'
+import { useSelfHostedPresentation } from '../../composables/useSelfHostedPresentation.js'
+
+afterEach(() => {
+ vi.unstubAllEnvs()
+ vi.unstubAllGlobals()
+ vi.resetModules()
+})
+
+describe('self-hosted presentation runtime configuration', () => {
+ it.each(['true', 'false'])('retains deployment overrides with NUXT_PUBLIC_SELF_HOSTED=%s', async (mode) => {
+ // Model a prebuilt Docker image receiving its configuration at startup.
+ const { default: defaults } = await import('../../runtimeConfig.js')
+ const config = structuredClone(defaults)
+ vi.stubEnv('NUXT_PUBLIC_SELF_HOSTED', mode)
+ vi.stubEnv('NUXT_PUBLIC_SELF_HOSTED_NAME', 'Acme forms')
+ vi.stubEnv('NUXT_PUBLIC_SELF_HOSTED_LOGO_URL', 'https://example.test/logo.svg')
+ vi.stubEnv('NUXT_PUBLIC_SELF_HOSTED_PRIVACY_POLICY_URL', 'https://example.test/privacy')
+ vi.stubEnv('NUXT_PUBLIC_SELF_HOSTED_TERMS_URL', 'https://example.test/terms')
+ applyEnv(config, { prefix: 'NUXT_', altPrefix: 'NITRO_' })
+ vi.stubGlobal('useRuntimeConfig', () => config)
+
+ expect(useSelfHostedPresentation()).toEqual({
+ name: 'Acme forms',
+ logoUrl: 'https://example.test/logo.svg',
+ privacyPolicyUrl: 'https://example.test/privacy',
+ termsUrl: 'https://example.test/terms',
+ })
+
+ vi.stubGlobal('defineNuxtRouteMiddleware', (handler: unknown) => handler)
+ vi.stubGlobal('useFeatureFlag', (key: string) => key === 'self_hosted')
+ const navigate = vi.fn()
+ vi.stubGlobal('navigateTo', navigate)
+ const { default: middleware } = await import('../../middleware/02.self-hosted-public.global.js')
+ middleware({ path: '/privacy-policy' })
+ expect(navigate).toHaveBeenLastCalledWith('https://example.test/privacy', { external: true, redirectCode: 302 })
+ middleware({ path: '/terms-conditions' })
+ expect(navigate).toHaveBeenLastCalledWith('https://example.test/terms', { external: true, redirectCode: 302 })
+ })
+})
diff --git a/client/test/unit/self-hosted-public.test.ts b/client/test/unit/self-hosted-public.test.ts
new file mode 100644
index 000000000..ec5ed6823
--- /dev/null
+++ b/client/test/unit/self-hosted-public.test.ts
@@ -0,0 +1,120 @@
+import { afterEach, describe, expect, it, vi } from 'vitest'
+import { getSelfHostedPublicRedirect, httpUrl, selfHostedMarketingPaths } from '../../lib/self-hosted-public.js'
+
+describe('self-hosted public routes', () => {
+ it.each([...selfHostedMarketingPaths, '/integrations', '/integrations/slack', '/opnform-vs-typeform'])('sends %s to the matching cloud page', (path) => {
+ const result = new URL(getSelfHostedPublicRedirect(path)!)
+ expect(result.origin).toBe('https://opnform.com')
+ expect(result.pathname).toBe(path)
+ expect(result.searchParams.get('utm_source')).toBe('self_hosted')
+ })
+
+ it.each(['/', '/login', '/password/email', '/register', '/forms/contact', '/forms/create', '/forms/contact/edit', '/home', '/admin', '/templates', '/templates/my-templates', '/templates/contact', '/mcp/authorize', '/api/feature-flags', '/oauth/google/callback', '/enterprise-settings'])('keeps %s on the instance', (path) => {
+ expect(getSelfHostedPublicRedirect(path)).toBeNull()
+ })
+
+ it('handles trailing slashes', () => {
+ expect(getSelfHostedPublicRedirect('/enterprise/')).toBe(getSelfHostedPublicRedirect('/enterprise'))
+ })
+
+ it('respects the existing root redirect for marketing pages', () => {
+ expect(getSelfHostedPublicRedirect('/integrations/slack', { rootRedirectUrl: 'https://example.com/forms' })).toBe('https://example.com/forms')
+ })
+
+ it('uses organization legal links without falling back to cloud legal text', () => {
+ expect(getSelfHostedPublicRedirect('/privacy-policy', { privacyPolicyUrl: 'https://example.com/privacy' })).toBe('https://example.com/privacy')
+ expect(getSelfHostedPublicRedirect('/terms-conditions', { termsUrl: 'https://example.com/terms' })).toBe('https://example.com/terms')
+ expect(getSelfHostedPublicRedirect('/privacy-policy')).toBe('/')
+ expect(getSelfHostedPublicRedirect('/terms-conditions')).toBe('/')
+ })
+
+ it.each(['javascript:alert(1)', 'data:text/html,hello', '//example.com', '/relative', 'invalid'])('rejects invalid external URL %s', (url) => {
+ expect(httpUrl(url)).toBeNull()
+ })
+})
+
+describe('self-hosted public middleware', () => {
+ afterEach(() => vi.unstubAllGlobals())
+
+ function prepare({ selfHosted = true, setupRequired = false } = {}) {
+ vi.stubGlobal('defineNuxtRouteMiddleware', (handler: unknown) => handler)
+ vi.stubGlobal('useFeatureFlag', (key: string) => key === 'self_hosted' ? selfHosted : setupRequired)
+ vi.stubGlobal('useRuntimeConfig', () => ({ public: {} }))
+ const navigate = vi.fn()
+ vi.stubGlobal('navigateTo', navigate)
+ return navigate
+ }
+
+ it('does not redirect cloud requests', async () => {
+ const navigate = prepare({ selfHosted: false })
+ const { default: middleware } = await import('../../middleware/02.self-hosted-public.global.js')
+ middleware({ path: '/enterprise' })
+ expect(navigate).not.toHaveBeenCalled()
+ })
+
+ it('lets the setup middleware handle a new installation', async () => {
+ const navigate = prepare({ setupRequired: true })
+ const { default: middleware } = await import('../../middleware/02.self-hosted-public.global.js')
+ middleware({ path: '/enterprise' })
+ expect(navigate).not.toHaveBeenCalled()
+ })
+
+ it('redirects marketing without forwarding private query parameters', async () => {
+ const navigate = prepare()
+ const { default: middleware } = await import('../../middleware/02.self-hosted-public.global.js')
+ middleware({ path: '/enterprise', fullPath: '/[email protected]&token=secret' })
+ expect(navigate).toHaveBeenCalledWith('https://opnform.com/enterprise?utm_source=self_hosted&utm_medium=instance&utm_campaign=public_pages', { external: true, redirectCode: 302 })
+ })
+
+ it('leaves invitations and MCP authorization local', async () => {
+ const navigate = prepare()
+ const { default: middleware } = await import('../../middleware/02.self-hosted-public.global.js')
+ middleware({ path: '/register', fullPath: '/[email protected]&invite_token=secret' })
+ middleware({ path: '/mcp/authorize' })
+ expect(navigate).not.toHaveBeenCalled()
+ })
+})
+
+describe('self-hosted invitation access', () => {
+ afterEach(() => vi.unstubAllGlobals())
+
+ it('reads invitation parameters from the destination on a direct visit', async () => {
+ vi.stubGlobal('defineNuxtRouteMiddleware', (handler: unknown) => handler)
+ vi.stubGlobal('useFeatureFlag', () => true)
+ const navigate = vi.fn()
+ vi.stubGlobal('navigateTo', navigate)
+ const { default: middleware } = await import('../../middleware/self-hosted.js')
+ middleware({ name: 'register', query: { email: '[email protected]', invite_token: 'local-test' } })
+ expect(navigate).not.toHaveBeenCalled()
+ middleware({ name: 'register', query: {} })
+ expect(navigate).toHaveBeenCalledWith({ name: 'index' })
+ })
+})
+
+describe('self-hosted welcome navigation', () => {
+ afterEach(() => vi.unstubAllGlobals())
+
+ it.each([
+ [true, true, false, true],
+ [true, true, true, false],
+ [true, false, false, false],
+ [false, true, false, false],
+ ])('handles selfHosted=%s, authenticated=%s, customRedirect=%s', async (selfHosted, authenticated, customRedirect, goesHome) => {
+ vi.stubGlobal('defineNuxtRouteMiddleware', (handler: unknown) => handler)
+ vi.stubGlobal('useFeatureFlag', () => selfHosted)
+ vi.stubGlobal('useIsAuthenticated', () => ({ isAuthenticated: { value: authenticated } }))
+ const performRedirect = vi.fn()
+ vi.stubGlobal('useSubdomainRedirect', () => ({ performRedirect, shouldRedirect: () => customRedirect }))
+ const navigate = vi.fn()
+ vi.stubGlobal('navigateTo', navigate)
+ const { default: middleware } = await import('../../middleware/root-redirect.js')
+ await middleware({ path: '/' })
+ if (goesHome) {
+ expect(navigate).toHaveBeenCalledWith({ name: 'home' })
+ expect(performRedirect).not.toHaveBeenCalled()
+ } else {
+ expect(navigate).not.toHaveBeenCalled()
+ expect(performRedirect).toHaveBeenCalledWith({ skipIfIframe: false })
+ }
+ })
+})
diff --git a/client/test/unit/sitemap.spec.ts b/client/test/unit/sitemap.spec.ts
index 0655ec1ad..be738727f 100644
--- a/client/test/unit/sitemap.spec.ts
+++ b/client/test/unit/sitemap.spec.ts
@@ -2,6 +2,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest'
afterEach(() => {
vi.unstubAllEnvs()
+ vi.unstubAllGlobals()
vi.resetModules()
})
@@ -24,3 +25,77 @@ describe('sitemap API source', () => {
})
})
})
+
+describe('self-hosted sitemap', () => {
+ it('excludes redirected marketing pages and keeps the local template catalog', async () => {
+ vi.stubEnv('SELF_HOSTED', 'true')
+ vi.resetModules()
+ const { default: sitemap } = await import('../../sitemap.js')
+ const { createFilter } = await import('nuxtseo-shared/utils')
+ const include = createFilter({ exclude: sitemap.exclude })
+
+ for (const path of ['/', '/enterprise', '/pricing', '/industry', '/mcp', '/integrations', '/integrations/slack', '/opnform-vs-typeform', '/privacy-policy', '/terms-conditions']) {
+ expect(include(path), path).toBe(false)
+ }
+ expect(include('/templates')).toBe(true)
+ expect(include('/templates/contact')).toBe(true)
+ const urls = await sitemap.urls()
+ expect(urls.some(({ url }) => url.startsWith('/integrations'))).toBe(false)
+ expect(urls.some(({ url }) => url.startsWith('/templates'))).toBe(true)
+ })
+
+ it.each(['https://api.opnform.com', '/api'])('keeps cloud marketing pages with API base %s', async (apiBase) => {
+ vi.stubEnv('SELF_HOSTED', 'false')
+ vi.stubEnv('NUXT_PUBLIC_SELF_HOSTED', 'false')
+ vi.stubEnv('NUXT_PUBLIC_API_BASE', apiBase)
+ vi.resetModules()
+ const { default: sitemap } = await import('../../sitemap.js')
+ const { createFilter } = await import('nuxtseo-shared/utils')
+ const include = createFilter({ exclude: sitemap.exclude })
+ expect(include('/')).toBe(true)
+ expect(include('/enterprise')).toBe(true)
+ expect(include('/opnform-vs-typeform')).toBe(true)
+ expect((await sitemap.urls()).some(({ url }) => url.startsWith('/integrations'))).toBe(true)
+ })
+})
+
+
+describe('runtime sitemap policy for published images', () => {
+ async function prepare(flags: unknown) {
+ vi.stubGlobal('defineNitroPlugin', (plugin: unknown) => plugin)
+ const fetch = vi.fn().mockResolvedValue(flags)
+ vi.stubGlobal('$fetch', fetch)
+ const hook = vi.fn()
+ const { default: register } = await import('../../server/plugins/self-hosted-sitemap.js')
+ register({ hooks: { hook } })
+ expect(hook.mock.calls[0][0]).toBe('sitemap:resolved')
+ return { resolve: hook.mock.calls[0][1], fetch }
+ }
+
+ const paths = ['/', '/enterprise', '/pricing', '/integrations/slack', '/opnform-vs-typeform', '/privacy-policy', '/report-abuse', '/templates', '/templates/contact', '/forms/contact']
+
+ it('filters the rendered sitemap using the actual installation mode', async () => {
+ const { resolve, fetch } = await prepare({ self_hosted: true })
+ const context = { urls: paths.map(path => ({ loc: `https://forms.example.test${path}` })) }
+ await resolve(context)
+ expect(context.urls.map(url => new URL(url.loc).pathname)).toEqual(['/templates', '/templates/contact', '/forms/contact'])
+ expect(fetch).toHaveBeenCalledWith('/api/feature-flags', { retry: 0 })
+ })
+
+ it('keeps marketing URLs for a cloud deployment', async () => {
+ const { resolve } = await prepare({ self_hosted: false })
+ const urls = paths.map(loc => ({ loc }))
+ const context = { urls }
+ await resolve(context)
+ expect(context.urls).toBe(urls)
+ })
+
+ it('preserves the build-time fallback if the flags endpoint is unavailable', async () => {
+ const { resolve, fetch } = await prepare(null)
+ fetch.mockRejectedValue(new Error('API unavailable'))
+ const urls = [{ loc: '/templates' }]
+ const context = { urls }
+ await resolve(context)
+ expect(context.urls).toBe(urls)
+ })
+})
diff --git a/docs/configuration/environment-variables.mdx b/docs/configuration/environment-variables.mdx
index fbd997f21..f2ac6e28d 100644
--- a/docs/configuration/environment-variables.mdx
+++ b/docs/configuration/environment-variables.mdx
@@ -206,7 +206,11 @@ MCP is disabled by default on self-hosted instances. Enable it from **Settings
| `NUXT_PUBLIC_H_CAPTCHA_SITE_KEY` | Site key for hCaptcha integration on the front-end. |
| `NUXT_PUBLIC_RE_CAPTCHA_SITE_KEY` | Site key for reCAPTCHA integration on the front-end. |
| `NUXT_API_SECRET` | Shared secret key between Nuxt and Laravel backend. |
-| `NUXT_PUBLIC_ROOT_REDIRECT_URL` | Permanently redirects users visiting the root path (/), /integrations, or any non-existent (404) page to the specified URL. This effectively "hides" OpnForm's public pages while keeping forms and admin functionality accessible. See [Subdomain Redirect Configuration](../configuration/subdomain-redirect) for detailed setup and examples. |
+| `NUXT_PUBLIC_ROOT_REDIRECT_URL` | Redirects the self-hosted welcome page and unknown pages (HTTP 301), plus marketing pages (HTTP 302), to your website. Forms and application pages remain accessible. See [Subdomain Redirect Configuration](../configuration/subdomain-redirect). |
+| `NUXT_PUBLIC_SELF_HOSTED_NAME` | Name displayed on the self-hosted welcome page and navigation; defaults to `OpnForm`. |
+| `NUXT_PUBLIC_SELF_HOSTED_LOGO_URL` | Absolute HTTP(S) URL for the self-hosted instance logo. |
+| `NUXT_PUBLIC_SELF_HOSTED_PRIVACY_POLICY_URL` | Organization privacy policy URL for self-hosted visitors. |
+| `NUXT_PUBLIC_SELF_HOSTED_TERMS_URL` | Organization terms URL for self-hosted visitors. |
import CloudVersion from "/snippets/cloud-version.mdx";
diff --git a/docs/configuration/subdomain-redirect.mdx b/docs/configuration/subdomain-redirect.mdx
index c15b82135..e07bc9f72 100644
--- a/docs/configuration/subdomain-redirect.mdx
+++ b/docs/configuration/subdomain-redirect.mdx
@@ -16,10 +16,10 @@ This feature is particularly useful when you're running OpnForm on a subdomain (
## How It Works
-When `NUXT_PUBLIC_ROOT_REDIRECT_URL` is set, OpnForm will permanently redirect (301) users visiting these routes:
+When `NUXT_PUBLIC_ROOT_REDIRECT_URL` is set, OpnForm redirects users visiting these routes:
- **Root path** (`/`) - The landing page
-- **Integrations page** (`/integrations`) - The integrations showcase
+- **Marketing pages** — Integrations, pricing, Enterprise, industry, comparisons, and cloud product pages (HTTP 302)
- **Any non-existent pages** (404 errors) - Undefined routes
### What Still Works
@@ -82,8 +82,8 @@ NUXT_PUBLIC_ROOT_REDIRECT_URL=https://docs.mycompany.com
## Implementation Notes
-- The redirect is a **permanent redirect** (HTTP 301)
-- The redirect happens on the client-side (Nuxt)
+- Root and unknown-page redirects use **HTTP 301**; marketing-page redirects use **HTTP 302**
+- The redirect happens during server rendering and client-side navigation (Nuxt)
- You must recreate your Docker containers after changing this environment variable
- The URL should include the protocol (`https://` or `http://`)
@@ -100,3 +100,54 @@ docker compose up -d ui
A simple `docker compose restart` will not reload the new environment
variable. You must use `down` and `up` to recreate the container.
</Warning>{" "}
+
+## Default self-hosted welcome page
+
+Without `NUXT_PUBLIC_ROOT_REDIRECT_URL`, self-hosted instances show a dedicated
+split-screen welcome page with a sign-in button, a local template catalog link,
+and a link to discover OpnForm. Signed-in users visiting `/` go to their dashboard.
+The welcome page asks search engines not to index it.
+
+Marketing routes (pricing, Enterprise, industry, integrations, comparisons,
+AI form builder, MCP overview, and cloud license checkout pages) redirect to the
+matching page on `https://opnform.com` with a temporary HTTP 302 redirect.
+These links include campaign attribution, but never copy the original query
+parameters. If you configure `NUXT_PUBLIC_ROOT_REDIRECT_URL`, these marketing
+routes use your configured destination instead. The root and unknown-page
+redirects keep their existing HTTP 301 behavior.
+
+Templates, public forms, login, password recovery, invitations, application
+pages, OAuth callbacks, and MCP authorization remain on your instance.
+
+### Customize the instance
+
+Set these optional variables in the client environment:
+
+| Variable | Purpose |
+| --- | --- |
+| `NUXT_PUBLIC_SELF_HOSTED_NAME` | Organization or instance name; defaults to `OpnForm` |
+| `NUXT_PUBLIC_SELF_HOSTED_LOGO_URL` | Absolute HTTP(S) URL for the instance logo |
+| `NUXT_PUBLIC_SELF_HOSTED_PRIVACY_POLICY_URL` | Your organization's privacy policy URL |
+| `NUXT_PUBLIC_SELF_HOSTED_TERMS_URL` | Your organization's terms URL |
+
+Legal links appear in the self-hosted footer only when configured. Direct visits
+to `/privacy-policy` or `/terms-conditions` redirect to your configured URL, or
+to the instance welcome page when no URL is set. OpnForm Cloud legal pages are
+not shown as your instance's policies. Recreate your client container after
+changing these environment variables.
+
+### Preview in a Codex worktree
+
+Run `CODEX_SELF_HOSTED=true CODEX_AUTO_LOGIN=false ./scripts/codex-worktree-up.sh`
+to launch the isolated seeded app in self-hosted mode and view the public welcome
+page. Sign in with the seeded account to test the dashboard. These options default
+to cloud mode with automatic login when omitted.
+
+The welcome illustration uses separate, static responsive image layers. On smaller
+screens the instance sign-in appears before the illustration.
+
+Marketing redirects are applied during both server rendering and client-side
+navigation. Sitemap filtering also reads the installation mode at runtime, so
+published Docker images omit redirected marketing pages without requiring a
+custom frontend build. An API base path such as `/api` does not determine whether
+your deployment is self-hosted.
diff --git a/scripts/codex-worktree-lib.sh b/scripts/codex-worktree-lib.sh
index 771f3111f..04c69922b 100755
--- a/scripts/codex-worktree-lib.sh
+++ b/scripts/codex-worktree-lib.sh
@@ -135,7 +135,7 @@ JWT_REMEMBER_TTL=43200
JWT_SECRET=38hjE96gYu4ceKSSHNnzgeynMr2m3WkNBN2u7zzpVeiITtxFEloxAjcr7TCKuiiy
JWT_SKIP_IP_UA_VALIDATION=true
-SELF_HOSTED=false
+SELF_HOSTED=${CODEX_SELF_HOSTED:-false}
ZAPIER_ENABLED=false
EOF
@@ -147,7 +147,8 @@ NUXT_PUBLIC_API_BASE=$CODEX_API_BASE_URL
NUXT_PRIVATE_API_BASE=$CODEX_API_BASE_URL
NUXT_API_SECRET=secret
NUXT_PUBLIC_ENV=codex
-NUXT_PUBLIC_CODEX_AUTO_LOGIN=true
+NUXT_PUBLIC_SELF_HOSTED=${CODEX_SELF_HOSTED:-false}
+NUXT_PUBLIC_CODEX_AUTO_LOGIN=${CODEX_AUTO_LOGIN:-true}
NUXT_PUBLIC_CODEX_AUTO_LOGIN_PASSWORD=Abcd@1234
NUXT_BUILD_DIR="$CODEX_CLIENT_NUXT_DIR"