Skip to content

Codebase Audit — April 2026

The Magic e-VERSE ecosystem consists of 4 major codebases. The architecture is sound (Medusa v2, Next.js 15, multi-tenant Docker via Coolify), but the codebase has accumulated significant technical debt from rapid development under time pressure.

RepositoryLocationSizeCommitsScoreVerdict
magic_omniverse/mnt/data/magic_omniverse~80GB13/10Very messy — dead code, symlink fragmentation, no git history
magic_pim/mnt/data/magic_pim~4GB24/10Script chaos, hardcoded creds, broken Docker configs
Magic-e-VERSE~/Magic-e-VERSE~4.5GB1185/10Best structured, but APLT sprawl and type safety issues
Magic-Monitor~/Magic-Monitor~72MB577/10Cleanest project, minor issues only

The password <your-db-password> appears in committed files across all repositories:

FileWhat’s Exposed
magic_omniverse/magic_commerce/magic_development/docker-compose.ymlDATABASE_URL with password, Anthropic API key, JWT/Cookie secrets
magic_omniverse/magic_agent/magic_agent_spranz/.envAnthropic API key (process.env.ANTHROPIC_API_KEY...), DB password, N8N JWT token
magic_pim/docker-compose.ymlDB password, AWS Access Key + Secret Key, Mail password
magic_pim/docker-compose.prod.ymlDB password as default fallback
magic_pim/sync-master.js (and 10+ other root scripts)DB password, Medusa admin password (supersecret)
Magic-e-VERSE/backend/.env.developmentDB password, JWT_SECRET=supersecret
Magic-e-VERSE/backend/src/utils/tenant-db.tsHardcoded fallback password in getDbCredentials()

In magic_pim/docker-compose.yml, the Toppoint S3 access key and secret key are committed in plaintext. These must be rotated immediately if the repo has ever been shared or pushed to a remote.

All repos only ignore .env but NOT .env.development, .env.production, .env.test, or .env.local. This means environment-specific files with real credentials can and do get committed.

  1. Rotate ALL exposed credentials: DB passwords, AWS keys, Anthropic API keys, JWT secrets
  2. Update all .gitignore files to use .env* wildcard pattern (keep only .env.example / .env.template)
  3. Remove secrets from git history with git filter-repo
  4. Move all secrets to Coolify environment variables or Vaultwarden
  5. Remove hardcoded password fallback from Magic-e-VERSE/backend/src/utils/tenant-db.ts

Score: 3/10

The worst offender. A monorepo that isn’t really a monorepo.

ItemSizeStatus
magic_commerce.git/15GBObsolete bare git repo — “Old Coolify hack”, listed in .gitignore
_archive/4.5GBOld backend/storefront copies
spranz_backup/6.7GBFull backup of spranz tenant
magic_agent/_legacy/1.2GBAbandoned agent implementation
magic_development_BACKUP_20260313/1.5GBDead backup in magic_commerce/
magiceverse3.zip58MBOld compressed export
Flowbuilder duplicates283MB3 versions of the same tool
Total~30GB

Most tenants in magic_commerce/ are symlinks to /mnt/nvme/magic_commerce/:

magic_brinxx -> /mnt/nvme/magic_commerce/magic_brinxx
magic_spranz -> /mnt/nvme/magic_commerce/magic_spranz
magic_default -> /mnt/nvme/magic_commerce/magic_default

This means:

  • Git can’t track the actual tenant code
  • The monorepo is split across two physical locations
  • CI/CD can’t clone and build properly
  • 1 single commit in the entire repo history (“Initial commit”)
  • 63 uncommitted files in magic_b2b_glass_demo/
  • No branches, no tags, no release history
DuplicateVersions FoundAction Needed
N8N instancesmagic_n8n/, magic_n8n_2/, magic_n8n_3/Document purpose or consolidate
Flowbuilderflowbuilder/ (107MB), flowbuilder2/ (176MB), nested copyKeep 1, delete 2
3D viewerdefault/, default-3d/, spranz-3d/, dev/, magic_3d/Document which is canonical
  • Each service has its own Docker, env, and config approach
  • Port allocation spread across dozens of compose files
  • Mix of Docker-first and native-run services
  • No centralized configuration management

2. magic_pim — Product Information Management

Section titled “2. magic_pim — Product Information Management”
Score: 4/10

A functional Medusa v2 + Next.js 15 project buried under script chaos.

The root directory has 60+ utility scripts that should be organized:

