Config Package
packages/config centralizes small but important runtime contracts.
What it exposes
Section titled “What it exposes”- env Zod schemas
- allowed origins helpers
- network binding parsing
- network config loading helpers
- schema registry URL parsing
Typical consumption pattern
Section titled “Typical consumption pattern”In an app:
import { ApiSecretsSchema, AuthSecretsSchema, InstanceSecretsSchema, NetworkRuntimeSecretsSchema, parseServedDomains,} from '@dpg/config';
const instance = InstanceSecretsSchema.parse(process.env);const api = ApiSecretsSchema.parse(process.env);const servedDomains = parseServedDomains(process.env.SERVED_DOMAINS!);Runtime schemas
Section titled “Runtime schemas”The package owns these environment contracts:
InstanceSecretsSchemaApiSecretsSchemaAuthSecretsSchemaNotificationSecretsSchemaSchemaRegistrySecretsSchemaOptionalSchemaRegistrySecretsSchemaNetworkRuntimeSecretsSchemaDatabaseSecretsSchema
loadNetworkConfigs() can load configs from a local file, explicit NETWORK_CONFIG_URLS, or SCHEMA_REGISTRY_URL mappings. This keeps local development and multi-network production instances on the same parsing path.
Why consume it
Section titled “Why consume it”Use the config package when:
- multiple apps should validate env the same way
- runtime parsing should not be duplicated
- network config behavior should stay consistent across services