Overview
The@aixyz/config package handles loading and validating your aixyz.config.ts configuration file. It uses Zod schemas to ensure type safety and provides clear error messages for invalid configurations.
API
getAixyzConfig()
Returns the full configuration object for build-time use. This includes all fields needed by the build pipeline, CLI, and plugins.
getAixyzConfigRuntime()
Returns a subset of the configuration that is safe for inclusion in runtime bundles.
At build time, the
AixyzConfigPlugin replaces imports from aixyz/config with the resolved runtime config, so the
config file is not required at runtime.Types
AixyzConfig— the full config type foraixyz.config.tsNetwork— CAIP-2 network identifier type (e.g.,"eip155:8453")
Environment File Loading
Environment variables are loaded in the following order (later files take precedence):.env.env.local.env.$(NODE_ENV)— e.g.,.env.production.env.$(NODE_ENV).local— e.g.,.env.production.local
URL Auto-Detection
Ifurl is not set in config, it is resolved from environment variables:
https://${VERCEL_PROJECT_PRODUCTION_URL}(Vercel production)https://${VERCEL_URL}(Vercel preview)http://localhost:3000(fallback)
Zod Validation
All configuration fields are validated against Zod schemas at load time. If your config is invalid, you get a descriptive error with the exact field and expected type.Usage in Build Plugins
TheAixyzConfigPlugin (part of @aixyz/cli) calls getAixyzConfig() during the build to resolve the full config, then materializes the runtime-safe subset into the bundle. This means:
import config from "aixyz/config"works at runtime without the config file- Environment variables are baked in at build time
- The config file itself is not included in the output bundle