Sync scripts (5 versions of the same thing):

  • sync-aplt-to-medusa.jsv2v3v4sync-master.js (claims to be “v5”)
  • Nobody documented which is canonical

Migration scripts (13 files):

  • migrate-brinxx-to-pim.js, migrate-brinxx-to-medusa.js, migrate-aplt-clean.js, migrate-from-json.js

Check/validation scripts (15 files):

  • check-admin-rights.js, check-auth-metadata.js, check-brinxx-mysql.js, check-products.js

Data files that don’t belong in root:

  • brinxx_pg.sql — 41.5MB SQL dump
  • brinxx-products.json — 3.9MB data export
  • missing-products.csv — 432KB
  • PDF design documents, Excel files

Windows batch files:

  • docker-start.bat, docker-stop.bat, start-backend.bat, PowerShell scripts
ProblemFileImpact
NODE_ENV=production in dev configdocker-compose.ymlWrong runtime behavior locally
Windows path D:/pim_data in prod configdocker-compose.prod.ymlBreaks on Linux
Runtime route override hackDockerfileCopies files to override Medusa internals at startup
Hardcoded passwords with fallback defaultsBoth compose filesSecurity risk
"@magiverse/i18n": "link:/mnt/data/magic_omniverse/packages/magiverse-i18n"

This absolute path in storefront/package.json breaks CI/CD and any build that doesn’t have the exact same filesystem layout.

Only 2 commits in the entire repo. No branches, no meaningful change trail.


Score: 5/10

The most actively developed project. Better structured, but growing pains are showing.

38 subdirectories under /api/admin/aplt/ with 155 route.ts files across the entire API layer. Admin routes are numbered (00-*, 01-*, 02-*) for sidebar ordering, which is brittle.

RouteAlongsideStatus
chloe-order/orders/Unknown — experimental? deprecated?
chloe-product/products/Unknown — same question
chloe-customer/customers/Unknown — same question

Nobody documented whether the “chloe-*” routes are experimental, deprecated, or active.

  • 111 instances of any type across the codebase
  • catch (err: any) pattern repeated 12+ times
  • No shared error handling abstraction
FileTODO
aplt/goods-receipts/[id]/route.tsCreate stock movements
aplt/dunning/[id]/route.tsActually send email
aplt/purchase-invoices/[id]/route.tsCreate journal entry
account/profile-password/index.tsxAdd password update support
account/profile-email/index.tsxSupport updating emails
page-builder/newsletter-section.tsxImplement newsletter API
cart/components/item/index.tsxGrab actual max inventory
lib/brands/brand-context.tsxFetch from DB (2x)
app/admin/brands/page.tsxSave to database via API
IssuePackageRisk
Pre-release in productionreact: 19.0.0-rc-...Potential breaking changes
Unpinned critical dep@medusajs/js-sdk: "latest"Could break on any install
Unused dependencymysql2PostgreSQL is the primary DB
  • magiceverse_evolved/ (96KB) — appears abandoned
  • magic_agent/ (60KB) — just API stubs

50+ console.log() statements in production connector code. No structured logging, no log levels, no filtering.


Score: 7/10

The cleanest project. Well-structured Express + React + Vite with proper separation of concerns.

  • Clean folder structure with logical module grouping
  • No code duplication
  • Proper SQL parameterization (safe from injection)
  • Multi-stage Docker build with healthcheck
  • Dead man’s switch pattern for collector monitoring
  • Consecutive failure tracking for alerts

Vitest configured in package.json but zero test files exist. Critical for a system that fires Slack/WhatsApp alerts.


RepoTest FilesBusiness Logic Lines
magic_omniverse010,000+
magic_pim05,000+
Magic-e-VERSE1 (health endpoint only)15,000+
Magic-Monitor03,000+
Total1~30,000+

Every repo uses raw console.log() and console.error(). No log levels, no structured JSON output, no filtering. Debugging production issues is extremely difficult.

The same database password is defined in 10+ locations across 4 repos. Port numbers, URLs, and secrets are hardcoded in docker-compose files, source code, utility scripts, and environment files. No single source of truth.

RepoCommitsBranchesUncommitted Files
magic_omniverse1163 files
magic_pim2113+ files
Magic-e-VERSE11818yarn.lock
Magic-Monitor576.gitignore

Only Magic-e-VERSE and Magic-Monitor have real git history. The other two repos are essentially unversioned codebases.

