?

Chaos Builder: Optimizer Documentation

Auto-Discovery DevOps pipeline for server-side minification. Scans the filesystem for source files, applies a Triple-Pass API stack (Google Closure + Toptal + Local Scrub), and uses alias mapping to hide internal structure.

OVERVIEW
ARCHITECTURE
PIPELINE
SECURITY
FAQ

Chaos Builder: V12 Orchestrator

The Chaos Builder is a zero-dependency, server-side DevOps pipeline engineered to provide maximum JavaScript and CSS compression without relying on Node.js, Webpack, or native build tools.

🎯 High-Performance Minification
  • Triple-Pass API: Combines Google Closure Compiler, Toptal API, and local Regex scrubbing.
  • Zero Dependency: Runs entirely on standard PHP with curl logic.
  • AST-Safe: Cloud APIs operate at the Abstract Syntax Tree level to prevent code breakage.
  • V12 Auto-Discovery: Automatically detects source files via -org naming convention.
  • Alias Mapping: Displays human-readable codenames instead of real filenames for security.
  • Persistent State: Maintains build logs directly in JSON.
70% Max Compression
15+ Auto-Discovered
API Cloud Accelerated
V12 Auto-Discovery

The "No Node.js" Philosophy

Traditional web development relies heavily on local environments (NPM, Webpack, Babel). The Chaos Builder was created to allow on-the-fly deployments from any device. By offloading AST processing to Google and Toptal, the server can compile complex 120,000+ byte JavaScript simulations into 60KB production-ready assets without needing a local toolchain.

Key Features

  • Auto-Discovery Engine: Scans the root directory for *-org.js, *-org.css, and *.umd.js patterns to automatically build the asset list.
  • Alias Mapping: All filenames are replaced with human-readable codenames (e.g. "Physics Engine Core" instead of chaos-engine-core-org.js) to hide internal structure.
  • Intelligent Fallbacks: If the Google API rate-limits, it falls back to Toptal. If Toptal fails, it executes a local Regex scrub.
  • SW Auto-Bump: After the final asset is processed, the Service Worker cache version is automatically incremented.
  • Subfolder Resilient: Paths dynamically map to the true root directory ensuring parity across test servers and live domains.

Architecture & V12 Auto-Discovery

The system was upgraded to V12 Auto-Discovery. Previous versions used hardcoded file arrays and aggressive Regex golfing which occasionally corrupted syntax trees. V12 dynamically scans the filesystem and uses Cloud APIs for AST-safe compilation.

The Triple-Pass Stack

Layer 1: Google Closure CLOUD API The first pass sends code to closure-compiler.appspot.com. It reorganizes functions, renames internal variables intelligently, and optimizes execution flow.
Layer 2: Toptal API CLOUD API The second pass strips all semantic whitespace and compacts AST nodes via toptal.com/developers, enforcing absolute minimal byte size.
Layer 3: Local Scrub NATIVE PHP A final safety check that strips redundant semicolons and collapses lingering blocks locally, ensuring production readiness even on API failures.
💡 AST over Regex: Abstract Syntax Tree (AST) compilation prevents minifiers from breaking scoped variables. A traditional Regex minifier might delete a crucial space, but Google Closure explicitly understands the JavaScript semantics.

AJAX Micro-Tasking

Processing 15+ modules in a single PHP request would trigger a 504 Gateway Timeout. The Chaos Builder splits the workload into sequential AJAX calls:

Processing Loop
# JS triggers sequential AJAX loop for all discovered assets
POST: chaos-builder.php (process=0, key=***) ➔ Awaits ➔ 200 OK
POST: chaos-builder.php (process=1, key=***) ➔ Awaits ➔ 200 OK
...
Each asset gets a dedicated TTL (Time-To-Live) with 8s API timeout.

Minification Pipeline

V12 auto-discovers Source-of-Truth files via the -org naming convention and maps them to their minified equivalents. The alias system hides real filenames from the UI.

Alias (UI Name) Type Method
Physics Engine Core JS Triple-Pass (Closure + Toptal + Scrub)
Simulation UI Layer JS Triple-Pass
Interface Controller JS Triple-Pass
SPA Navigation Router JS Triple-Pass
Achievement Engine JS Triple-Pass
Atom Database JS Triple-Pass
Molecule Registry JS Triple-Pass
Chemistry Showcase JS Triple-Pass
Lightbox Engine (JS) UMD Triple-Pass (Pre-minified bypass)
Tab Navigator JS Triple-Pass
Service Worker Cache JS Triple-Pass + SW Auto-Bump
Event Driver JS Triple-Pass
Event System JS Triple-Pass
Global Stylesheet CSS Toptal + Scrub
Critical Path CSS CSS Toptal + Scrub
Lightbox Engine (CSS) CSS Toptal + Scrub
💡 Auto-Discovery: This table reflects the current alias map. New assets are automatically discovered when files matching the *-org.js or *-org.css pattern are added to the project root.

Persistence (build-stats.json)

The pipeline writes directly to a raw JSON array format, persisting previous build results so the interface remains populated without needing database engines like MySQL.

Security Controls

⚠️ Access Restriction
The build script executes physical write actions on the server. To prevent malicious exhaustion or sabotage, execution is locked behind an Action Key.

Authorization Flow

  • Action Key: Execution requires the BUILD_PASSWORD defined in server config.
  • POST Verification: AJAX requests pass the key via POST body. An incorrect key returns an immediate JSON error equivalent to HTTP 401.
  • Index-Based Processing: File selection uses numeric indices into the auto-discovered array; users cannot pass custom file paths, preventing Directory Traversal.

