Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
server/routes
New HTTP routes go here as modules. Do not add route if blocks to server/index.ts.
scripts/testing/index-route-ratchet.test.ts fails when index.ts gains a path guard. Moving a route out needs no
change there: the numbers are lowered at each release.
- A route module exports a factory with explicit dependencies,
createXRoutes(deps): RouteHandler(same shape asserver/workspace-backup-http.ts). It never importsserver/index.ts. index.tsbuilds it next to its other wiring (one import, oneROUTES.push(createXRoutes({...}))); a module that needs no dependencies is listed inROUTESintable.tsdirectly.- A handler returns
PASSwhen the request is not its own; returning anything else means it answered. Inside one module, keep a literal path ahead of a pattern that would also match it. handleRequestruns the table right after the auth gate, so handlers are already authenticated. Scope rules stay keyed by path inserver/request-auth.ts.RouteContextcarriesreq,res,url,path,method,auth,json,readBody; the rest isdeps.- Type-only imports must be
import type(or an inlinetype): the server runs on type stripping, so a bare type import passestscand crashes at boot.