Power plant for developers. Reactors are servers, turbines are CI, coolant is monitoring, meltdowns are outages.
- JavaScript 100%
| node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709 | ||
| src | ||
| tests | ||
| package.json | ||
| README.md | ||
code-power-plant
Power plant for developers. Reactors are servers, turbines are CI, coolant is monitoring, meltdowns are outages.
Usage
const { PowerPlant, REACTOR_TYPES, DEMAND } = require('./src/plant');
const plant = new PowerPlant('Dev Valley Plant');
plant.hireOperator('Alice', 8);
// Add more capacity
plant.addReactor(REACTOR_TYPES.CACHE);
plant.addTurbine('CI Turbine C');
// Adjust control rods
plant.insertRods('backend', 20);
plant.withdrawRods('frontend', 10);
// Run cycles
plant.setDemand(DEMAND.PEAK);
for (let i = 0; i < 10; i++) plant.tick();
// Emergency
plant.scram('cache');
console.log(plant.plantView());
console.log(plant.report());
Reactor Types
- Frontend (200 MW, heat 500) — UI rendering core
- Backend (350 MW, heat 600) — Business logic core
- Database (150 MW, heat 700) — Data persistence core
- Cache (100 MW, heat 400) — Fast access, runs hot
- Worker (80 MW, heat 450) — Async job processor
Demand Cycle
Night (50%) -> Morning Ramp (80%) -> Peak (120%) -> Evening Decline (90%) -> Late (60%)
Components
- Reactor — Power output, heat/control rods, meltdown/scram/restart
- Turbine — Converts reactor power, efficiency degradation, service cycles
- CoolingSystem — Pump management, flow rate, cooling power
- PowerPlant — Grid balance, operators, brownouts, cascade meltdowns, ASCII view