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.
| Variable | Description | Required |
|---|---|---|
CLOUDFLARE_API_TOKEN | API token for Cloudflare deployments | Yes |
CLOUDFLARE_ACCOUNT_ID | Your Cloudflare account ID | Yes |
Web App (apps/web/.env)
| Variable | Description | Required |
|---|---|---|
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY | Clerk publishable key (starts with pk_) | Yes |
CLERK_SECRET_KEY | Clerk secret key (starts with sk_) | Yes |
NEXT_PUBLIC_API_URL | URL of the Hono API server | Yes |
NEXT_PUBLIC_SITE_URL | Public URL of the web app | Yes |
NEXT_PUBLIC_SITE_NAME | Display name for the site | No |
NEXT_PUBLIC_TURNSTILE_SITE_KEY | Cloudflare Turnstile site key for CAPTCHA | No |
Server App (apps/server/.env)
| Variable | Description | Required |
|---|---|---|
CLERK_SECRET_KEY | Clerk secret key (same as web) | Yes |
CLERK_PUBLISHABLE_KEY | Clerk publishable key | Yes |
DATABASE_ID | Cloudflare D1 database ID | Yes |
RESEND_API_KEY | Resend API key for contact form emails | No |
RESEND_FROM_EMAIL | Sender email for contact form | No |
TURNSTILE_SECRET_KEY | Cloudflare Turnstile secret for CAPTCHA verification | No |
APPLE_PASS_TYPE_ID | Apple Wallet pass type identifier | No |
APPLE_TEAM_ID | Apple Developer team identifier | No |
APPLE_WWDR_CERT | Base64-encoded Apple WWDR certificate | No |
APPLE_SIGNER_CERT | Base64-encoded signer certificate | No |
APPLE_SIGNER_KEY | Base64-encoded signer private key | No |
APPLE_SIGNER_PASSPHRASE | Passphrase for the signer key | No |
Clerk Authentication Setup
- Create a free account at clerk.com.
- Create a new application in the Clerk dashboard.
- Copy the Publishable Key and Secret Key from the API Keys section.
- Paste them into both
apps/web/.envandapps/server/.env. - 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
- Log in to the Cloudflare dashboard.
- Find your Account ID on the right sidebar of the overview page.
- Create an API Token with the following permissions:
- Account: Cloudflare Pages (Edit)
- Account: Cloudflare Workers (Edit)
- Account: D1 (Edit)
- Add both values to your root
.envfile.
Cloudflare Turnstile (Optional)
Turnstile provides invisible CAPTCHA protection for the contact form:
- Go to Turnstile in the Cloudflare dashboard.
- Add a new site with your domain.
- Copy the Site Key to
apps/web/.envasNEXT_PUBLIC_TURNSTILE_SITE_KEY. - Copy the Secret Key to
apps/server/.envasTURNSTILE_SECRET_KEY.
Resend Email (Optional)
Resend handles sending contact form submissions to your email:
- Create an account at resend.com.
- Verify your domain or use the sandbox domain for testing.
- Generate an API key and add it to
apps/server/.env. - Set
RESEND_FROM_EMAILto your verified sender address.
Next Steps
- Deployment -- Deploy your configured instance to Cloudflare.
- Environment Variables Reference -- Complete reference for all variables.