INTERNAL DOCS

Vaultro Internal Engineering Handbook

Single entry-point for new and current developers: architecture, standards, execution workflow and operational guardrails.

Current program decision: internal re-architecture first (DI, engines, boundaries, tests, onboarding). The public contract is now generated from the same Zod schemas: OpenAPI 3.1 in API Reference, versioning by header and a types-only SDK alpha.

Quickstart (Internal Dev)

Minimal path to start contributing with quality gates enabled.

bash
pnpm setup:dev
pnpm matrix:validate
pnpm workers:type-check:all
pnpm lint && pnpm type-check
pnpm test:all
pnpm verify:migration:parity

Architecture (Target)

Internal structure target for onboarding, maintainability and strong ownership boundaries.

Layer Purpose Rule
apps/* Wallet and product UIs Consume packages only, never service internals
@vaultro/core Contracts and shared types Single source for cross-service contracts
@vaultro/engine Business orchestration Framework-agnostic and DI-first
WORKERS/* Edge services and API frontdoor Use stable contracts from core

Internal Packages

Planned and active package boundaries for internal team integration:

  • @vaultro/core: shared contracts, types, status models
  • @vaultro/engine: orchestrated use-cases (swap, transfer, bridge, invest, recovery)
  • @vaultro/crypto: signing, key handling, auth primitives
  • @vaultro/ui: reusable internal components and design patterns

Workers Platform

Current frontdoor and services topology used by internal apps and services.

  • Frontdoor: api.vaultro.space (and final domain when DNS stable)
  • Core workers: relayer, rpc, aggregator, price, token, registry, download, docs, status
  • Cross-cutting: correlation-id propagation and strict auth matrix per endpoint

Endpoint Auth Matrix

Official source is generated from worker routes and published automatically.

Matrix source: /data/endpoint-auth-matrix.json | Validation: pnpm matrix:validate
Loading endpoint matrix...

DI Standard

All critical engines must receive adapters instead of importing global state directly.

typescript
type EngineAdapters = {
  rpc: RpcAdapter;
  signer: SignerAdapter;
  wallet: WalletAdapter;
  storage: StorageAdapter;
  featureFlags: FeatureFlagsAdapter;
};

export function createSwapEngine(adapters: EngineAdapters) {
  // no direct imports from UI or runtime globals
}

Testing and Quality Gates

Quality gates are mandatory for all internal deliveries.

Command Purpose
pnpm test:unit fast isolated checks
pnpm test:contract SDK/worker contract safety
pnpm test:integration cross-service integration
pnpm ci:gates full quality and build gates
pnpm verify:migration:parity:full critical migration parity + UX smoke

Release and Change Management

  • Use semver validation per package in CI.
  • Generate changelog artifacts on every gate run.
  • Follow deploy checklist and rollback-safe sequence.
  • No merge to production path without green gates.

Security and Access

  • Client-facing routes use signed requests; internal key is service-to-service only.
  • No secrets in frontend or extension bundles.
  • All new endpoints must be classified in auth matrix before deploy.
  • Long-term target is repo-level isolation for sensitive domains.

Current Priority

Execution order approved for current cycle:

  1. Consolidate internal package architecture and strict boundaries.
  2. Standardize DI for critical engines and remove residual coupling.
  3. Increase test coverage and internal onboarding reliability.
  4. Strengthen governance: CODEOWNERS, ADR cadence, contribution flow.

SDK & API

The public contract is generated from the Worker Zod schemas, so runtime validation and documentation cannot drift silently.

  • OpenAPI 3.1: one document per Worker in /openapi/*.json, indexed at /openapi/index.json.
  • Redoc: browse every endpoint, schema and response at /api/.
  • SDK: @vaultro/sdk is a types-only alpha generated by openapi-typescript.
  • Versioning: send X-Vaultro-Api-Version; omission means the current stable major (v1).