cred402/infra/README.md
caelum0x 2d43618725 feat: real integrations (Casper Testnet, x402/EIP-712, MCP, RealFi, cross-chain), wallet sign-in, branding
Replace the design-note docs (p1–p7) with the implemented "make it real" phase
docs (p8–p10) and wire production-grade, env-gated real integrations:

- p8 Casper Testnet: byte-exact deploys + WASM install via casper-js-sdk; live
  node reads (node.testnet.casper.network); CRED402_CHAIN=sim|testnet transport.
- p9 x402 + data + MCP: real EIP-712 typed-data digests (@casper-ecosystem/
  casper-eip-712); casper-x402 facilitator client (x402 V2); live Open-Meteo GHI;
  official @modelcontextprotocol/sdk server; casper-sidecar SSE event feed.
- p10 RealFi + cross-chain: real Stripe test-mode webhooks (HMAC-verified) and
  Plaid sandbox → privacy-preserving on-chain envelopes; Base Sepolia EVM deploy
  (Foundry); reachable via /api/realfi/* and /api/x402/facilitator routes.
- Sign-in with Casper Wallet: real extension provider + challenge/ed25519/session
  flow (/v1/auth/wallet/*), console connect + sign-in button.
- Branding: Cred402 logo mark, favicon, OG image; Vercel config for the console.

All env-gated with sim/free-API fallbacks; full suite green, all toolchains
(TS/Rust/Go/Solidity) build.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 00:37:36 +03:00

47 lines
1.6 KiB
Markdown

# Cred402 infrastructure
Production deployment artifacts for the API + console and the Go event indexer.
## Contents
```
Dockerfile multi-stage image: builds the console, runs the API (tsx) as non-root, healthchecked
docker-compose.yml local prod-like stack: api (durable journal) + indexer + postgres
helm/cred402/ Helm chart (deployment, service, ingress, hpa, pvc, secret-ref) — `helm lint` clean
terraform/ cloud-agnostic module: namespace + secret + helm_release onto any K8s cluster
```
## Run locally
```bash
export CRED402_ADMIN_API_KEY=$(openssl rand -hex 24)
docker compose -f infra/docker-compose.yml up --build
# API on :4021 (auth on), indexer writes /data/projections.json, postgres on :5432
```
## Deploy to Kubernetes
```bash
# 1. create the secret the chart references (or let Terraform do it)
kubectl create secret generic cred402-secrets \
--from-literal=CRED402_ADMIN_API_KEY=... \
--from-literal=CRED402_WEBHOOK_SECRET=...
# 2a. Helm directly
helm upgrade --install cred402 infra/helm/cred402 -n cred402 --create-namespace \
--set image.tag=0.1.0 --set ingress.enabled=true --set ingress.host=api.example
# 2b. or via Terraform
cd infra/terraform
terraform init && terraform apply \
-var admin_api_key=... -var webhook_secret=... -var environment=testnet
```
## Configuration
All runtime config is environment-driven and validated at boot
(`lib/gateway/config.ts`) — the API refuses to start on testnet/mainnet without
the required secrets. Liveness/readiness use `GET /v1/health`. State is persisted
to the `CRED402_DATA_DIR` volume as an append-only event journal the indexer
consumes.