Skip to main content

Environment Variables & Configuration Matrix

This document provides an exhaustive reference of all environment variables utilized across veridex-hitech-web-application.

Critical variables are strictly validated at startup using Zod in src/lib/env.ts.

:::warning Security Boundary Never commit real secrets, private certificates, API tokens, or production database credentials to source repositories. In cloud deployments (Azure App Services, Vercel), secrets must be injected through environment configuration panels or backed by Azure Key Vault references. :::


1. Master Environment Variable Reference Table​

VariablePurposeRequiredExample / FormatUsed By
NEXT_PUBLIC_APP_URLCanonical public-facing base URL of the deployment. Used for canonical redirects, OpenGraph image resolution, and email links.Yeshttps://hitechinsurance.ai (Prod)
http://localhost:3000 (Local)
Layout, SEO metadata, Email templates, src/lib/env.ts
NEXT_PUBLIC_APP_ENVDeployment environment discriminator (development, staging, production). Overcomes Vercel setting NODE_ENV=production on all branches.Yesproduction | staging | developmentDeployment routing, environment banners, src/lib/env.ts
DATABASE_URLMongoDB connection URI including user credentials, hosts, replica set parameters, and database name.Yesmongodb+srv://user:pass@cluster.mongodb.net/hitech_insurance?retryWrites=true&w=majorityMongoose connection manager (src/lib/db/mongoose.ts)
NEXTAUTH_SECRETCryptographic 32-byte secret used by Auth.js to sign and encrypt JWT session cookies.YesHex string generated via openssl rand -hex 32NextAuth configuration (src/lib/auth.ts)
NEXTAUTH_URLCanonical URL used by NextAuth to resolve callback handlers and authentication redirection.Yeshttps://hitechinsurance.ai (Prod)
http://localhost:3000 (Local)
NextAuth callback router
SEED_SUPER_ADMIN_EMAILDefault email address provisioned by the super-admin seeding script.Nosuper.admin@hitechinsurance.aiscripts/seed-super-admin.ts
SEED_SUPER_ADMIN_PASSWORDInitial plaintext password for the seeded super-admin account.NoHigh-entropy password stringscripts/seed-super-admin.ts
SWAGGER_DOCS_PASSWORD_HASHBcrypt hash of the access password protecting interactive OpenAPI Swagger documentation at /api/docs.Yes$2b$12$... (Bcrypt hash)/api/docs/auth route handler
HTI_LEAD_HMAC_SECRET15-character shared cryptographic secret used to sign and verify inbound partner lead requests via HMAC-SHA256.Yes15-character alphanumeric secret/api/leads/*, src/lib/hti-leads/verify.ts
HTI_CRM_URLHTTPS endpoint for forwarding qualified personal and commercial leads to the enterprise HTI CRM.Integrationhttps://crm.staging.hightechinsurance.com/api/landing-page/save-leadssrc/lib/hti-crm.ts (sendLeadToHtiCrm)
HTI_CRM_USERNAMEHTTP Basic Authentication username for the HTI CRM endpoint.IntegrationAlphanumeric service usernamesrc/lib/hti-crm.ts
HTI_CRM_PASSWORDHTTP Basic Authentication password for the HTI CRM endpoint.IntegrationSecure service passwordsrc/lib/hti-crm.ts
EMAIL_SERVICE_AUTH_KEYSecret authorization token passed in headers to the HiTech Azure Functions Email microservice.IntegrationHex / base64 secret stringsrc/lib/email.ts
NEXT_PUBLIC_EMAIL_TONon-production email redirect override. Diverts all outgoing notifications away from real customers to an internal team inbox.Dev/Stagingqa-team@example.comsrc/lib/email.ts (Form notification dispatch)
TEST_EMAIL_TOTarget email address used by testing scripts in scripts/.Devtester@example.comscripts/send-test-email.js, scripts/send-*.ts
PRIVACY_DATA_SECURITY_CCComma-separated CC email addresses receiving customer data privacy requests (CCPA/CPRA, TDPSA).Regulatorydatasecurity@example.com,compliance@example.com/api/forms/privacy/intake, Server Actions
META_VERIFY_TOKENCustom token configured in Meta Developer Console to complete initial webhook challenge verification.WebhookAlphanumeric secret tokenGET /api/webhooks/meta
META_APP_IDMeta application ID registered with Meta Graph API.WebhookNumeric App ID (e.g. 1234567890)Meta Graph client
META_APP_SECRETMeta application secret key used to compute HMAC-SHA256 signatures over incoming event bodies.WebhookHex secret stringPOST /api/webhooks/meta
META_PAGE_ACCESS_TOKENLong-lived System User access token used to query Meta Graph API v25.0 to fetch encrypted lead answers.WebhookEAA... (Meta Graph token)src/lib/meta/leadgen.ts
META_GRAPH_VERSIONMeta Graph API version string.Webhookv25.0 (Default)src/lib/meta/leadgen.ts
GOOGLE_WEBHOOK_SECRETShared secret configured in Google Ads Lead Form webhook extensions for payload authenticity.WebhookSecret stringPOST /api/webhook/google
TIKTOK_VERIFY_TOKENVerification handshake token configured on TikTok Lead Generation webhook campaigns.WebhookAlphanumeric tokenGET/POST /api/webhook/tiktok
RATE_LIMIT_ENABLEDMaster switch enabling or disabling the distributed MongoDB sliding-window rate limiter.Optionaltrue | false (Default: true)src/lib/rate-limit/limiter.ts
RATE_LIMIT_LIMIT_AUTH_STRICTMaximum allowed requests on sensitive authentication endpoints within the configured time window.OptionalInteger (Default: 5)src/lib/rate-limit/config.ts
RATE_LIMIT_WINDOW_AUTH_STRICTSliding window duration for authentication endpoints in milliseconds.OptionalInteger (Default: 900000 = 15 min)src/lib/rate-limit/config.ts
RATE_LIMIT_LIMIT_FORM_SUBMISSIONMaximum allowed public form submissions (Quote, Claims, Contact, Careers) within the window.OptionalInteger (Default: 10)src/lib/rate-limit/config.ts
RATE_LIMIT_WINDOW_FORM_SUBMISSIONSliding window duration for public form submissions in milliseconds.OptionalInteger (Default: 300000 = 5 min)src/lib/rate-limit/config.ts
RATE_LIMIT_LIMIT_AUTHENTICATED_MUTATIONMaximum profile and referral mutations for authenticated users per minute.OptionalInteger (Default: 30)src/lib/rate-limit/config.ts
RATE_LIMIT_WINDOW_AUTHENTICATED_MUTATIONSliding window duration for authenticated user mutations in milliseconds.OptionalInteger (Default: 60000 = 1 min)src/lib/rate-limit/config.ts
RATE_LIMIT_LIMIT_EXPENSIVEMaximum expensive analytical operations (reports, retries, PDF exports) allowed per minute.OptionalInteger (Default: 10)src/lib/rate-limit/config.ts
RATE_LIMIT_WINDOW_EXPENSIVESliding window duration for expensive operations in milliseconds.OptionalInteger (Default: 60000 = 1 min)src/lib/rate-limit/config.ts
RATE_LIMIT_LIMIT_STANDARD_APIMaximum general interactive API requests and partner lead submissions allowed per minute.OptionalInteger (Default: 100)src/lib/rate-limit/config.ts
RATE_LIMIT_WINDOW_STANDARD_APISliding window duration for standard API requests in milliseconds.OptionalInteger (Default: 60000 = 1 min)src/lib/rate-limit/config.ts
RATE_LIMIT_LIMIT_READ_ONLYMaximum public read queries allowed per minute per IP address.OptionalInteger (Default: 200)src/lib/rate-limit/config.ts
RATE_LIMIT_WINDOW_READ_ONLYSliding window duration for read-only endpoints in milliseconds.OptionalInteger (Default: 60000 = 1 min)src/lib/rate-limit/config.ts

2. Environment Validation Schema (src/lib/env.ts)​

The application validates mandatory variables at bootstrap time:

import { z } from "zod";

const envSchema = z.object({
NEXT_PUBLIC_APP_URL: z.string().url(),
NEXT_PUBLIC_APP_ENV: z
.enum(["development", "staging", "production"])
.default("development"),
DATABASE_URL: z.string().min(1),
NEXTAUTH_SECRET: z.string().min(1),
NEXTAUTH_URL: z.string().url(),
});

export const env = envSchema.parse({
NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL,
NEXT_PUBLIC_APP_ENV: process.env.NEXT_PUBLIC_APP_ENV,
DATABASE_URL: process.env.DATABASE_URL,
NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET,
NEXTAUTH_URL: process.env.NEXTAUTH_URL,
});

If any mandatory variable is missing or malformed, the process immediately exits with a descriptive Zod validation error, preventing the application from running in an inconsistent or vulnerable state.