Skip to Content
Code Wikiroot — Wiki

root — Wiki

@cfxdevkit/framework

Conflux DevKit (@cfxdevkit/framework) is a pnpm monorepo that equips developers with everything needed to build, test, and run applications on the Conflux Network. It bundles low‑chain primitives, domain‑specific automation libraries, wallet and UI utilities, a backend service (CAS), an example frontend, and a suite of tooling scripts—including an LLM‑driven automation pipeline for code quality, documentation, and release tasks.

What this repo does

  • Framework packages (repos/*) provide chain‑level primitives (address codecs, unit conversion, RPC clients), vertical domains (automation strategies, game‑engine kit), trust‑bound services (key management, signing), and helper utilities.
  • Projects contain two complementary applications:
    • The CAS backend (projects‑cas) – a Node.js/Express service handling authentication, strategy execution, admin controls, pool aggregation, health monitoring, and real‑time SSE updates.
    • The Example frontend (projects‑examples) – a Next.js showcase that interacts with CAS, manages keystores, controls a local devnode, and demonstrates end‑to‑end flows.
  • Tooling & scripts (scripts) automate common chores: building, linting, type‑checking, versioning, generating documentation, validating configurations, and running the LLM pipeline.
  • LLM automation pipeline – a set of LL‑M‑powered steps (commit quality gates, doc generation, model validation, etc.) that run as part of the CI/CD flow and can be invoked locally via pnpm run llm:* commands.

Everything is organized under a strict 5‑tier dependency hierarchy enforced by @cfxdevkit/arch-rules and validated on every commit, ensuring clean layering and preventing inadvertent shortcuts.

5‑tier architecture (summary)

TierResponsibilityExample Packages
-1Cross‑cutting config & metadatarepos/cfx-meta, repos/cfx-config
0Core framework – chain primitives, domains, keys, toolsrepos/cfx-core, repos/cfx-domain, repos/cfx-keys, repos/cfx-tools, repos/cfx-solidity
1Platform – MCP server, VS Code extension, scaffold CLI, devnode(located in repos/* and referenced by tooling)
2Projects – CAS backend & Example frontendprojects‑cas, projects‑examples
3Tooling & automation – scripts, LLM pipeline, local devnodescripts, LL M‑related scripts

The hierarchy guarantees that, for instance, a domain package never depends on a project‑specific UI component, and tooling only consumes from lower tiers.

Key end‑to‑end flows

  1. Local development loop – A developer runs pnpm run devnode to spin up a local Conflux node, then pnpm run dev (or the appropriate package script) to start the CAS backend and the Example frontend. The frontend calls into @cfxdevkit/automation (domain tier) and @cfxdevkit/services (keys tier) to submit transactions, which are routed via the RPC clients in cfx-core.

  2. Commit quality gate – On git commit, the repo:precommit script triggers the LLM pipeline (llm:validate-models, llm:test-upkeep, llm:docs-api, etc.) followed by linting, type‑checking, and the architecture‑rule check. Any failure aborts the commit, guaranteeing that only conforming code enters the repo.

  3. Documentation regeneration – Running pnpm run docs:wiki (or the richer docs:enrich:all) pulls docstrings from source, runs LLM‑based enrichment, and updates the wiki pages. The generated files are then validated by docs:validate-wiki.

  4. Release automation – The repo:release script bumps versions according to conventional commits, builds all packages (pnpm run build), publishes to the registry, and updates the changelog, all while invoking the LLM pipeline for release‑notes generation.

Getting started

  1. Clone the repo

    git clone https://github.com/conflux-devkit/framework.git cd framework
  2. Install dependencies (uses pnpm)

    pnpm install
  3. Build the workspace

    pnpm run build
  4. Spin up a local devnode (optional but useful for testing)

    pnpm run devnode
  5. Explore the modules – Each major part of the repo has its own wiki page; follow the natural links in the text:

From there you can dive into any sub‑package (e.g. cfx-core, cfx-domain, cfx-keys) by navigating from the respective module page.


High‑level architecture diagram

Root holds workspace configuration. Repos supplies the low‑level framework libraries used by both Projects (CAS & Example) and Tooling (scripts, LLM pipeline, devnode). Projects consume the framework to deliver backend and frontend functionality, while Tooling orchestrates builds, checks, and automation across the entire monorepo.

This view gives a new developer an instant sense of where each piece lives and how they interact—everything else lives inside these four blocks. Happy hacking!

Last updated on