Coral reef for developers. Coral polyps are microservices, symbiotic algae are dependencies, bleaching is outage, biodiversity is feature richness.
- JavaScript 100%
| node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709 | ||
| src | ||
| tests | ||
| package.json | ||
| README.md | ||
code-coral-reef
Coral reef for developers. Coral polyps are microservices, symbiotic algae are dependencies, bleaching is outage, biodiversity is feature richness.
Usage
const { Reef, CORAL_TYPES, FISH_TYPES } = require('./src/reef');
const reef = new Reef('Great Barrier Production');
reef.setKeeper('Jacques');
// Plant coral colonies
reef.plantColony('Auth Service', CORAL_TYPES.BRANCHING);
reef.plantColony('Legacy Monolith', CORAL_TYPES.BRAIN);
// Add fish (traffic)
reef.addFish(FISH_TYPES.PUFFERFISH, 3); // Spike traffic
// Monitor water quality
reef.water.temperature = 30; // CPU warming up
reef.clean();
reef.cool();
// Time passes
for (let i = 0; i < 10; i++) reef.tick();
reef.advanceDay();
console.log(reef.reefView());
console.log(reef.report());
Coral Types
- Branching (Microservice) — Fast-growing, many endpoints, fragile
- Brain (Monolith) — Slow, massive, ancient, very hard to break
- Fan (API Gateway) — Flat, wide, catches/routes everything
- Soft (Prototype) — No skeleton, experimental, might not survive
- Table (Database) — Flat surface, structured data
Fish (Traffic)
- Clownfish (Normal User) — Peaceful, predictable
- Pufferfish (Spike Traffic) — Sudden resource hits
- Moray Eel (WebSocket) — Long-lived connections
- Surgeonfish (Health Check) — Constant checking
- Reef Shark (Aggressive Crawler) — Takes what it wants
- Parrotfish (Cache Warmer) — Cleans up, beneficial
Components
- Polyp — Individual endpoint with health/algae/color
- CoralColony — Service with polyps, growth, bleaching
- Water — Temperature/pH/salinity/pollution/flow quality system
- Reef — Multi-colony management, bleaching events, ASCII cross-section