Central orchestration server for the Fabrix distributed 3D printing platform.
- BackendGlitch
- contact@backendglitch.com
- Node.js 18+
- pnpm
- PostgreSQL database URL (for Neon or any PostgreSQL provider)
- Install dependencies:
pnpm install- Create environment file:
cp .env.example .env- Update
.envvalues (required for user auth and agent pairing):
NODE_ENV=development
PORT=4000
DATABASE_URL=postgresql://<username>:<password>@<host>/<database>?sslmode=require
JWT_ACCESS_SECRET=...
JWT_REFRESH_SECRET=...
AGENT_JWT_ACCESS_SECRET=...
AGENT_JWT_REFRESH_SECRET=...Without AGENT_JWT_*, POST /agent/pair/:code/consume returns 500 and the smoke test fails at step 4.
- Push database schema:
pnpm run db:push- Run in development mode:
pnpm run start:dev- API health check:
curl http://localhost:4000/health- Agent pairing smoke test (OWNER user must exist; sets
OWNER_EMAIL/OWNER_PASSWORD):
export OWNER_EMAIL=owner@example.com
export OWNER_PASSWORD=your-password
pnpm smoke:pairing # HTTP only (stdlib Python)
pnpm smoke:pairing:ws # + WebSocket (pip install websockets)- WebSocket gateway:
- Path:
ws://localhost:4000/ws/agent
- Path:
Expected health response shape:
{
"status": "ok",
"service": "fabrix-central",
"database": "connected",
"timestamp": "2026-..."
}pnpm smoke:pairing/pnpm smoke:pairing:ws- end-to-end agent pairing + optional WS check (scripts/pairing_smoke.py)pnpm run start:dev- start in watch modepnpm run build- build projectpnpm run start:prod- run production buildpnpm run db:generate- generate Drizzle SQL/migrationspnpm run db:push- push Drizzle schema to databasepnpm run db:studio- open Drizzle Studio
src/
├── main.ts
├── app.module.ts
├── health/
│ ├── health.module.ts
│ ├── health.controller.ts
│ └── health.service.ts
├── ws/
│ ├── ws.module.ts
│ └── agent.gateway.ts
└── database/
├── database.module.ts
├── database.service.ts
└── schema.ts