versions + shared path
Configure `versions: ['2.1','2.0.1','1.6']` and `path: '/ocpp'`. Stations hit one route; Sec-WebSocket-Protocol picks the match.
The npm package that turns a Node server into an OCPP-J CSMS endpoint — negotiation, framing, schema validation, and a clean handler API.
Install `fastify-ocpp`, register once, then own BootNotification, Authorize, transactions, and outbound Reset / remote start in your code — not in a fork of the wire protocol.
From npm
fastify-ocpp
install
npm i fastify-ocpp
register
register(fastifyOcpp, { versions, path })
api
ocpp.onAction · ocpp.call · registry
Package
fastify-ocpp @1.0.0
Runtime
Node.js 18+
Types
TypeScript included
Package surface
Configure `versions: ['2.1','2.0.1','1.6']` and `path: '/ocpp'`. Stations hit one route; Sec-WebSocket-Protocol picks the match.
Register handlers per action (optionally per version). Return a plain object — the package wraps CALLRESULT and validates it.
Outbound CSMS→station CALLs with timeout. Inspect `conn.version` before choosing RemoteStart vs RequestStartTransaction.
`validateIncoming` / `validateOutgoing` default on. Official Open Charge Alliance JSON schemas ship inside the package.
Live map of chargePointId → connection. Filter by negotiated version and gate operator commands on real presence.
`callTimeoutMs`, `rejectDuplicateConnections`, `onConnect` / `onDisconnect` — production defaults without reinventing the session layer.
How it works
`npm i fastify-ocpp` (Node 18+). The package ships `dist/`, TypeScript types, and the OCA `schemas/` tree.
Pass `versions` (allow-list + preference) and `path`. You get `app.ocpp` — handlers, outbound call, and the registry.
Implement BootNotification, Heartbeat, Authorize, transactions. Use `ocpp.call` from your operator API for Reset and remote start.
Try it
Package facts
Name
fastify-ocpp
Protocols
OCPP-J 1.6, 2.0.1, 2.1
Surface
onAction, call, registry, schemas
License
GPL-3.0-only
FAQ
Grab the package on npm, clone the repo, or read the CSMS tutorial when you want the full protocol walkthrough.