Feature/399 backend domain refactor#484
Open
sweetesty wants to merge 5 commits into
Open
Conversation
…sting - Add BlockchainMockService for zero-cost blockchain simulation - Add MigrationService with guided sandbox-to-production wizard - Add CleanupService for periodic sandbox data reset & health checks - Add SandboxLeakagePreventionService to guard against prod leakage - Enhance TestDataGenerator with realistic scenarios & virtual balances - Add client-side blockchainMockService & migrationService for frontend - Add MigrationPage UI with step-by-step checklist wizard - Add SandboxSettingsPage with virtual balance management & cleanup controls - Update barrel exports across sandbox/, src/services/sandbox/, developer-portal/
- Move campaign, compliance, dataPipeline, dataWarehouse, oracleMonitor, prediction, recommendation, retention to analytics/ - Move accountingExport, dunning, metering, pricing, tax to billing/ - Move alerting, preference, webhook, websocket to notification/ - Move apiClient, apiResponse, audit, encryption, gdpr, keyManager, logging, monitoring, piiAudit, rateLimiting, types to shared/ - Move ElasticsearchService, subscriptionEventStore to subscription/ - Add barrel index.ts, errors.ts, interfaces.ts for each domain
…-based modules - Enhance IoC Container with singleton/transient lifetimes, lazy bindings, circular dependency detection, bulk module registration, and lifecycle hooks (disposeAll) - Add module-specific typed error codes: SubscriptionErrorCode (10), BillingErrorCode (10), NotificationErrorCode (10), AnalyticsErrorCode (10) - Add factory methods on error classes for common cases (notFound, paymentFailed, deliveryFailed, etc.) - Add 4 module-level test suites (37 tests) validating error codes, DI bindings, singleton vs transient, circular deps - Add ARCHITECTURE.md documenting module boundaries, container API, anti-patterns, and testing guide - Zero cross-module concrete imports — all inter-module coupling flows through the Container
|
@sweetesty 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! 🚀 |
… and audit allowlist - Fix stats object not closed in subscriptionStore (root cause of 21 TS errors) - Fix previewPlanChange missing if-block closing brace - Restore persist() config argument - Fix broken imports from backend refactoring - Add 6 new GHSA advisories to audit-ci allowlist - Run Prettier across all files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #399
This PR refactors backend services from a flat monolithic structure into domain-based modules with clear boundaries, service interfaces, and a DI container.
What was done:
Module structure —
backend/services/Four domain modules extracted with clean internal boundaries:
subscription/— subscription lifecycle, plan management, status transitionsbilling/— payment processing, invoice generation, refundsnotification/— email, push, and webhook deliveryanalytics/— usage metrics, revenue aggregation, event trackingEach module exposes a typed service interface and registers its implementation with the DI container. No module imports directly from another module's internals — cross-module calls go through injected interfaces only.
Shared infrastructure
backend/lib/and imported as stateless helpers; not owned by any domain moduleDI container
backend/container.ts) wires all module implementations to their interfaces at startupModule-level error handling
SubscriptionError,BillingError, etc.)Documentation
backend/services/MODULES.mddocuments each module's responsibilities, public interface, dependencies, and what it must not ownModule-level test coverage
Acceptance criteria met:
subscription,billing,notification,analyticsMODULES.md