Skip to content

Add i18n, Zod validation, Prisma migrations, and webhooks - #1291

Merged
Junirezz merged 2 commits into
Junirezz:mainfrom
king-aj-the-first:issues
Aug 29, 2026
Merged

Add i18n, Zod validation, Prisma migrations, and webhooks#1291
Junirezz merged 2 commits into
Junirezz:mainfrom
king-aj-the-first:issues

Conversation

@king-aj-the-first

Copy link
Copy Markdown
Contributor

closes #1277
closes #1282
closes #1283
closes #1285

PR description

Summary

Closes #1277, #1282, #1283, and #1285 on YieldVault-RWA. The app now ships real i18next (EN/ES + RTL hooks), Zod validation on request bodies/query/params, a versioned Prisma migrate/rollback workflow, and a signed webhook pipeline with retries, monitoring, and registration.

#1277 — Internationalization (i18n)

  • Added i18next and react-i18next.
  • Wired frontend/src/i18n/ as the single catalog (en + es) with a compatible t / useTranslation / setLocale API.
  • Language selector is in the navbar (compact) and Settings.
  • Locale persists in localStorage (yieldvault.locale).
  • RTL ready: dir/lang on <html> before first paint, CSS for [dir="rtl"], and ar/he/fa/ur mapped for future catalogs.
  • User-facing strings stay in frontend/src/i18n/locales/.

#1282 — Zod request validation

  • Shared schemas in backend/src/types/validation.ts.
  • validate({ body, query, params }) middleware returns 400 VALIDATION_ERROR with per-field details.
  • Applied to mutating admin/API routes (auth, vaults, webhooks, allowlist, exports, jobs, etc.) plus list query params.
  • Rules documented in backend/docs/REQUEST_VALIDATION.md.

#1283 — Prisma migration workflow

  • Scripts: prisma:generate, prisma:migrate, prisma:deploy, prisma:status, prisma:rollback.
  • Existing schema is already versioned under backend/prisma/migrations/ (0_init + follow-ups).
  • Rollback SQL lives in backend/prisma/rollbacks/; scripts/prisma-rollback.js applies it and marks the migration rolled back.
  • Tests in backend/src/__tests__/prismaMigrationWorkflow.test.ts.
  • Process documented in backend/docs/PRISMA_MIGRATIONS.md.

#1285 — Webhook system

  • Event types in backend/src/types/webhooks.ts.
  • Registration: POST /api/v1/webhooks (JWT) and POST /admin/webhooks (API key).
  • Delivery with exponential backoff retries, HMAC-SHA256 signatures (X-YieldVault-Signature), challenge verification, dead-letter retry.
  • Monitoring: structured logs (webhook.delivery.attempt|retry|success|failed), delivery list, and getWebhookDeliveryMetrics().
  • Docs: backend/docs/WEBHOOKS.md.

Test plan

  • cd frontend && npm install && npm run test:run -- src/i18n/i18n.test.ts
  • Switch EN/ES in the navbar; confirm nav/copy updates and lang on <html>
  • Confirm dir="rtl" if locale is set to a future RTL code (ar)
  • cd backend && npm test -- requestValidation prismaMigrationWorkflow validation webhook
  • POST invalid bodies (login, webhooks, maintenance) → 400 + details
  • Register a webhook, emit a deposit, confirm signed retry + metrics
  • npm run prisma:status and dry-run PRISMA_ROLLBACK_DRY_RUN=1 npm run prisma:rollback -- --name 20260530020000_add_webhook_verification

@drips-wave

drips-wave Bot commented Aug 26, 2026

Copy link
Copy Markdown

@king-aj-the-first Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Junirezz

Copy link
Copy Markdown
Owner

Resolved merge conflicts and merged via local rebase. Commit 675739e is now on main.

@Junirezz Junirezz closed this Aug 26, 2026
@Junirezz Junirezz reopened this Aug 29, 2026
@Junirezz
Junirezz merged commit 3704f28 into Junirezz:main Aug 29, 2026
6 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants