npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dappql/codegen

v0.1.3

Published

Framework-agnostic code generation for DappQL — typed contract modules, SDK factory, and project AGENTS.md. Shared by the `dappql` CLI and the `@dappql/mcp` server.

Downloads

364

Readme

@dappql/codegen

The framework-agnostic codegen engine for DappQL. Emits typed contract modules, the optional SDK factory, and the project-level AGENTS.md, from a plain { contracts, targetPath, ... } config.

Shared core used by the dappql CLI and the @dappql/mcp server. Most users reach DappQL through the CLI, you only need @dappql/codegen directly if you're building tooling around it (an MCP server, a VSCode extension, a CI diff linter, a hosted platform).

Install

npm install @dappql/codegen

Programmatic API

import {
  createContractsCollection,
  createAgentsFile,
  type Config,
  type ContractConfig,
} from '@dappql/codegen'

const contracts: (ContractConfig & { contractName: string })[] = [
  {
    contractName: 'Token',
    address: '0x...',
    abi: [/* ... */],
  },
]

// Emit one typed .ts per contract, plus index.ts (and sdk.ts if isSdk: true).
// rootDir defaults to process.cwd(); pass an explicit path for use from
// outside the project (tooling, agents, CI).
createContractsCollection(
  contracts,
  './src/contracts',  // targetPath, relative to rootDir
  true,               // isModule , emit ESM import paths
  false,              // isSdk    , emit the createSdk factory
  '/path/to/project', // rootDir  , optional
)

// Emit (or update) the project's AGENTS.md file for AI coding agents.
// Re-runs replace only the managed block; hand-written content around it
// is preserved.
createAgentsFile(contracts, {
  targetPath: './src/contracts',
  isModule: true,
  isSdk: false,
  chainId: 1,
  agentsFile: true,          // true | false | '<path>'
  rootDir: '/path/to/project',
})

Types

All types are exported for consumers:

import type {
  Address,
  AbiFunction,
  AbiParameter,
  ContractConfig,
  Contracts,
  Config,
} from '@dappql/codegen'

These replace the ambient globals that used to live in the dappql CLI, so tooling can now type its own surfaces in terms of the same shapes DappQL emits.

When to use this directly

  • Building an MCP server, plugin, or devtool that needs to regenerate contract modules at runtime.
  • Writing a CI check that compares freshly regenerated output against what's committed.
  • Embedding codegen into a framework adapter (custom Vite plugin, Next.js integration, etc.).

For a vanilla dApp, use the dappql CLI instead, it handles config loading, ABI fetching from Etherscan, and logging.

Related packages

| Package | Purpose | | --- | --- | | dappql | The CLI, dappql binary wrapping this engine with ABI fetching and logging | | @dappql/react | React hooks, provider, query manager | | @dappql/async | Non-React runtime, query, mutate, iteratorQuery | | @dappql/mcp | MCP server, consumes @dappql/codegen to expose a regenerate tool to AI coding agents |

Full documentation

github.com/dappql/core

License

MIT