Context
dual402 is currently packaged as an Express-first middleware. The source is now split into focused modules, but core payment behavior still assumes Express request/response objects and mppx/express.
Now that the public-release hardening and docs/release polish are done, the next architectural step is a framework-agnostic core with thin adapters.
Goal
Expose reusable core primitives for x402 + MPP charge/discovery behavior, then keep Express as the first adapter.
Proposed Shape
- Move protocol-neutral logic into a core layer:
- config validation and resolved config
- payment requirement/challenge construction
- x402 verify/settle orchestration
- schema/discovery metadata construction
- shared paid-route model
- Keep Express-specific behavior in
./express:
- Express middleware signatures
res.status(402) interception
- request URL/base URL extraction
mppx/express integration
- Preserve existing
dual402 and dual402/express imports.
- Add a deliberate
dual402/core export only when the core API is ready.
Acceptance Criteria
- Existing Express API remains backward compatible.
- Existing tests still cover Express behavior.
- Core code can be exercised without importing Express types.
- Adapter boundary is documented in
ARCHITECTURE.md.
- README continues to present Express as the default path, with core/adapters framed as extension points.
Context
dual402 is currently packaged as an Express-first middleware. The source is now split into focused modules, but core payment behavior still assumes Express request/response objects and
mppx/express.Now that the public-release hardening and docs/release polish are done, the next architectural step is a framework-agnostic core with thin adapters.
Goal
Expose reusable core primitives for x402 + MPP charge/discovery behavior, then keep Express as the first adapter.
Proposed Shape
./express:res.status(402)interceptionmppx/expressintegrationdual402anddual402/expressimports.dual402/coreexport only when the core API is ready.Acceptance Criteria
ARCHITECTURE.md.