Modules
Modules are self-contained feature components that provide full-stack functionality for a specific use case. Each module ships Solidity contracts, tests, deploy scripts, React hooks, and UI components. All module components are provided by the unified @web3marketlabs/components package.
Available Modules
| Module | Tier | Description |
|---|---|---|
| ERC-20 Token | Free | Fungible token with configurable mint, burn, and pause |
Architecture
Every module implements the KitComponent interface (defined in @web3marketlabs/sdk) and follows a layered architecture:
- Higher layers import lower layers, never the reverse. The CLI orchestrates modules; modules depend on
@web3marketlabs/sdkand contracts; nothing depends on the CLI. - Modules are composable and independent. Modules never import each other. You can add or remove any module without affecting others.
- Each module provides a complete vertical slice: Solidity contracts + Foundry tests + deploy scripts + React hooks + UI components.
- All components come from
@web3marketlabs/components. There are no separate per-module packages. The unified package exports every module’sKitComponentdefinition.
Template System
Module files are generated using Handlebars templates (.hbs files). The template engine supports:
- Variable interpolation:
{"{{variableName}}"}is replaced with the parameter value provided duringw3m add - Conditional sections:
{"{{#if featureEnabled}}"}...{"{{/if}}"}includes or excludes blocks based on boolean parameters - Loops:
{"{{#each items}}"}...{"{{/each}}"}iterates over arrays
Template parameters come from the module’s parameters array and are collected interactively by the CLI wizard or passed via command-line flags.
Contract Foundation
All module contracts are built on OpenZeppelin Contracts v5.1.0. This includes:
- ERC-20 token standards
- Access control (role-based via
AccessControl) - Security primitives (pausable, reentrancy guards)
Adding a Module
To add a module to your project, run:
w3m add <module-id>The CLI will launch an interactive wizard that collects the module’s parameters, generate all files from templates, install Solidity dependencies, and update your kit.config.ts.
The KitComponent Interface
Every module’s default export conforms to this interface:
interface KitComponent {
id: string
displayName: string
description: string
version: string
tier: 'free' | 'pro' | 'enterprise'
parameters: ComponentParameter[]
files: ComponentFile[]
solidityDependencies: { package: string; version?: string }[]
npmDependencies: { name: string; version: string; dev?: boolean }[]
requiredComponents: string[]
conflictsWith: string[]
deploy?: DeployHook
codegenPlugin?: CodegenPlugin
}This interface is the contract between the CLI and the @web3marketlabs/components package. It tells the CLI everything it needs to know: what to ask the user, which files to generate, what dependencies to install, and how to deploy.