@naisys/erp
v3.0.3
Published
NAISYS ERP - Web UI for AI-driven order and work management
Readme
@naisys/erp (server)
← Back to ERP | ← Back to main README
Fastify server for the NAISYS ERP. Owns the ERP database (Prisma + SQLite), serves the REST API, hosts the bundled React client, and exposes an agent-facing HATEOAS API discoverable at runtime.
This is the npm-published half of @naisys/erp — the bundled client lives in ../client/ at dev time and gets copied into client-dist/ for publish.
Running
Standalone:
npm install @naisys/erp
npx naisys-erpSee the ERP README for the full configuration (NAISYS_FOLDER, SERVER_PORT, SUPERVISOR_AUTH, PUBLIC_READ) and feature list.
Dev mode (from monorepo):
npm run dev --workspace=@naisys/erpStructure
erpServer.ts— Fastify bootstrap (cookies, CORS, multipart, rate limit, static client, swagger/scalar API ref)erpRoutes.ts— route registration entry pointroutes/— per-resource routes (orders, operations, steps, fields, items, etc.) with co-located HATEOAS action/link buildersservices/— business logic kept out of routesdatabase/— Prisma client wiring, schema-version check, migration deployhateoas.ts/schemaRegistry.ts/route-helpers.ts— generic HATEOAS helpers, per-endpoint schema discovery, slim-response helpersmiddleware/— auth, permission gatingtests/— Vitest API tests and Playwright UI E2E
API design
- HATEOAS-driven discoverable REST API — see doc 012
- Disabled actions include a reason so agents understand the gate
- Batch endpoints, slim responses on mutations, per-endpoint schema (not bulk OpenAPI)
- Zod-validated multipart input with type coercion and hints
- Hash-based attachment storage for step fields
Auth
- Local ERP auth, or shared session/passkey auth with supervisor when
SUPERVISOR_AUTH=true(see doc 007) - Agent API keys for cross-app calls
Scripts
npm run dev—tsx watchagainstsrc/erpServer.tsnpm run build— Prisma generate + tscnpm run bundle— copy the built client intoclient-dist/for publishnpm run start— rundist/erpServer.jsnpm test— Vitest + Playwright
License
MIT
