LinkDen
Getting Started

Configuration

Configure Clerk authentication, Cloudflare services, and all environment variables for your LinkDen instance.

Configuration

LinkDen uses environment variables for all configuration. There are three .env files across the monorepo, each serving a different app.

Root .env

The root .env file contains variables shared across the monorepo.

VariableDescriptionRequired
CLOUDFLARE_API_TOKENAPI token for Cloudflare deploymentsYes
CLOUDFLARE_ACCOUNT_IDYour Cloudflare account IDYes

Web App (apps/web/.env)

VariableDescriptionRequired
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEYClerk publishable key (starts with pk_)Yes
CLERK_SECRET_KEYClerk secret key (starts with sk_)Yes
NEXT_PUBLIC_API_URLURL of the Hono API serverYes
NEXT_PUBLIC_SITE_URLPublic URL of the web appYes
NEXT_PUBLIC_SITE_NAMEDisplay name for the siteNo
NEXT_PUBLIC_TURNSTILE_SITE_KEYCloudflare Turnstile site key for CAPTCHANo

Server App (apps/server/.env)

VariableDescriptionRequired
CLERK_SECRET_KEYClerk secret key (same as web)Yes
CLERK_PUBLISHABLE_KEYClerk publishable keyYes
DATABASE_IDCloudflare D1 database IDYes
RESEND_API_KEYResend API key for contact form emailsNo
RESEND_FROM_EMAILSender email for contact formNo
TURNSTILE_SECRET_KEYCloudflare Turnstile secret for CAPTCHA verificationNo
APPLE_PASS_TYPE_IDApple Wallet pass type identifierNo
APPLE_TEAM_IDApple Developer team identifierNo
APPLE_WWDR_CERTBase64-encoded Apple WWDR certificateNo
APPLE_SIGNER_CERTBase64-encoded signer certificateNo
APPLE_SIGNER_KEYBase64-encoded signer private keyNo
APPLE_SIGNER_PASSPHRASEPassphrase for the signer keyNo

Clerk Authentication Setup

  1. Create a free account at clerk.com.
  2. Create a new application in the Clerk dashboard.
  3. Copy the Publishable Key and Secret Key from the API Keys section.
  4. Paste them into both apps/web/.env and apps/server/.env.
  5. Important: Restrict sign-ups to your email only.
    • Go to User & Authentication > Restrictions in the Clerk dashboard.
    • Enable the Allowlist and add your email address.
    • This ensures only you can access the admin panel.

Cloudflare Setup

  1. Log in to the Cloudflare dashboard.
  2. Find your Account ID on the right sidebar of the overview page.
  3. Create an API Token with the following permissions:
    • Account: Cloudflare Pages (Edit)
    • Account: Cloudflare Workers (Edit)
    • Account: D1 (Edit)
  4. Add both values to your root .env file.

Cloudflare Turnstile (Optional)

Turnstile provides invisible CAPTCHA protection for the contact form:

  1. Go to Turnstile in the Cloudflare dashboard.
  2. Add a new site with your domain.
  3. Copy the Site Key to apps/web/.env as NEXT_PUBLIC_TURNSTILE_SITE_KEY.
  4. Copy the Secret Key to apps/server/.env as TURNSTILE_SECRET_KEY.

Resend Email (Optional)

Resend handles sending contact form submissions to your email:

  1. Create an account at resend.com.
  2. Verify your domain or use the sandbox domain for testing.
  3. Generate an API key and add it to apps/server/.env.
  4. Set RESEND_FROM_EMAIL to your verified sender address.

Next Steps

On this page