Skip to content

feat(#384): Implement sandbox environment for developer testing#483

Open
sweetesty wants to merge 4 commits into
Smartdevs17:mainfrom
sweetesty:feature/384-sandbox-environment
Open

feat(#384): Implement sandbox environment for developer testing#483
sweetesty wants to merge 4 commits into
Smartdevs17:mainfrom
sweetesty:feature/384-sandbox-environment

Conversation

@sweetesty
Copy link
Copy Markdown

Closes #384


This PR implements an isolated sandbox environment for developer testing with no real costs or production data exposure.

What was done:

src/services/sandbox/

  • SandboxService — core sandbox lifecycle management: create, reset, destroy, and migrate sandbox accounts
  • sandboxGuard middleware — enforces strict sandbox/production isolation; sandbox API keys are rejected on production endpoints and vice versa; prevents any sandbox data from leaking into production
  • MockBlockchainService — intercepts all on-chain calls in sandbox mode and returns realistic mock responses with zero gas cost; no real transactions submitted to any network
  • TestDataGenerator — factory functions for generating realistic subscriptions, transactions, wallets, and payment histories using configurable presets (e.g. active plan, trial expiry, failed payment)

Sandbox account creation

  • POST /api/sandbox/accounts — creates a sandbox account with a virtual balance (configurable, defaults to 10,000 test units)
  • Sandbox-specific API keys issued on account creation; clearly prefixed (sk_sandbox_...) to distinguish from production keys
  • Sandbox accounts stored in an isolated DB schema/namespace with no foreign key relationships to production tables

sandbox/

  • Sandbox configuration and seed data
  • Periodic cleanup job: stale sandbox accounts (inactive for 30 days) are automatically reset to initial state; virtual balances restored, test data cleared
  • Manual reset endpoint: POST /api/sandbox/reset — developer can reset their sandbox to a clean state at any time

developer-portal/

  • Sandbox-to-production migration wizard UI: validates sandbox configuration, checks for missing production credentials, and produces a step-by-step checklist before promoting
  • Sandbox dashboard showing virtual balance, active test scenarios, and API key management

Acceptance criteria met:

  • ✅ Sandbox account creation with virtual balance
  • ✅ Mock blockchain requests — no on-chain costs
  • ✅ Test data generators for realistic scenarios
  • ✅ Sandbox-to-production migration wizard
  • ✅ Periodic sandbox cleanup and reset
  • ✅ Sandbox-specific API keys (sk_sandbox_... prefix)
  • ✅ Sandbox leakage to production prevented via sandboxGuard middleware

…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/
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 31, 2026

@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! 🚀

Learn more about application limits

sweetesty added 3 commits May 31, 2026 01:16
- 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
… 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement sandbox environment for developer testing

1 participant