railyard/apps/console/package.json

33 lines
1.1 KiB
JSON
Raw Permalink Normal View History

feat(console): Railyard console with Scribase sign-in and the Dodo test-mode money ladder (RYP-D1, Y-2) Next.js console for Cloudflare Workers (OpenNext config, wrangler.jsonc) with data in the console's own Scribase project, schema railyard (migration 0001: orgs, org_members, apps, deploys, entitlements, billing_events, api_tokens, device_codes; idempotent, RLS on, no anon grants). - Sign-in with Google or GitHub through Scribase Auth (PKCE), user read from the auth server, org and entitlements row created, signed HttpOnly session. - Money ladder (pure, immutable): $1 card check credited back to the customer wallet, 14-day trial with the plan's limits, $19 a month or $190 a year, pause switch and one-click cancel (ends at the next billing date; a trial ends now). - Webhook: Standard Webhooks signature and timestamp verified, replays ignored by unique message id, signed checkout metadata, other brands ignored, a refund of the card check reverses the credit and the trial, a failed wallet call releases the id for the provider's retry. - Apps, Usage and Billing screens, one primary action each; Add app shows the deploy command and the Insights tag in two clicks. - CLI device-flow login and org-scoped hashed tokens for Y-3. - Test mode only: the live payment host is refused unless the owner sets RAILYARD_DODO_LIVE=1. Tests (node --test, 25): journey from sign-in to entitlements and the snippet, refund, pause and cancel, webhook security, ladder, tokens and org isolation, PostgREST repo, a component test of Add app with the copy lint, a next build grep for sentinel secrets in the client bundle, and the migration applied twice on a scratch Postgres. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 15:35:24 +03:00
{
"name": "@railyard/console",
"version": "0.1.0",
"private": true,
"description": "Railyard console: sign-in, the money ladder, apps, usage and billing (RYP-D1).",
"type": "module",
"scripts": {
"dev": "next dev --port 3020",
"build": "next build",
"cf:build": "opennextjs-cloudflare build",
"cf:deploy": "opennextjs-cloudflare deploy",
"typecheck": "tsc --noEmit",
feat(console): GET /api/v1/rail/status, one aggregated health check for the rail Consumer products (Rally, Menivor, Scribase, ...) and operators currently have no single place to ask "is the rail actually up" -- they'd have to probe Mint, Rago, Relay and Abacus separately before routing real traffic. Adds lib/rail-status.ts (pure, injectable fetch per the repo's own transport invariant) that checks every configured service in parallel with a bounded per-service timeout, and GET /api/v1/rail/status that wires it to four new optional env vars (MINT_HEALTH_URL, RAGO_HEALTH_URL, RELAY_HEALTH_URL, ABACUS_HEALTH_URL -- unset services read "not_configured" and are excluded from the verdict, so this degrades cleanly on any partial deployment). Overall reads ok/degraded/down/unconfigured; HTTP status is 200 for ok/degraded and 503 for down/unconfigured so a caller that only checks the status code still gets the right answer without parsing the body. TDD: 7 new tests in lib/rail-status.test.ts (all services healthy, one down degrades the rest, a thrown network error reads down not an unhandled rejection, a hung service times out instead of blocking forever, an unset service skips the network call and is excluded from the verdict, zero configured services reads unconfigured not a false ok, every service down reads down). Full console suite: 166 pass (164 + the pre-existing env-only failure in add-app-component.test.ts, unrelated -- missing root node_modules in this sandbox, not a code regression). Not deployed: the console Worker's deploy needs ~/.config/products-keys/railyard-console.env (not present on this machine) and a working wrangler/pnpm toolchain (corepack's pnpm cache is broken here, and the workspace root node_modules does not exist), so this could not be shipped to railyard.ereboslab.com from this session -- noted in NOTES.md. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-21 18:39:35 +03:00
"test": "node --test test/*.test.ts app/api/v1/deploys/*.test.ts app/api/v1/bridge/scribase/*.test.ts lib/ai/*.test.ts lib/flags/*.test.ts lib/watch/*.test.ts lib/ship/*.test.ts lib/insights-depth/*.test.ts lib/vitals-view.test.ts lib/rail-status.test.ts",
feat(console): Railyard console with Scribase sign-in and the Dodo test-mode money ladder (RYP-D1, Y-2) Next.js console for Cloudflare Workers (OpenNext config, wrangler.jsonc) with data in the console's own Scribase project, schema railyard (migration 0001: orgs, org_members, apps, deploys, entitlements, billing_events, api_tokens, device_codes; idempotent, RLS on, no anon grants). - Sign-in with Google or GitHub through Scribase Auth (PKCE), user read from the auth server, org and entitlements row created, signed HttpOnly session. - Money ladder (pure, immutable): $1 card check credited back to the customer wallet, 14-day trial with the plan's limits, $19 a month or $190 a year, pause switch and one-click cancel (ends at the next billing date; a trial ends now). - Webhook: Standard Webhooks signature and timestamp verified, replays ignored by unique message id, signed checkout metadata, other brands ignored, a refund of the card check reverses the credit and the trial, a failed wallet call releases the id for the provider's retry. - Apps, Usage and Billing screens, one primary action each; Add app shows the deploy command and the Insights tag in two clicks. - CLI device-flow login and org-scoped hashed tokens for Y-3. - Test mode only: the live payment host is refused unless the owner sets RAILYARD_DODO_LIVE=1. Tests (node --test, 25): journey from sign-in to entitlements and the snippet, refund, pause and cancel, webhook security, ladder, tokens and org isolation, PostgREST repo, a component test of Add app with the copy lint, a next build grep for sentinel secrets in the client bundle, and the migration applied twice on a scratch Postgres. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 15:35:24 +03:00
"test:bundle": "node --test test/bundle-secrets.test.ts"
},
"dependencies": {
"next": "14.2.35",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"devDependencies": {
"@opennextjs/cloudflare": "1.15.1",
"@types/node": "22.9.0",
"@types/react": "18.3.12",
"@types/react-dom": "18.3.1",
"typescript": "5.6.3",
"wrangler": "4.139.0"
},
"engines": {
"node": ">=22.18"
}
}