Native Execution (Standalone)

The UI is also available standalone. By navigating directly to the respective location for admin use, this serves its own self-contained dark/light mode DOM interface. It shares no html/body wrappers with the primary site, ensuring iframe constraints and layout cascades never interfere.

Frequently Asked Questions

Why does the UI show "Fallback" in orange? Both Google Closure and Toptal have rate limits or IP bans for abuse. If both cloud operations timeout, the internal PHP script drops back to simple Regex regex optimizations. Your code is still built, just slightly heavier.
Why doesn't Fancybox shrink? Because fancybox-org.umd.js is fundamentally a vendor-shipped UMD file that is already highly optimized. The API correctly detects no room for improvement.
I triggered a build but the site hasn't updated. The assets compile securely, but the Service Worker (sw.min.js) and footer.php need to coordinate a global cache bust. In extreme cases, a hard refresh (Ctrl+F5) is required to purge Service Worker caches.
Can I add custom files? Yes! V12 uses auto-discovery. Simply name your source file with the -org suffix (e.g. my-module-org.js) and place it in the project root. The builder will automatically detect it and map it to my-module.min.js. Add an alias in the $ALIASES array for a human-readable UI name.

Copyright © 2026 Dr. Felix Sébastien Bourier. All rights reserved.

Chaos Builder: Optimizer

Active / Live
PHP OrchestrationGoogle Closure APIToptal MinifierAuto-Discovery EngineAlias MappingDevOps

Auto-Discovery DevOps pipeline for server-side minification. Scans the filesystem for source files, applies a Triple-Pass API stack (Google Closure + Toptal + Local Scrub), and uses alias mapping to hide internal structure.


EXTREME MODE V12 Auto-Discovery 21 Assets Detected Zero-Dependency

Minification Orchestrator

Standby Mode: Last optimization log ready.
  • Module: Chaos Chemistry Logic Method: Triple-Pass: [Toptal API + Scrub] [Persisted]
    ✓ Optimized 24.9 KB → 6.7 KB (-73.2%)
  • Atom Database Method: Triple-Pass: [Toptal API + Scrub] [Persisted]
    ✓ Optimized 42.3 KB → 24.2 KB (-42.8%)
  • Physics Engine Core Method: Triple-Pass: [Toptal API + Scrub] [Persisted]
    ✓ Optimized 239.0 KB → 76.3 KB (-68.1%)
  • Simulation UI Layer Method: Triple-Pass: [Toptal API + Scrub] [Persisted]
    ✓ Optimized 58.3 KB → 36.8 KB (-36.9%)
  • Event Driver Method: Triple-Pass: [Toptal API + Scrub] [Persisted]
    ✓ Optimized 8.8 KB → 1.3 KB (-85.2%)
  • Event System Method: Triple-Pass: [Toptal API + Scrub] [Persisted]
    ✓ Optimized 69.0 KB → 46.0 KB (-33.3%)
  • Math Utilities Method: Triple-Pass: [Toptal API + Scrub] [Persisted]
    ✓ Optimized 6.6 KB → 2.4 KB (-63.8%)
  • Orbital Visualizer Method: Triple-Pass: [Toptal API + Scrub] [Persisted]
    ✓ Optimized 20.1 KB → 7.9 KB (-60.8%)
  • Module: Chaos Organic Reactions Method: Triple-Pass: [Toptal API + Scrub] [Persisted]
    ✓ Optimized 158.6 KB → 38.2 KB (-75.9%)
  • Interface Controller Method: Triple-Pass: [Toptal API + Scrub] [Persisted]
    ✓ Optimized 41.4 KB → 18.1 KB (-56.2%)
  • Lightbox Engine (JS) Method: Triple-Pass: [Toptal API + Scrub] [Persisted]
    ✓ Optimized 137.0 KB → 137.0 KB (-0.0%)
  • Critical Path CSS Method: Toptal + Scrub [Persisted]
    ✓ Optimized 35.2 KB → 11.2 KB (-68.2%)
  • Lightbox Engine (CSS) Method: Toptal + Scrub [Persisted]
    ✓ Optimized 24.7 KB → 23.8 KB (-3.8%)
  • Global Stylesheet Method: Toptal + Scrub [Persisted]
    ✓ Optimized 106.4 KB → 61.8 KB (-41.9%)
  • Achievement Engine Method: Triple-Pass: [Toptal API + Scrub] [Persisted]
    ✓ Optimized 118.0 KB → 64.4 KB (-45.4%)
  • Molecule Registry Method: Triple-Pass: [Toptal API + Scrub] [Persisted]
    ✓ Optimized 129.5 KB → 88.3 KB (-31.8%)
  • Chemistry Showcase Method: Triple-Pass: [Toptal API + Scrub] [Persisted]
    ✓ Optimized 73.3 KB → 39.7 KB (-45.9%)
  • Tab Navigator Method: Triple-Pass: [Toptal API + Scrub] [Persisted]
    ✓ Optimized 2.2 KB → 1.0 KB (-54.3%)
  • SPA Navigation Router Method: Triple-Pass: [Toptal API + Scrub] [Persisted]
    ✓ Optimized 39.4 KB → 14.3 KB (-63.8%)
  • Service Worker Cache Method: Triple-Pass: [Toptal API + Scrub] [Persisted]
    ✓ Optimized 4.7 KB → 1.9 KB (-59.3%)

Last Optimization Run

Total Source: 1,339.3 KB → Minified Payload: 701.1 KB (-47.7%)