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.
- The CAS backend (
- 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)
| Tier | Responsibility | Example Packages |
|---|---|---|
| -1 | Cross‑cutting config & metadata | repos/cfx-meta, repos/cfx-config |
| 0 | Core framework – chain primitives, domains, keys, tools | repos/cfx-core, repos/cfx-domain, repos/cfx-keys, repos/cfx-tools, repos/cfx-solidity |
| 1 | Platform – MCP server, VS Code extension, scaffold CLI, devnode | (located in repos/* and referenced by tooling) |
| 2 | Projects – CAS backend & Example frontend | projects‑cas, projects‑examples |
| 3 | Tooling & automation – scripts, LLM pipeline, local devnode | scripts, 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
-
Local development loop – A developer runs
pnpm run devnodeto spin up a local Conflux node, thenpnpm 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 incfx-core. -
Commit quality gate – On
git commit, therepo:precommitscript 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. -
Documentation regeneration – Running
pnpm run docs:wiki(or the richerdocs:enrich:all) pulls docstrings from source, runs LLM‑based enrichment, and updates the wiki pages. The generated files are then validated bydocs:validate-wiki. -
Release automation – The
repo:releasescript 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
-
Clone the repo
git clone https://github.com/conflux-devkit/framework.git cd framework -
Install dependencies (uses pnpm)
pnpm install -
Build the workspace
pnpm run build -
Spin up a local devnode (optional but useful for testing)
pnpm run devnode -
Explore the modules – Each major part of the repo has its own wiki page; follow the natural links in the text:
- Root – monorepo‑wide configuration
- Repos – framework packages split by tier
- Projects – CAS – backend service details
- Projects – Examples – frontend showcase
- Scripts – utility and automation scripts
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!