Takazudo Modular Docs

Type to search...

to open search from anywhere

Local Environment Variables

Local Environment Variables

This document describes the environment variables used for local development in the Takazudo Modular project.

Configuration Files

  • .env: Local environment configuration (gitignored, contains actual values)
  • .env.example: Template for environment variables (committed to repository)

Configured Environment Variables

1. Netlify Deployment (Local Testing)

NETLIFY_AUTH_TOKEN

  • Type: 🔴 Secret (Authentication)
  • Required: Only for local deploy testing
  • Purpose: Authenticates netlify-cli for deployments
  • Generation: Netlify Dashboard → User Settings → Applications → Personal Access Tokens

NETLIFY_SITE_ID

  • Type: 🟢 Non-secret (Identifier)
  • Required: Only for local deploy testing
  • Purpose: Identifies the target Netlify site for deployments
  • Format: UUID (e.g., xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)

3. Cloudflare R2 (Image CDN)

R2_ACCOUNT_ID

  • Type: 🟢 Non-secret (Identifier)
  • Required: For R2 upload/download
  • Purpose: Cloudflare account identifier for R2 API access
  • Used in:
    • scripts/upload-images-to-r2.mjs - Upload images to R2
    • scripts/download-images-from-r2.mjs - Download images from R2

R2_ACCESS_KEY_ID

  • Type: 🔴 Secret (Authentication)
  • Required: For R2 upload/download
  • Purpose: S3-compatible access key for R2 API
  • Generation: Cloudflare Dashboard → R2 → Manage R2 API Tokens

R2_SECRET_ACCESS_KEY

  • Type: 🔴 Secret (Authentication)
  • Required: For R2 upload/download
  • Purpose: S3-compatible secret key for R2 API

R2_BUCKET_NAME

  • Type: 🟢 Non-secret (Identifier)
  • Required: No (default: zmodmedia)
  • Purpose: R2 bucket name override

4. Cross-Project Integration

ZMANUALS_REPO_PATH

  • Type: 🟢 Path
  • Required: Only for manual sync skills
  • Purpose: Path to the zmanuals translation project repository
  • Used by:
    • /sync-product-manual-mapping skill - Syncs product-manual mapping
    • /update-manual-list skill - Syncs manual listing page
  • Default Value:
ZMANUALS_REPO_PATH=/Users/takazudo/repos/personal/zmanuals

5. MDX Content Control

IGNORE_OLD_MDX

  • Type: 🟢 Flag
  • Required: No
  • Purpose: Ignores older MDX files during build to speed up development
  • Note: Commented out by default

UNIGNORE_MDX

  • Type: 🟢 String
  • Required: No
  • Purpose: Excludes specific MDX files from the IGNORE_OLD_MDX filter
  • Example:
IGNORE_OLD_MDX=true
UNIGNORE_MDX=2025-06-01-addac511-vc-stochastic-vg-intro

6. Preorder Admin (zpreorder)

PREORDER_API_TOKEN

  • Type: 🔴 Secret (Authentication)
  • Required: For preorder admin features
  • Purpose: Server-side authentication token for the preorder admin API
  • Used in:
    • Netlify Functions (netlify/functions/) — validates admin API requests
  • Note: Must match the value set in Netlify site environment variables

VITE_PREORDER_API_TOKEN

  • Type: 🔴 Secret (Authentication)
  • Required: For zpreorder client app
  • Purpose: Client-side version of PREORDER_API_TOKEN (same value, VITE_ prefix exposes it to Vite)
  • Used in:
    • sub-packages/zpreorder/src/utils/api-client.js — Bearer token for admin API calls
  • Note: The init-worktree script auto-generates sub-packages/zpreorder/.env with this value from the root .env

7. Testing & Debugging

BASE_URL

  • Type: 🟢 URL
  • Required: No (has default)
  • Purpose: Base URL for E2E tests and validation scripts
  • Default: http://zmod.localhost:34434
  • Used in:
    • playwright.config.js - E2E test configuration
    • tests/e2e/*.spec.js - All E2E test files
    • scripts/validate-links.js - Link validation
    • scripts/check-all-pages.cjs - 404 checker

TIMEOUT_PER_PAGE

  • Type: 🟢 Number (milliseconds)
  • Required: No
  • Purpose: Timeout for E2E page tests
  • Default: 60000ms in CI, 30000ms locally
  • Used in:
    • tests/e2e/full-check-production.spec.js
    • tests/e2e/all-*.spec.js

DEBUG_IMAGE_METADATA

  • Type: 🟢 Flag
  • Required: No
  • Purpose: Enables verbose logging for image metadata loading
  • Used in:
    • lib/images/metadata-loader.ts
    • lib/images/resolve-metadata-path.ts
    • lib/image-metadata.ts
    • lib/data/images/load-metadata-database.ts
DEBUG_IMAGE_METADATA=true

IMAGE_METADATA_DIR

  • Type: 🟢 Path
  • Required: No
  • Purpose: Override the default image metadata directory
  • Used in:
    • lib/images/metadata-loader.ts
    • lib/images/resolve-metadata-path.ts

PLAYWRIGHT_TEST

  • Type: 🟢 Flag
  • Required: No (set automatically)
  • Purpose: Indicates the environment is running Playwright tests
  • Used in:
    • lib/images/metadata-loader.ts - Adjusts metadata loading behavior
    • lib/images/resolve-metadata-path.ts - Uses test-specific paths

DEBUG

  • Type: 🟢 Flag
  • Required: No
  • Purpose: General debug flag for verbose output
  • Used in: Various scripts for verbose output

8. Build Environment

NODE_ENV

  • Type: 🟢 Standard
  • Values: development, production, test
  • Purpose: Standard Node.js environment indicator
  • Set by: Astro automatically based on command (dev vs build)
  • Used in: Various components and utilities for environment-specific behavior

CI

  • Type: 🟢 Flag
  • Required: No (set automatically in CI)
  • Purpose: Indicates the environment is a CI/CD pipeline
  • Used in:
    • playwright.config.js - Adjusts test settings
    • astro.config.ts - Build configuration
    • tests/e2e/helpers/ci-image-interceptor.js - Enables image route interception

Sample .env File

# Netlify local testing (optional)
NETLIFY_AUTH_TOKEN=xxxxxx
NETLIFY_SITE_ID=xxxxxx

# Cloudflare R2 (Image CDN)
R2_ACCOUNT_ID=xxxxxx
R2_BUCKET_NAME=zmodmedia
# S3-compatible Access Key with Object Read & Write permission
R2_ACCESS_KEY_ID=xxxxxx
R2_SECRET_ACCESS_KEY=xxxxxx

# Preorder Admin API
PREORDER_API_TOKEN=xxxxxx
VITE_PREORDER_API_TOKEN=xxxxxx

# Email service
RESEND_API_KEY=re_xxxxxxxxx

# zmanuals project path for sync skills
ZMANUALS_REPO_PATH=/Users/takazudo/repos/personal/zmanuals

# Webhook notifications (Netlify Functions)
SLACK_RESTOCK_WEBHOOK_URL=https://hooks.slack.com/services/xxx/yyy/zzz
SLACK_RESERVATION_WEBHOOK_URL=https://hooks.slack.com/services/xxx/yyy/zzz
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/xxx/yyy

# Production deploy notifications (CI/CD only)
# IFTTT_PROD_NOTIFY=https://maker.ifttt.com/trigger/zmod/with/key/xxxxxx
# SLACK_PROD_NOTIFY=https://hooks.slack.com/services/xxx/yyy/zzz

# Debug flags (optional)
# DEBUG_IMAGE_METADATA=true

Quick Reference Table

VariableRequiredTypePurpose
NETLIFY_AUTH_TOKENFor deploySecretNetlify authentication
NETLIFY_SITE_IDFor deployPublicNetlify site ID
R2_ACCOUNT_IDFor R2PublicCloudflare account ID
R2_ACCESS_KEY_IDFor R2SecretR2 S3-compatible access key
R2_SECRET_ACCESS_KEYFor R2SecretR2 S3-compatible secret key
R2_BUCKET_NAMENoPublicR2 bucket name (default: zmodmedia)
PREORDER_API_TOKENFor preorderSecretPreorder admin API auth
VITE_PREORDER_API_TOKENFor zpreorderSecretClient-side preorder token
RESEND_API_KEYFor emailSecretResend email API key
ZMANUALS_REPO_PATHFor syncPathzmanuals repo location
SLACK_RESTOCK_WEBHOOK_URLFor restock notifySecretSlack restock webhook
SLACK_RESERVATION_WEBHOOK_URLFor reservation notifySecretSlack reservation webhook
DISCORD_WEBHOOK_URLFor Discord notifySemi-publicDiscord stock-notify webhook
IFTTT_PROD_NOTIFYNoSecretIFTTT deploy notification
SLACK_PROD_NOTIFYNoSecretSlack deploy notification
BASE_URLNoURLE2E test base URL
DEBUG_IMAGE_METADATANoFlagImage debug logging

9. Webhook Notifications

SLACK_RESTOCK_WEBHOOK_URL

  • Type: 🔴 Secret (Webhook)
  • Required: For Netlify Functions (restock notifications)
  • Purpose: Slack incoming webhook for 入荷通知 (restock notifications)
  • Used in:
    • Netlify Functions — sends restock alerts to a private Slack channel
  • Setup: Slack API → Incoming Webhooks → select channel

SLACK_RESERVATION_WEBHOOK_URL

  • Type: 🔴 Secret (Webhook)
  • Required: For Netlify Functions (reservation notifications)
  • Purpose: Slack incoming webhook for 予約 (reservation notifications)
  • Used in:
    • Netlify Functions — sends reservation alerts to a private Slack channel

DISCORD_WEBHOOK_URL

  • Type: 🟡 Semi-public (Webhook)
  • Required: For Netlify Functions (Discord notifications)
  • Purpose: Discord webhook for the public stock-notify channel
  • Used in:
    • Netlify Functions — sends stock updates to a public Discord channel
  • Note: No private information is sent through this webhook

RESEND_API_KEY

  • Type: 🔴 Secret (API Key)
  • Required: For email notifications
  • Purpose: Resend API key for sending transactional emails (restock/reservation confirmations)
  • Used in:
    • Netlify Functions — sends confirmation emails
  • Setup: https://resend.com/api-keys

10. Production Deploy Notifications (CI/CD only)

These variables are primarily used as GitHub Actions secrets. They are stored in .env for reference but are not used by the local dev server.

IFTTT_PROD_NOTIFY

  • Type: 🔴 Secret (Webhook)
  • Required: No (notification skipped if not set)
  • Purpose: IFTTT webhook that sends mobile push notifications on production deploy success/failure
  • Used in:
    • .github/workflows/main-deploy.ymlnotify job
  • Payload: value1 = status message, value2 = commit info, value3 = workflow run URL
  • Setup: https://ifttt.com/maker_webhooks

SLACK_PROD_NOTIFY

  • Type: 🔴 Secret (Webhook)
  • Required: No (notification skipped if not set)
  • Purpose: Slack incoming webhook for production deploy success/failure notifications
  • Used in:
    • .github/workflows/main-deploy.ymlnotify job
  • Setup: Slack API → Incoming Webhooks → select channel