Skip to content

refactor: environment-specific config, lazy route loading, payment strategy pattern, component-based email templates - #661

Merged
Smartdevs17 merged 1 commit into
Smartdevs17:mainfrom
CeceOs92:refactor/environment-specific-config-lazy-route-loading-payment-strategy-pattern-component-based-email-templates
Jul 29, 2026
Merged

refactor: environment-specific config, lazy route loading, payment strategy pattern, component-based email templates#661
Smartdevs17 merged 1 commit into
Smartdevs17:mainfrom
CeceOs92:refactor/environment-specific-config-lazy-route-loading-payment-strategy-pattern-component-based-email-templates

Conversation

@CeceOs92

Copy link
Copy Markdown
Contributor

Summary

Implements four platform refactors: environment-aware configuration with secret management, route-level code splitting for the frontend, a strategy pattern for multi-chain payments, and a component-based email templating system.

Closes #606
Closes #607
Closes #608
Closes #609


#606 — Environment-specific configuration

  • Per-environment override files (backend/src/config/environments/{development,staging,production}.ts), merged into process.env before Zod validation in config.ts
  • Optional AWS Secrets Manager integration (lazy-loaded, opt-in via AWS_SECRETS_MANAGER_ENABLED) with a refreshConfig() runtime-refresh capability
  • npm run config:validate / config:drift / config:docs scripts + .github/workflows/config-validation.yml, auto-generated docs/config/CONFIGURATION.md
  • infra/main.tf: new aws_secretsmanager_secret.app_secrets + read policy per environment

#607 — Lazy-loaded, code-split frontend routing

  • Route-level error boundaries: app/[locale]/error.tsx, app/admin/error.tsx, app/global-error.tsx
  • Offline fallback page (app/offline), wired into public/sw.js as the final navigation fallback
  • components/navigation/PrefetchLink.tsx — hover/focus prefetching via router.prefetch()
  • components/analytics/RouteTransitionMetrics.tsx — route-transition timing reported through the existing web-vitals beacon
  • Extended next.config.ts splitChunks to cover all feature routes (admin/payments/security/onboarding/logs/accessibility) and fixed the existing dashboard/auth/forms cache groups, which weren't matching the actual app/[locale]/... paths
  • Bundle size budgets: bundle-budget.json, scripts/check-bundle-size.mjs, .github/workflows/bundle-size.yml

#608 — Strategy pattern for multi-chain payments

  • Wired the existing (previously unused) PaymentProvider strategy interface, Stellar/EVM/fiat/credit strategies, and router into real traffic for the first time
  • providers/mock.ts for deterministic strategy tests; payment-router.test.ts covers selection, fallback, and failure paths
  • Token-aware strategy selection (PaymentInput.token)
  • unified-payment-tracker.ts — persists every payment, regardless of strategy, into the existing Payment table
  • New routes/payment-strategies.ts (/api/v1/payment-strategies) and a StrategyConfigPanel tab on /admin/configuration showing per-strategy health and metrics

#609 — Component-based email templates

  • Handlebars partials for shared components (templates/components/{layout,header,footer,button}.hbs), auto-registered by EmailTemplateEngine
  • renderWithLayout() implements template inheritance: content renders standalone, then injects into the shared layout
  • templates/registry.ts — Zod-typed template definitions (renderTypedTemplate<K>) for compile- and runtime-safe variables, plus deterministic A/B variant bucketing
  • Preview endpoints (GET /api/v2/email/templates/registry[/:id/preview]) and a preview UI at frontend/app/dashboard/emails
  • Template versioning and delivery analytics were already implemented pre-PR and are unchanged

Scope notes

Test plan

  • npm run test -w backend (payment-router strategy tests)
  • npm run config:validate && npm run config:drift in backend/
  • npm run build && npm run bundle:check in frontend/
  • Manually load /admin/configuration (Payment Strategies tab) and /dashboard/emails preview page

…rategy pattern, component-based email templates
@vercel

vercel Bot commented Jul 29, 2026

Copy link
Copy Markdown

@CeceOs92 is attempting to deploy a commit to the smartdevs17's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jul 29, 2026

Copy link
Copy Markdown

@CeceOs92 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

@Smartdevs17
Smartdevs17 merged commit e7973ad into Smartdevs17:main Jul 29, 2026
9 of 14 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