
How to set up
How to build your directory website with Mkdirs template
Mkdirs requires several environment variables to function properly, and this guide explains how to set them up.
Create a .env
file in the root directory of your project, and never commit it to version control.
You can copy the example file as a starting point:
cp env.example .env
Environment Variables
Core Configuration
Variable | Description |
---|---|
NEXT_PUBLIC_APP_URL | "http://localhost:3000" or "https://mkdirs.com" |
Database & Storage
Learn how to set up a database in the Sanity Setup guide.
Variable | Description |
---|---|
NEXT_PUBLIC_SANITY_PROJECT_ID | Sanity project ID |
NEXT_PUBLIC_SANITY_DATASET | Sanity dataset name |
SANITY_API_TOKEN | Sanity API token |
Authentication
Learn how to set up authentication in the Authentication Setup guide.
Variable | Description |
---|---|
AUTH_SECRET | Secret for NextAuth authentication |
AUTH_GOOGLE_ID | Google OAuth client ID |
AUTH_GOOGLE_SECRET | Google OAuth client secret |
AUTH_GITHUB_ID | GitHub OAuth client ID |
AUTH_GITHUB_SECRET | GitHub OAuth client secret |
Email & Newsletter
Learn how to set up email in the Resend Setup guide.
Variable | Description |
---|---|
RESEND_API_KEY | API key for Resend email service |
RESEND_AUDIENCE_ID | Audience ID for Resend broadcast service |
RESEND_EMAIL_FROM | Sender email address |
RESEND_EMAIL_ADMIN | Admin email address |
Payment
Learn how to set up payments in the Stripe Setup guide.
Variable | Description |
---|---|
STRIPE_API_KEY | Stripe API key |
STRIPE_WEBHOOK_SECRET | Stripe webhook signing secret |
NEXT_PUBLIC_STRIPE_PRICE_PRO_MONTHLY | Stripe price ID for your pro monthly subscription |
NEXT_PUBLIC_STRIPE_PRICE_PRO_YEARLY | Stripe price ID for your pro yearly subscription |
NEXT_PUBLIC_STRIPE_PRICE_LIFETIME | Stripe price ID for your lifetime subscription |
NEXT_PUBLIC_STRIPE_PRICE_CREDITS_BASIC | Stripe price ID for your basic credit package (optional) |
NEXT_PUBLIC_STRIPE_PRICE_CREDITS_STANDARD | Stripe price ID for your standard credit package (optional) |
NEXT_PUBLIC_STRIPE_PRICE_CREDITS_PREMIUM | Stripe price ID for your premium credit package (optional) |
NEXT_PUBLIC_STRIPE_PRICE_CREDITS_ENTERPRISE | Stripe price ID for your enterprise credit package (optional) |
Analytics
Learn how to set up analytics in the Analytics Setup guide.
Variable | Description |
---|---|
NEXT_PUBLIC_GOOGLE_ANALYTICS_ID | Google Analytics ID |
NEXT_PUBLIC_OPENPANEL_CLIENT_ID | OpenPanel Analytics client ID |
NEXT_PUBLIC_UMAMI_WEBSITE_ID | Umami website ID |
NEXT_PUBLIC_UMAMI_SCRIPT | Umami script URL |
NEXT_PUBLIC_PLAUSIBLE_DOMAIN | Plausible domain |
NEXT_PUBLIC_PLAUSIBLE_SCRIPT | Plausible script URL |
Affiliates
Learn how to set up affiliates in the Affiliates Setup guide.
Variable | Description |
---|---|
NEXT_PUBLIC_AFFILIATE_AFFONSO_ID | Affonso affiliate ID |
NEXT_PUBLIC_AFFILIATE_PROMOTEKIT_ID | Promotekit affiliate ID |
AI Features
Learn how to set up AI features in the AI Setup guide.
Variable | Description |
---|---|
DEFAULT_AI_PROVIDER | Default AI provider for AI features: google , deepseek , openai |
GOOGLE_GENERATIVE_AI_API_KEY | Google Generative AI API key for AI features |
OPENAI_API_KEY | OpenAI API key for AI features |
DEEPSEEK_API_KEY | DeepSeek API key for AI features |
Background Jobs
Learn how to set up background jobs in the Background Jobs Setup guide.
Variable | Description |
---|---|
INNGEST_SIGNING_KEY | Inngest signing key for scheduled jobs |
Analytics
Learn how to set up analytics in the Analytics Setup guide.
Variable | Description |
---|---|
GOOGLE_ANALYTICS_ID | Google Analytics ID |
UMAMI_WEBSITE_ID | Umami Analytics website ID |
UMAMI_SCRIPT | Umami Analytics script URL |
OPENPANEL_CLIENT_ID | OpenPanel Analytics client ID |
PLAUSIBLE_DOMAIN | Plausible Analytics domain |
PLAUSIBLE_SCRIPT | Plausible Analytics script URL |
Seline_TOKEN | Seline Analytics token |
DATAFAST_ANALYTICS_ID | DataFast Analytics ID |
DATAFAST_ANALYTICS_DOMAIN | DataFast Analytics domain |
Notification
Learn how to set up notification in the Notification Setup guide.
Variable | Description |
---|---|
DISCORD_WEBHOOK_URL | Discord webhook URL for receiving notifications of successful payments |
FEISHU_WEBHOOK_URL | Feishu webhook URL for receiving notifications of successful payments |
Captcha
Learn how to set up captcha in the Captcha Setup guide.
Variable | Description |
---|---|
NEXT_PUBLIC_TURNSTILE_SITE_KEY | Turnstile site key |
TURNSTILE_SECRET_KEY | Turnstile secret key |
Chatbox
Learn how to set up chatbox in the Chatbox Setup guide.
Variable | Description |
---|---|
NEXT_PUBLIC_CRISP_WEBSITE_ID | Crisp website ID for chat features |
Affiliates
Learn how to set up affiliates in the Affiliates Setup guide.
Variable | Description |
---|---|
NEXT_PUBLIC_AFFILIATE_AFFONSO_ID | Affonso affiliate ID |
NEXT_PUBLIC_AFFILIATE_PROMOTEKIT_ID | Promotekit affiliate ID |
Other Configurations
Some other configurations are also available in the .env
file, you may need to set them up depending on your needs.
Variable | Description |
---|---|
DISABLE_IMAGE_OPTIMIZATION | Disable image optimization, if you deploy your website to Vercel, image optimization is enabled by default, and may cost you more money |
NEXT_PUBLIC_DEMO_WEBSITE | Run this website as demo website, I use this for MkSaaS demo website. In most cases, you should not set this or leave it to false |
Verifying Environment Variables
To verify that your environment variables are correctly set up, run:
pnpm run dev
npm run dev
yarn dev
bun run dev
If everything is configured correctly, your application should start and run normally without any environment-related errors.
Next Steps
Now that your environment is set up, explore these related topics: