Environment Variables
Configure environment variables for Dirly – your premium AI tools directory.
Dirly requires several environment variables to connect with external services. Create a .env.local file in the root directory and configure the variables below.
Site URL
NEXT_PUBLIC_SITE_URL string required
The base URL of your application. For production, set to your domain (e.g., https://dirly.com). Used for generating absolute links and webhook endpoints.
NEXT_PUBLIC_SITE_URL="http://localhost:3000"Clerk Authentication
Configure Clerk for user authentication and session management.
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY string required
Your Clerk publishable key. Get this from your Clerk Dashboard → API Keys.
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="pk_test_..."CLERK_SECRET_KEY string required
Your Clerk secret key. Keep this secure and never commit it to version control.
CLERK_SECRET_KEY="sk_test_..."CLERK_ISSUER_URL string required
Your Clerk issuer URL, typically https://your-clerk-domain.clerk.accounts.dev.
-
Used for Convex authentication.
-
How Create Authentication
CLERK_ISSUER_URL="https://your-clerk-domain.clerk.accounts.dev"NEXT_PUBLIC_CLERK_SIGN_IN_URL string default:"/sign-in"
Path to the sign-in page.
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-inNEXT_PUBLIC_CLERK_SIGN_UP_URL string default:"/sign-up"
Path to the sign-up page.
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-upConvex Database
Configure Convex for real‑time database and backend functionality.
Convex Account - Sign up at convex.devÂ
CONVEX_DEPLOYMENT string required
Your Convex deployment name. Generated when you run npx convex dev for the first time.
CONVEX_DEPLOYMENT="prod:your-project"NEXT_PUBLIC_CONVEX_URL string required
Your Convex deployment URL. Displayed after running convex dev.
NEXT_PUBLIC_CONVEX_URL="https://your-project.convex.cloud"CONVEX_DEPLOY_KEY string
Required for CI/CD and production deployments. Get this from your Convex dashboard under Deployment Settings. Not needed for local development.
CONVEX_DEPLOY_KEY="your_convex_deploy_key"Stripe Payments
Dirly uses Stripe to handle one‑time payments for featuring tools.
đź§ How to get your Stripe keys:
- Go to Stripe Dashboard and log in / sign up.
- In the dashboard, navigate to Developers → API keys.
- Copy the Publishable key (starts with
pk_) and Secret key (starts withsk_).
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY string required
Your Stripe publishable key (client‑side).
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="pk_live_..."STRIPE_SECRET_KEY string required
Your Stripe secret key (server‑side). Keep this secure.
STRIPE_SECRET_KEY="sk_live_..."🔌 Webhook setup:
For production, Stripe needs to send events (like successful payments) to your app.
Go to Developers → Webhooks and create an endpoint pointing to:
https://yourdomain.com/api/stripe/webhookFor local development, use a tool like ngrok to expose your local server.
After creating the endpoint, copy the Signing secret (starts with whsec_).
STRIPE_WEBHOOK_SECRET string required (for webhooks)
The webhook signing secret.
STRIPE_WEBHOOK_SECRET="whsec_..."đź’° Featured price:
NEXT_PUBLIC_FEATURED_PRICE string
Price in cents for featuring a tool (e.g., 4900 = $49.00). Used on the client for checkout.
NEXT_PUBLIC_FEATURED_PRICE=4900Email Configuration (Resend)
Configure Resend for transactional email notifications (e.g., submission approved/rejected, admin alerts).
This is optional but recommended for production.
RESEND_API_KEY string
Your Resend API key. Get one from resend.com .
RESEND_API_KEY="re_..."FROM_EMAIL string default:"Dirly <noreply@yourdomain.com>"
The sender email address. Must be verified in your Resend dashboard.
FROM_EMAIL="Dirly <noreply@dirly.com>"NEXT_PUBLIC_ADMIN_EMAIL string
Email address that receives notifications about new tool submissions (if omitted, no notifications are sent).
NEXT_PUBLIC_ADMIN_EMAIL="admin@dirly.com"Example Complete .env.local
# Site URL
NEXT_PUBLIC_SITE_URL=http://localhost:3000
# Clerk Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
CLERK_SECRET_KEY=sk_test_...
CLERK_ISSUER_URL=https://your-clerk-domain.clerk.accounts.dev
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
# Convex Database
CONVEX_DEPLOYMENT=prod:your-project
NEXT_PUBLIC_CONVEX_URL=https://your-project.convex.cloud
CONVEX_DEPLOY_KEY=your_convex_deploy_key # only for production
# Stripe
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_live_...
STRIPE_SECRET_KEY=sk_live_...
STRIPE_WEBHOOK_SECRET=whsec_...
NEXT_PUBLIC_FEATURED_PRICE=4900
# Email (Resend)
RESEND_API_KEY=re_...
FROM_EMAIL="Dirly <noreply@dirly.com>"
NEXT_PUBLIC_ADMIN_EMAIL=admin@dirly.com
Security Best Practices
Never commit .env.local to version control. Make sure .env.local is in your .gitignore file.
-
Use different keys for development and production. Create separate Clerk, Convex, and Stripe projects for each environment.
-
Rotate keys regularly – especially if they may have been exposed.
-
Limit admin access – only add trusted user IDs to
NEXT_PUBLIC_ADMIN_USER_IDS. -
Use webhook signing – always verify Stripe webhook signatures using
STRIPE_WEBHOOK_SECRETto prevent fraudulent events.
Verifying Configuration
After setting up your environment variables:
-
Restart both development servers (Convex and Next.js).
-
Check the browser console for any authentication errors.
-
Try signing in to verify Clerk is working.
-
Check the Convex dashboard to ensure database connection is active.
-
Test admin access by navigating to /admin (if your user ID is in the admin list).
-
Test a payment using Stripe test keys to confirm checkout and webhook handling.