All 11+ tenants share the same codebase and deployment pipeline. One bad commit breaks every tenant simultaneously. No staging environment, no canary deployments, no rollback mechanism beyond “fix forward.”


  • 31 screenshots scattered in ~/ — sidebar iterations, dark/light mode variants, portal mockups
  • Abandoned feature dir: ~/magic-logo-moodshot-updates/ with 5 different “apply” scripts from February 2026
  • Critical reports loose in home: e2e-test-report-aplt-flow.md (NO-GO verdict), spranz-beta-devdocs.md (NOT production ready), n8n-orchestration-analysis.mdx

  1. Rotate ALL exposed credentials — DB password, AWS keys, Anthropic API keys, JWT secrets (~2h)
  2. Update all .gitignore files — use .env* wildcard, keep only .env.example (~30min)
  3. Remove secrets from git historygit filter-repo on each repo (~1h per repo)
  4. Move all secrets to Coolify env vars — single source of truth (~2h)
  5. Remove hardcoded password fallback from tenant-db.ts (~15min)
TaskSpace FreedEffort
Delete magic_commerce.git/ (needs sudo, owned by adminwayne)15GB5min
Delete _archive/4.5GB5min
Delete spranz_backup/6.7GB5min
Delete magic_agent/_legacy/1.2GB5min
Delete magic_development_BACKUP_20260313/1.5GB5min
Delete magiceverse3.zip58MB5min
Consolidate flowbuilder (keep 1, delete 2)283MB15min
Remove Magic-e-VERSE/magiceverse_evolved/96KB5min
Archive or delete ~/magic-logo-moodshot-updates/216KB5min
Organize ~/ screenshots into ~/screenshots/10min
Total~30GB~1.5h
TaskEffort
Move PIM root scripts into scripts/migrations/, scripts/sync/, scripts/checks/1h
Delete old script versions, document which are canonical1h
Move SQL dumps and data files to data/ directory30min
Fix PIM docker-compose: remove Windows path, fix NODE_ENV, externalize secrets1h
Resolve chloe-* route duplication in Magic-e-VERSE1h
Pin @medusajs/js-sdk to specific version15min
Replace link:/mnt/data/... dependency with proper package reference30min

Phase 4: Quality Infrastructure (Next Sprint)

Section titled “Phase 4: Quality Infrastructure (Next Sprint)”
TaskEffort
Add structured logging (Pino) to all services1-2 days
Replace 111 any types in Magic-e-VERSE1 day
Add unit tests for APLT order processing2 days
Add integration tests for supplier connectors1 day
Add tests for Magic-Monitor alert logic1 day
Set up shared ESLint + Prettier config2h
Update CI pipelines to run tests + linting2h
Pin React to stable release1h
TaskEffort
Resolve magic_omniverse symlinks — proper monorepo or separate repos1 week
Establish proper git workflow for omniverse and PIM1 day
Make Magic-Monitor tenants database-driven2h
Extract APLT constants into config files2h
Document N8N instance purposes (or consolidate)2h
Add staging environment for tenant safety1 week

# Files to delete (~30GB)
/mnt/data/magic_omniverse/magic_commerce.git/ # 15GB (needs sudo)
/mnt/data/magic_omniverse/_archive/ # 4.5GB
/mnt/data/magic_omniverse/spranz_backup/ # 6.7GB
/mnt/data/magic_omniverse/magic_agent/_legacy/ # 1.2GB
/mnt/data/magic_omniverse/magic_commerce/magic_development_BACKUP_20260313/ # 1.5GB
/mnt/data/magic_omniverse/magiceverse3.zip # 58MB
/mnt/data/magic_omniverse/magic_agent/flowbuilder2/ # 176MB
~/Magic-e-VERSE/magiceverse_evolved/ # 96KB
~/magic-logo-moodshot-updates/ # 216KB

Appendix: Files with Hardcoded Credentials

Section titled “Appendix: Files with Hardcoded Credentials”
# All of these contain plaintext passwords or API keys:
/mnt/data/magic_omniverse/magic_agent/magic_agent_spranz/.env
/mnt/data/magic_omniverse/magic_commerce/magic_development/docker-compose.yml
/mnt/data/magic_pim/docker-compose.yml
/mnt/data/magic_pim/docker-compose.prod.yml
/mnt/data/magic_pim/sync-master.js
/mnt/data/magic_pim/migrate-brinxx-to-pim.js
/mnt/data/magic_pim/backend/.env.development
~/Magic-e-VERSE/backend/.env.development
~/Magic-e-VERSE/backend/src/utils/tenant-db.ts