LogoMkSaaS
  • Características
  • Precios
  • Blog
  • Documentos
  • escaparate
How to set up
2025/05/10

How to set up

How to build your AI SaaS with MkSaaS template

MkSaaS requires several environment variables to work correctly. 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_BASE_URLThe public URL of your site, e.g.
http://localhost:3000 for development,
https://YOUR-DOMAIN.com for production

Database

Learn how to set up a database in the Database Setup guide.

VariableDescription
DATABASE_URLDatabase connection URL

Authentication

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

VariableDescription
BETTER_AUTH_SECRETA random string used to hash tokens and sign cookies
GOOGLE_CLIENT_IDGoogle OAuth client ID (optional)
GOOGLE_CLIENT_SECRETGoogle OAuth client secret (optional)
GITHUB_CLIENT_IDGitHub OAuth client ID (optional)
GITHUB_CLIENT_SECRETGitHub OAuth client secret (optional)

Email

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

VariableDescription
RESEND_API_KEYAPI key for Resend email service

Newsletter

Learn how to set up newsletter in the Newsletter Setup guide.

VariableDescription
RESEND_API_KEYAPI key for Resend email service

Storage

Learn how to set up storage in the Storage Setup guide.

VariableDescription
STORAGE_REGIONRegion for the storage bucket
STORAGE_BUCKET_NAMEName of the storage bucket
STORAGE_ACCESS_KEY_IDAccess key ID for the storage bucket
STORAGE_SECRET_ACCESS_KEYSecret access key for the storage bucket
STORAGE_ENDPOINTEndpoint for the storage bucket
STORAGE_PUBLIC_URLPublic URL for the storage bucket

Payment

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

Select the active provider with NEXT_PUBLIC_PAYMENT_PROVIDER: stripe, creem, or waffo (default: stripe). Configure only the credentials and price/product IDs for the provider you use.

VariableDescription
NEXT_PUBLIC_PAYMENT_PROVIDERActive provider: stripe, creem, or waffo (default: stripe)
STRIPE_SECRET_KEYStripe secret key
STRIPE_WEBHOOK_SECRETStripe webhook signing secret
NEXT_PUBLIC_STRIPE_PRICE_PRO_MONTHLYStripe price ID for pro monthly subscription
NEXT_PUBLIC_STRIPE_PRICE_PRO_YEARLYStripe price ID for pro yearly subscription
NEXT_PUBLIC_STRIPE_PRICE_LIFETIMEStripe price ID for lifetime subscription
NEXT_PUBLIC_STRIPE_PRICE_CREDITS_BASICStripe price ID for basic credit package (optional)
NEXT_PUBLIC_STRIPE_PRICE_CREDITS_STANDARDStripe price ID for standard credit package (optional)
NEXT_PUBLIC_STRIPE_PRICE_CREDITS_PREMIUMStripe price ID for premium credit package (optional)
NEXT_PUBLIC_STRIPE_PRICE_CREDITS_ENTERPRISEStripe price ID for enterprise credit package (optional)
CREEM_DEBUGSet to true to use Creem's test API (optional)
CREEM_API_KEYCreem API key
CREEM_WEBHOOK_SECRETCreem webhook signing secret
NEXT_PUBLIC_CREEM_PRODUCT_PRO_MONTHLYCreem product ID for pro monthly subscription
NEXT_PUBLIC_CREEM_PRODUCT_PRO_YEARLYCreem product ID for pro yearly subscription
NEXT_PUBLIC_CREEM_PRODUCT_LIFETIMECreem product ID for lifetime one-time payment
NEXT_PUBLIC_CREEM_PRODUCT_CREDITS_BASICCreem product ID for basic credit package (optional)
NEXT_PUBLIC_CREEM_PRODUCT_CREDITS_STANDARDCreem product ID for standard credit package (optional)
NEXT_PUBLIC_CREEM_PRODUCT_CREDITS_PREMIUMCreem product ID for premium credit package (optional)
NEXT_PUBLIC_CREEM_PRODUCT_CREDITS_ENTERPRISECreem product ID for enterprise credit package (optional)
WAFFO_DEBUGSet to true to accept sandbox webhooks in a production build (optional, smoke testing only)
WAFFO_MERCHANT_IDWaffo Merchant ID from Dashboard > API & Development
WAFFO_PRIVATE_KEYWaffo private key, server-side only; preserve PEM line breaks with escaped \n
NEXT_PUBLIC_WAFFO_PRODUCT_PRO_MONTHLYWaffo product ID for pro monthly subscription
NEXT_PUBLIC_WAFFO_PRODUCT_PRO_YEARLYWaffo product ID for pro yearly subscription
NEXT_PUBLIC_WAFFO_PRODUCT_LIFETIMEWaffo product ID for lifetime one-time payment
NEXT_PUBLIC_WAFFO_PRODUCT_CREDITS_BASICWaffo product ID for basic credit package (optional)
NEXT_PUBLIC_WAFFO_PRODUCT_CREDITS_STANDARDWaffo product ID for standard credit package (optional)
NEXT_PUBLIC_WAFFO_PRODUCT_CREDITS_PREMIUMWaffo product ID for premium credit package (optional)
NEXT_PUBLIC_WAFFO_PRODUCT_CREDITS_ENTERPRISEWaffo product ID for enterprise credit package (optional)

