LinkDen
Getting Started

Configuration

Set up environment variables and authentication for your LinkDen instance.

⚙️ Configuration

LinkDen keeps its .env file minimal on purpose. You only need five environment variables to get running. Everything else -- email, CAPTCHA, branding, and more -- is configured through the admin panel and stored in the database.

⚡ TL;DR

  • Required: 5 variables (BETTER_AUTH_SECRET, BETTER_AUTH_URL, CORS_ORIGIN, NEXT_PUBLIC_SERVER_URL, NEXT_PUBLIC_SITE_URL).
  • Config Location: Most settings are in /admin/settings (DB), not .env.
  • Auth: Built-in email/password (Better Auth). No external provider needed.

1. 🔑 Environment Variables

Create your .env file from the example:

cp .env.example .env

Required Variables Checklist

  • BETTER_AUTH_SECRET - Private. Signs session cookies.
  • BETTER_AUTH_URL - Public. URL where the API server runs.
  • CORS_ORIGIN - Public. URL where the web frontend runs.
  • NEXT_PUBLIC_SERVER_URL - Public. Same as BETTER_AUTH_URL.
  • NEXT_PUBLIC_SITE_URL - Public. URL of the site itself (used for robots.txt, sitemap.xml, and Open Graph links).

Generating a Secret

Run this to generate a strong, random secret:

openssl rand -base64 32

Paste the output as your BETTER_AUTH_SECRET. Use a different secret for production.


2. 📝 Examples

💻 Local Development

BETTER_AUTH_SECRET=your-generated-secret
BETTER_AUTH_URL=http://localhost:3000
CORS_ORIGIN=http://localhost:3001
NEXT_PUBLIC_SERVER_URL=http://localhost:3000
NEXT_PUBLIC_SITE_URL=http://localhost:3001

🌍 Production

SITE_DOMAIN=links.yourdomain.com
BETTER_AUTH_SECRET=your-production-secret
BETTER_AUTH_URL=https://links.yourdomain.com
CORS_ORIGIN=https://links.yourdomain.com
NEXT_PUBLIC_SERVER_URL=https://links.yourdomain.com
NEXT_PUBLIC_SITE_URL=https://links.yourdomain.com

Tip: In production all four URLs are the same hostname. The web app owns SITE_DOMAIN and the API is routed under it at /api/* and /trpc/*, so there is no separate API domain. Locally the API (:3000) and web app (:3001) are different origins, which is why the local values differ. See Environment Variables for the deploy-only variables.


3. 🔐 Authentication

LinkDen uses email and password authentication.

  • 🚫 No OAuth needed.
  • 🚫 No external auth service needed.

How it works:

  1. Navigate to /admin/setup.
  2. Create your admin account.
  3. The first user becomes the admin.
  4. Registration locks automatically.
  5. Sign in at /admin/login.

Note: Unauthenticated visitors only see your public link page.


4. 🎛️ Admin Settings (Runtime Config)

Most configuration lives in the admin panel (/admin/design for the page, /admin/settings for account, email, integrations, wallet and data), not in environment variables. This means you can change settings without redeploying:

  • 📧 Email provider -- Resend or Cloudflare Email Workers.
  • 🛡️ CAPTCHA -- Cloudflare Turnstile or Google reCAPTCHA.
  • 🏷️ Branding -- Whitelabel footer text, link, logo, site name, and admin panel branding.
  • 📇 vCard -- Enable or disable the downloadable contact card.
  • 🍏 Apple Wallet -- Team ID, Pass Type ID, and custom QR URL.
  • 🔍 SEO -- Page title, meta description, and OG image.
  • 🗺️ MapKit -- Apple Maps embed token for Location blocks (optional).
  • 🍪 Consent Banner -- Optional privacy/cookie notice shown at the bottom of your public page.
  • 🖥️ Admin Branding -- Show or hide LinkDen branding inside the admin panel itself.

Next Steps

On this page