Skip to main content
NextStarter
Menu

Environment Variables

Every environment variable the starter reads, what each one does, and which are safe to leave blank.

Setting them

.env.example is the source of truth, with a comment on every variable. Copy it to .env and fill in what you need (the CLI has already done the copy for you):

cp .env.example .env

Every variable here starts with NEXT_PUBLIC_, which means Next.js inlines its value into the JavaScript sent to the browser at build time. Restart the dev server after changing .env, and rebuild after changing them on your host. Never put a secret in one.

Site

These three are all you need to run and deploy the site.

NEXT_PUBLIC_SITE_URLRequired
The full URL of the site, such as https://example.com. It is used for canonical URLs, the sitemap, robots.txt, and Open Graph images. A trailing slash is fine. Set it to your production domain when you deploy.
NEXT_PUBLIC_SITE_NAMERequired
The name shown in the header, the footer, and every page title.
NEXT_PUBLIC_SITE_META_DESCRIPTIONRequired
The default description used in search results, link previews, and the footer.
NEXT_PUBLIC_GITHUB_URLOptional
Your project’s GitHub repository. The footer and the structured data link to it, and so do the landing page’s “Star on GitHub” and “View on GitHub” buttons in the full starting point. The star count is read from the same repository. Leave it blank and every GitHub link is hidden.

Analytics

Leave the token blank and PostHog never initializes. The site then makes no third-party requests at all. See Analytics before turning it on.

NEXT_PUBLIC_POSTHOG_PROJECT_TOKENOptional
The PostHog project token, from Settings → Project → Project API key. Setting it switches analytics on.
NEXT_PUBLIC_POSTHOG_HOSTDefault: https://eu.i.posthog.com
The ingestion host. Change it only if your PostHog project is in the US region (https://us.i.posthog.com), which brings data-transfer obligations that the EU region does not.

Privacy

NEXT_PUBLIC_PRIVACY_EMAILSet before launch
Where data-protection requests go, shown on /privacy. It falls back to NEXT_PUBLIC_SUPPORT_EMAIL. With neither set, the notice leaves out its contact section rather than link nowhere.

Selling something

These exist so NextStarter’s own site can sell NextStarter Pro. Leave them blank in your project. With NEXT_PUBLIC_PRO_URL unset, the whole sales surface switches off: the landing-page teaser, its navigation entries, and the /pro and /thanks routes. Your site never advertises someone else’s product by accident. Projects created with the CLI have these pages removed already.

NEXT_PUBLIC_PRO_URLOptional
A checkout link. Setting it switches the sales surface on.
NEXT_PUBLIC_POLAR_PORTAL_URLOptional
The customer portal linked from the post-purchase page.
NEXT_PUBLIC_SUPPORT_EMAILOptional
A public support address. It is also the fallback privacy contact, so it is worth keeping even if you sell nothing.

In CI

The GitHub Actions workflow builds the site, so it needs the site variables too. They are set in the env block at the top of .github/workflows/ci.yml. The site URL is written inline there, so change it to your own domain. The name and description come from two repository variables, NEXT_PUBLIC_SITE_NAME and NEXT_PUBLIC_SITE_METADESCRIPTION, which you add under Settings → Secrets and variables → Actions → Variables. Several tests check page titles against the site name, so CI fails without them.