AI Features

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

VariableDescription
OPENAI_API_KEYAPI key for OpenAI
FAL_API_KEYAPI key for FAL
FIREWORKS_API_KEYAPI key for Fireworks
REPLICATE_API_TOKENAPI key for Replicate
GOOGLE_GENERATIVE_AI_API_KEYAPI key for Google Generative AI
DEEPSEEK_API_KEYAPI key for DeepSeek
OPENROUTER_API_KEYAPI key for OpenRouter

Cron Jobs

Learn how to set up cron jobs in the Cron Jobs Setup guide.

VariableDescription
CRON_JOBS_USERNAMEUsername for basic authentication to trigger cron jobs
CRON_JOBS_PASSWORDPassword for basic authentication to trigger cron jobs

Analytics

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

VariableDescription
GOOGLE_ANALYTICS_IDGoogle Analytics ID
UMAMI_WEBSITE_IDUmami Analytics website ID
UMAMI_SCRIPTUmami Analytics script URL
OPENPANEL_CLIENT_IDOpenPanel Analytics client ID
PLAUSIBLE_DOMAINPlausible Analytics domain
PLAUSIBLE_SCRIPTPlausible Analytics script URL
Seline_TOKENSeline Analytics token
DATAFAST_ANALYTICS_IDDataFast Analytics ID
DATAFAST_ANALYTICS_DOMAINDataFast Analytics domain

Notification

Learn how to set up notification in the Notification Setup guide.

VariableDescription
DISCORD_WEBHOOK_URLDiscord webhook URL for receiving notifications of successful payments
FEISHU_WEBHOOK_URLFeishu webhook URL for receiving notifications of successful payments

Captcha

Learn how to set up captcha in the Captcha Setup guide.

VariableDescription
NEXT_PUBLIC_TURNSTILE_SITE_KEYTurnstile site key
TURNSTILE_SECRET_KEYTurnstile secret key

Chatbox

Learn how to set up chatbox in the Chatbox Setup guide.

VariableDescription
NEXT_PUBLIC_CRISP_WEBSITE_IDCrisp website ID for chat features

Affiliates

Learn how to set up affiliates in the Affiliates Setup guide.

VariableDescription
NEXT_PUBLIC_AFFILIATE_AFFONSO_IDAffonso affiliate ID
NEXT_PUBLIC_AFFILIATE_PROMOTEKIT_IDPromotekit 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.

VariableDescription
DISABLE_IMAGE_OPTIMIZATIONDisable image optimization, if you deploy your website to Vercel, image optimization is enabled by default, and may cost you more money
NEXT_PUBLIC_DEMO_WEBSITERun 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

If everything is configured correctly, your application should start without any environment-related errors.

Next Steps

Now that your environment is set up, explore these related topics:

Configuration

Configure website settings

Getting Started

Set up and run your MkSaaS website

Database Setup

Configure database

IDE Setup

Configure your development environment

Todas las publicaciones

Autor

avatar for Fox
Fox

Categorías

  • Tutorial
Environment VariablesCore ConfigurationDatabaseAuthenticationEmailNewsletterStoragePaymentAI FeaturesCron JobsAnalyticsNotificationCaptchaChatboxAffiliatesOther ConfigurationsVerifying Environment VariablesNext Steps

Más publicaciones

2025年的年终总结

2025年的年终总结

2025年的年终总结,回顾过去独立开发之路,展望未来产品出海规划

avatar for Fox
Fox
2026/01/03
MkSaaS AI Module
Feature

MkSaaS AI Module

Deep dive into MkSaaS template's AI module, including AI chatbot, AI text generator, AI image generator, and other core features to help you quickly build powerful AI SaaS applications

avatar for Fox
Fox
2025/11/16
Video Tutorials
Tutorial

Video Tutorials

Video tutorials for MkSaaS template

avatar for Fox
Fox
2025/08/25

Boletín

Únete a la comunidad

Suscríbete a nuestro boletín para recibir las últimas noticias y actualizaciones.

LogoMkSaaS

Haga su producto AI SaaS en un fin de semana

GitHubBlueskyYouTube
Built withLogo of MkSaaSMkSaaS
Producto
  • Características
  • Precios
  • Preguntas frecuentes
Recursos
  • Blog
  • Documentación
  • Registro de cambios
  • Se compromete
Empresa
  • 💰 Afiliados
  • 🤟 Enviar
  • 💬 Únase a Discord
  • 🔥 MkSaaS vs TanStarter
Legales
  • Política de licencia
  • Política de privacidad
  • Términos de servicio
MkSaaS - Make Your AI SaaS Product in a weekend | Product Hunt
Monitor your Domain Rating with FrogDRPeerlist BadgeOpen-Launch Top 2 Daily Winner
Fazier BadgeUneed Embed BadgeFeatured on Startup FameBest SaaS Boilerplates Verified Badge
© 2026 MkSaaS. All Rights Reserved.