Contact Form
Enable a built-in contact form with CAPTCHA protection and email delivery via Resend.
Contact Form
LinkDen includes an optional contact form that lets visitors send you messages without exposing your email address. Messages are delivered to your inbox via Resend and stored in the database for viewing in the admin panel.
How It Works
- A visitor fills out the contact form on your public page (name, email, message).
- Cloudflare Turnstile verifies the submission is from a real person (if configured).
- The message is saved to your D1 database.
- If Resend is configured, an email notification is sent to your address.
- You can view and manage all submissions in the admin panel at
/admin/contacts.
Setting Up the Contact Form
Enable the Form
The contact form is enabled by default. You can toggle it on or off in /admin/settings under the Contact section.
Configure Resend (Recommended)
To receive email notifications when someone submits the form:
- Create an account at resend.com.
- Add and verify your domain, or use the sandbox domain for testing.
- Generate an API key from the Resend dashboard.
- Add to
apps/server/.env:
RESEND_API_KEY=re_your_api_key_here
RESEND_FROM_EMAIL=contact@yourdomain.comWithout Resend, messages are still saved to the database but no email is sent.
Configure CAPTCHA (Recommended)
LinkDen supports three CAPTCHA modes. Select the type in Admin > Settings > Contact Form > CAPTCHA Type:
Simple Math CAPTCHA (No external account required)
The simplest option. The form displays a randomly generated arithmetic question (e.g., "What is 4 + 7?"). The answer is validated server-side. No API keys, no third-party services, no cookies. Ideal for low-traffic sites or when you want zero external dependencies.
To enable: set CAPTCHA Type to Simple Math in the admin settings. No environment variables are required.
Cloudflare Turnstile (Recommended for Cloudflare deployments)
Privacy-friendly, invisible challenge from Cloudflare. Ideal if you are already on the Cloudflare stack.
- Go to the Turnstile section in the Cloudflare dashboard.
- Add your site and select the managed challenge type.
- Add to your environment files:
# apps/web/.env
NEXT_PUBLIC_TURNSTILE_SITE_KEY=0x4AAAAAAA...
# apps/server/.env
TURNSTILE_SECRET_KEY=0x4AAAAAAA...Then set CAPTCHA Type to Cloudflare Turnstile in admin settings.
Google reCAPTCHA v2
Traditional checkbox CAPTCHA from Google.
- Register your site at google.com/recaptcha.
- Add to your environment files:
# apps/web/.env
NEXT_PUBLIC_RECAPTCHA_SITE_KEY=6Le...
# apps/server/.env
RECAPTCHA_SECRET_KEY=6Le...Then set CAPTCHA Type to Google reCAPTCHA in admin settings.
Without any CAPTCHA configured, the form works but has no bot protection.
Managing Submissions
Navigate to /admin/contacts to view all form submissions:
- Inbox -- New, unread submissions.
- Read -- Submissions you have viewed.
- Archive -- Submissions you have archived.
Each submission shows:
- Sender name and email.
- Message content.
- Submission date and time.
- Read/unread status.
You can reply directly by clicking the sender's email address, which opens your email client with the address pre-filled.
Form Fields
The contact form includes:
| Field | Type | Required |
|---|---|---|
| Name | Text | Yes |
| Yes | ||
| Message | Textarea | Yes |
| CAPTCHA | Math question / Turnstile / reCAPTCHA | If configured |
The form validates all fields client-side before submission and shows inline error messages.