kit.config.ts
Complete reference for the kit.config.ts configuration file. This is the single configuration file for your entire web3market-kit project. It lives at the root of your project directory.
import { defineConfig } from '@web3marketlabs/config'
export default defineConfig({
// all options documented below
})The defineConfig() helper provides TypeScript type inference and autocompletion. At runtime, the config is loaded using jiti for TypeScript transpilation and validated against Zod schemas defined in @web3marketlabs/config.
contracts
Configures the smart contract development framework and source file locations.
| Field | Type | Default | Description |
|---|---|---|---|
framework | 'foundry' | 'hardhat' | (required) | Contract development framework |
root | string | 'contracts' | Root directory for contract sources, relative to project root |
include | string[] | ['**/*.sol'] | Glob patterns for contract files to include |
exclude | string[] | ['**/test/**', '**/script/**'] | Glob patterns for contract files to exclude |
contracts: {
framework: 'foundry',
root: 'contracts',
include: ['**/*.sol'],
exclude: ['**/test/**', '**/script/**'],
}framework is the only required field in the entire config. All other fields across all sections have defaults.
chains
Configures which blockchain networks the project targets for deployment.
| Field | Type | Default | Description |
|---|---|---|---|
default | string | 'localhost' | Default chain for development (must be a key in targets) |
targets | Record<string, { chainId: number, rpcUrl: string | { env: string } }> | { localhost: { chainId: 31337, rpcUrl: 'http://127.0.0.1:8545' } } | Chain deployment targets |
The rpcUrl field accepts either a literal URL string or an object referencing an environment variable:
chains: {
default: 'sepolia',
targets: {
localhost: {
chainId: 31337,
rpcUrl: 'http://127.0.0.1:8545',
},
sepolia: {
chainId: 11155111,
rpcUrl: { env: 'SEPOLIA_RPC_URL' },
},
mainnet: {
chainId: 1,
rpcUrl: { env: 'MAINNET_RPC_URL' },
},
},
}When using {"{ env: 'ENV_VAR_NAME' }"}, the environment variable is resolved at runtime, not at config load time. Make sure the variable is set in your shell or .env file before running deploy commands.
Chain Target Schema
Each entry in targets must include:
| Field | Type | Description |
|---|---|---|
chainId | number | The numeric chain ID (must be a positive integer) |
rpcUrl | string | { env: string } | RPC endpoint URL or environment variable reference |
codegen
Controls automatic TypeScript and React code generation from compiled contract ABIs.
| Field | Type | Default | Description |
|---|---|---|---|
outDir | string | 'src/generated' | Output directory for generated code, relative to project root |
hooks | boolean | true | Generate React hooks for contract interactions |
components | boolean | false | Generate React components for contract interactions |
codegen: {
outDir: 'src/generated',
hooks: true,
components: false,
}deploy
Controls deployment behavior when running w3m deploy.
| Field | Type | Default | Description |
|---|---|---|---|
verify | boolean | true | Verify contracts on block explorer after deployment |
confirmations | number | 2 | Number of block confirmations to wait before considering deployment finalized |
deploy: {
verify: true,
confirmations: 2,
}modules
Optional. Per-module configuration. Each module registers its own config under its key and validates its own section independently.
| Field | Type | Default | Description |
|---|---|---|---|
modules | Record<string, unknown> | {} | Module-specific configuration keyed by module ID |
modules: {
token: { initialSupply: '5000000' },
}components
Optional. List of installed component identifiers in the project.
| Field | Type | Default | Description |
|---|---|---|---|
components | string[] | [] | List of installed components |
components: ['token']ai
Optional. Configuration for AI-powered features (contract review, error debugging, parameter explanations).
| Field | Type | Default | Description |
|---|---|---|---|
enabled | boolean | false | Enable AI assistance |
model | string | 'claude-sonnet-4-5-20250929' | Claude model to use for AI features |
ai: {
enabled: true,
model: 'claude-sonnet-4-5-20250929',
}apiKeys
Optional. API keys for premium and AI-powered features.
| Field | Type | Default | Description |
|---|---|---|---|
web3market | string | (optional) | Web3.Market API key for premium features (deploy, analysis) |
anthropic | string | (optional) | Anthropic API key for AI-powered features |
apiKeys: {
web3market: 'wm_...',
anthropic: 'sk-ant-...',
}Avoid committing API keys to version control. Use environment variables or a .env file and reference them via the chains.targets env syntax, or set keys through w3m auth.
vercel
Optional. Configuration for Vercel deployment integration.
| Field | Type | Default | Description |
|---|---|---|---|
enabled | boolean | false | Enable Vercel deployment integration |
projectName | string | (optional) | Vercel project name |
vercel: {
enabled: true,
projectName: 'my-dapp',
}marketplace
Optional. Configuration for Web3.Market marketplace publishing defaults.
| Field | Type | Default | Description |
|---|---|---|---|
autoPublish | boolean | false | Automatically publish to marketplace on deploy |
defaultPrice | string | '0' | Default product price in USD (0 for free) |
supportEnabled | boolean | true | Enable support for marketplace listings by default |
marketplace: {
autoPublish: true,
defaultPrice: '49',
supportEnabled: true,
}Complete Example
A full kit.config.ts with all sections populated:
import { defineConfig } from '@web3marketlabs/config'
export default defineConfig({
contracts: {
framework: 'foundry',
root: 'contracts',
include: ['**/*.sol'],
exclude: ['**/test/**', '**/script/**'],
},
chains: {
default: 'sepolia',
targets: {
localhost: {
chainId: 31337,
rpcUrl: 'http://127.0.0.1:8545',
},
sepolia: {
chainId: 11155111,
rpcUrl: { env: 'SEPOLIA_RPC_URL' },
},
mainnet: {
chainId: 1,
rpcUrl: { env: 'MAINNET_RPC_URL' },
},
},
},
codegen: {
outDir: 'src/generated',
hooks: true,
components: false,
},
deploy: {
verify: true,
confirmations: 2,
},
modules: {},
components: ['token'],
ai: {
enabled: true,
model: 'claude-sonnet-4-5-20250929',
},
apiKeys: {
web3market: 'wm_live_abc123',
anthropic: 'sk-ant-api03-...',
},
vercel: {
enabled: true,
projectName: 'my-dapp',
},
marketplace: {
autoPublish: false,
defaultPrice: '0',
supportEnabled: true,
},
})How Config Loading Works
File Discovery
The CLI searches for kit.config.ts in the current working directory (or a path specified with --config).
TypeScript Transpilation
The file is loaded using jiti, which transpiles TypeScript to JavaScript at runtime. This means you can use full TypeScript syntax, imports, and type annotations in your config file.
Zod Validation
The exported config object is validated against the Zod schema defined in @web3marketlabs/config. Missing optional fields are filled with their default values. Invalid values produce clear error messages with the exact path and issue.
Resolved Config
The fully validated and defaulted KitConfig object is returned and used by all CLI commands, codegen, and deployment pipelines.