Building Darwin.js: A Self-Evolving Agentic Bazaar with FastAPI, Next.js, ChromaDB, and Live Code Mutation
Darwin.js started from a simple prompt: What if non-player characters could rewrite their own source code when players discovered exploits? That idea turns into a live simulation with four moving p...

Source: DEV Community
Darwin.js started from a simple prompt: What if non-player characters could rewrite their own source code when players discovered exploits? That idea turns into a live simulation with four moving parts: a FastAPI backend that simulates a bazaar merchants that execute Python logic from local files a Governor that monitors trade telemetry a frontend that makes the entire adaptation loop visible This post walks through how the system works, the tradeoffs behind the architecture, and how we made it demoable end-to-end. The Product Idea The app presents a cyber-bazaar where merchants sell items, take losses, and get attacked by a player using exploit presets like: integer overflow re-entrancy attack item duplication When the losses cross a threshold, the system mutates the merchant’s local trade(context) function and hot-reloads the new behavior. This is important: the mutation is not hidden in logs. The app exposes the entire adaptive loop: exploit trigger telemetry logging anomaly detecti