Skip to main content

Overview

Mizen requires several environment variables to be configured for full functionality. This guide covers all required and optional environment variables.

Environment Files

Mizen uses different environment files for different deployment environments:
  • .env.local - Local development (not committed to git)
  • .env.development.local - Development-specific overrides
  • .env.test.local - Testing environment
  • .env.production.local - Production-specific overrides
Never commit .env files containing secrets to version control. These files are included in .gitignore and .dockerignore.

Required Environment Variables

Groq API Key

The Groq API is used for AI-powered recipe parsing and ingredient extraction.
1

Create a Groq account

2

Generate an API key

Navigate to your dashboard and create a new API key.
3

Accept model terms

If you encounter a “model_terms_required” error, visit the model playground to accept the terms for the models you plan to use.
4

Add to environment file

.env.local
GROQ_API_KEY=your_groq_api_key_here

Supabase Configuration

Supabase is used for database operations and authentication.
.env.local
# Public Supabase URL
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url

# Public anonymous key (safe to expose in client-side code)
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key

# Service role key (server-side only, keep secret)
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key
  1. Create a project at https://supabase.com
  2. Navigate to Settings > API
  3. Copy the Project URL for NEXT_PUBLIC_SUPABASE_URL
  4. Copy the anon/public key for NEXT_PUBLIC_SUPABASE_ANON_KEY
  5. Copy the service_role key for SUPABASE_SERVICE_ROLE_KEY
The service_role key bypasses Row Level Security. Never expose it in client-side code.

Optional Environment Variables

Notion Integration (Feedback System)

If you want to enable the feedback system that sends data to Notion:
.env.local
# Notion API key for feedback collection
NOTION_API_KEY=your_notion_integration_token

# Notion database ID for storing feedback
NOTION_FEEDBACK_DATABASE_ID=your_notion_database_id
  1. Create a Notion integration at https://www.notion.so/my-integrations
  2. Copy the Internal Integration Token for NOTION_API_KEY
  3. Create a database in Notion for feedback
  4. Share the database with your integration
  5. Copy the database ID from the URL for NOTION_FEEDBACK_DATABASE_ID

Application Versioning

.env.local
# App version displayed in the UI (defaults to 0.1.0)
NEXT_PUBLIC_APP_VERSION=0.1.0

Deployment Environment

.env.local
# Vercel environment (automatically set by Vercel)
NEXT_PUBLIC_VERCEL_ENV=preview

# Node environment (development, production, or test)
NODE_ENV=development

Complete Example

Here’s a complete .env.local file template:
.env.local
# ============================================
# REQUIRED - AI Processing
# ============================================
GROQ_API_KEY=gsk_your_groq_api_key_here

# ============================================
# REQUIRED - Database & Authentication
# ============================================
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

# ============================================
# OPTIONAL - Feedback System
# ============================================
NOTION_API_KEY=secret_your_notion_token
NOTION_FEEDBACK_DATABASE_ID=abc123def456

# ============================================
# OPTIONAL - Application Config
# ============================================
NEXT_PUBLIC_APP_VERSION=0.1.0

Environment Variable Usage

Client-Side vs Server-Side

Next.js handles environment variables differently based on their prefix:

Client-Side

Variables prefixed with NEXT_PUBLIC_ are exposed to the browser.
// Available in client components
process.env.NEXT_PUBLIC_SUPABASE_URL

Server-Side

Variables without the prefix are only available on the server.
// Only available in API routes and server components
process.env.GROQ_API_KEY
Never prefix sensitive keys (API secrets, service role keys) with NEXT_PUBLIC_ as this will expose them in the client-side bundle.

Validating Your Setup

After configuring your environment variables:
1

Restart the development server

npm run dev
2

Check for missing variables

The application will log errors in the console if required environment variables are missing.
3

Test functionality

  • Try parsing a recipe URL to verify Groq API integration
  • Check authentication features to verify Supabase configuration
  • Submit feedback to verify Notion integration (if configured)

Troubleshooting

Error: GROQ_API_KEY is not configuredSolution: Ensure the GROQ_API_KEY is set in your .env.local file and the server has been restarted.Error: model_terms_requiredSolution: Visit https://console.groq.com/playground and accept the terms for the models being used.
Error: Invalid Supabase URL or authentication failuresSolution:
  • Verify the URL format: https://your-project.supabase.co
  • Check that the anon key and service role key match your project
  • Ensure Row Level Security policies are configured correctly
Issue: Changes to .env.local not taking effectSolution:
  1. Restart the Next.js development server completely
  2. Clear .next cache: rm -rf .next
  3. Verify the file is named exactly .env.local (not .env.local.txt)
  4. Check that the file is in the project root directory

Security Best Practices

Use Strong Keys

Generate cryptographically secure API keys and rotate them regularly.

Limit Permissions

Use the minimum permissions necessary. For example, use anon keys for client-side Supabase access.

Never Commit Secrets

Always add .env* files to .gitignore to prevent accidental commits.

Use Different Keys

Use separate API keys for development, staging, and production environments.

Next Steps

Installation

Install dependencies and set up your development environment

Docker Setup

Deploy Mizen using Docker containers

Build docs developers (and LLMs) love