Skip to Content
TTConnect public documentation
ReferenceEnvironment variables

Environment Variables

Configuration is managed per environment (development, staging, production). Copy each app’s .env.example file and fill in values before starting. The tables below mirror the example files committed in this repository.

Best practices:

  • Don’t commit real secrets or API keys to version control.
  • Use different keys per environment.
  • Rotate keys if they might be compromised.

API (apps/api/.env)

VariableDescription
NODE_ENVRuntime environment (development, production)
PORTHTTP port the API listens on in local development (3002 in the example file)
API_URLPublic base URL of the API
DATABASE_URLPostgreSQL connection string
DATABASE_SSLEnable SSL for the database connection
DATABASE_LOGGINGEnable Prisma/database query logging
DB_POOL_MIN / DB_POOL_MAXMinimum and maximum database pool size
REDIS_HOST / REDIS_PORTRedis host and port
REDIS_PASSWORDRedis password (leave empty if none)
REDIS_DB / REDIS_KEY_PREFIXRedis database index and cache prefix
JWT_SECRETSecret used to sign JWTs (required in production)
JWT_EXPIRES_INJWT expiry (e.g. 7d)
API_KEY_EXPIRATIONAPI key expiry (e.g. 365d)
DEFAULT_NETWORKDefault blockchain network (for example amoy)
AMOY_RPC_URL / POLYGON_RPC_URLPolygon testnet and mainnet RPC endpoints
SEPOLIA_RPC_URL / ETHEREUM_RPC_URLEthereum testnet and mainnet RPC endpoints
PRIVATE_KEYDeployer wallet private key for contract interactions
MEMBERSHIP_FACTORY_*Membership factory addresses per network
LOYALTY_TOKEN_*Loyalty token addresses per network
TOKENTRAXX_STORE_*Store contract addresses per network
PRODUCT_FACTORYProduct factory address used by the API
GAS_LIMIT / GAS_PRICEDefault gas configuration for blockchain writes
MAX_FEE_PER_GAS / MAX_PRIORITY_FEE_PER_GASOptional EIP-1559 gas overrides
IPFS_GATEWAYIPFS gateway used for hosted metadata/assets
PINATA_API_KEY / PINATA_SECRET_KEYPinata credentials for IPFS uploads
LOG_LEVEL / LOG_FORMATApplication logging level and formatter
TENANT_WALLET_ENC_KEY64-character hex key for encrypting tenant wallet private keys
PLATFORM_URLURL of the Platform app
STORE_URLURL of the Storefront app
CORS_ORIGINSComma-separated allowed CORS origins
RATE_LIMIT_*Per-window API rate-limit settings

Platform (apps/platform/.env.local)

VariableDescription
NEXT_PUBLIC_API_URLBase URL of the API service (e.g. http://localhost:3002)
NEXT_PUBLIC_STORE_URLStorefront base URL used for platform deep links
NEXT_PUBLIC_PRIVY_APP_IDPrivy app ID for embedded wallet and auth
NEXT_PUBLIC_LP_TOKEN_ADDRESSLP/loyalty token contract address (optional)

Storefront (apps/storefront/.env.local)

VariableDescription
NEXT_PUBLIC_API_URLBase URL of the API service
NEXT_PUBLIC_PLATFORM_URLPlatform base URL used by storefront admin redirects
NEXT_PUBLIC_ROOT_DOMAINRoot domain used for tenant routing (for example ttconnect.xyz)
NEXT_PUBLIC_API_KEYAPI key for server-to-storefront requests
NEXT_PUBLIC_PRIVY_APP_IDPrivy app ID for embedded wallet and auth
NEXT_PUBLIC_SQUARE_APPLICATION_IDSquare application ID for card payments
NEXT_PUBLIC_SQUARE_LOCATION_IDSquare location ID for card payments
NEXT_PUBLIC_LP_TOKEN_ADDRESSLP/loyalty token contract address (optional)
NEXT_PUBLIC_CW3_STORE_URLExternal CW3 store link shown for qualifying storefronts (optional)
Last updated on