How to set up
2024/10/25
3 min read

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

VariableDescription
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.

VariableDescription
NEXT_PUBLIC_SANITY_PROJECT_IDSanity project ID
NEXT_PUBLIC_SANITY_DATASETSanity dataset name
SANITY_API_TOKENSanity API token

Authentication

Learn how to set up authentication in the Authentication Setup guide.

VariableDescription
AUTH_SECRETSecret for NextAuth authentication
AUTH_GOOGLE_IDGoogle OAuth client ID
AUTH_GOOGLE_SECRETGoogle OAuth client secret
AUTH_GITHUB_IDGitHub OAuth client ID
AUTH_GITHUB_SECRETGitHub OAuth client secret

Email & Newsletter

Learn how to set up email in the Resend Setup guide.

VariableDescription
RESEND_API_KEYAPI key for Resend email service
RESEND_AUDIENCE_IDAudience ID for Resend broadcast service
RESEND_EMAIL_FROMSender email address
RESEND_EMAIL_ADMINAdmin email address

Payment

Learn how to set up payments in the Stripe Setup guide.

VariableDescription
STRIPE_API_KEYStripe API key
STRIPE_WEBHOOK_SECRETStripe webhook signing secret
NEXT_PUBLIC_STRIPE_PRO_PRICE_IDStripe price ID for paid submission

Analytics

Learn how to set up analytics in the Analytics Setup guide.

VariableDescription
NEXT_PUBLIC_GOOGLE_ANALYTICS_IDGoogle Analytics ID
NEXT_PUBLIC_OPENPANEL_CLIENT_IDOpenPanel Analytics client ID
NEXT_PUBLIC_UMAMI_WEBSITE_IDUmami website ID
NEXT_PUBLIC_UMAMI_SCRIPTUmami script URL
NEXT_PUBLIC_PLAUSIBLE_DOMAINPlausible domain
NEXT_PUBLIC_PLAUSIBLE_SCRIPTPlausible script URL

AI Features

Learn how to set up AI features in the AI Setup guide.

VariableDescription
DEFAULT_AI_PROVIDERDefault AI provider for AI features: google, deepseek, openai
GOOGLE_GENERATIVE_AI_API_KEYGoogle Generative AI API key for AI features
OPENAI_API_KEYOpenAI API key for AI features
DEEPSEEK_API_KEYDeepSeek API key for AI features

Verifying Environment Variables

To verify that your environment variables are correctly set up, run:

pnpm 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:

Author

avatar for Fox
Fox

Categories

Newsletter

Join the community

Subscribe to our newsletter for the latest news and updates