Getting Started¶
Welcome! This guide helps you get oriented before diving into the full documentation.
What is PQ?¶
PQ is a cloud-native physical access control platform. It manages doors, readers, inputs, outputs, and other security hardware through a unified event-driven architecture.
Your job as an adapter developer is to bridge your device to PQ: translate device events into PQ domain events, and route PQ commands back to the device.
What You Build vs. What the Framework Provides¶
| You provide | Framework provides |
|---|---|
| Vendor SDK / protocol knowledge | NATS message bus integration |
| Device communication logic | Event routing to server |
| Event translation | Command dispatch and routing |
| Command execution on device | Access sync engine (diff, ordering, hashing) |
| Thing configuration in YAML | Persistence (LiteDB) |
| Connection retry and lifecycle management | |
| UI and ABAC engine integration |
The framework generates a significant portion of the boilerplate from your YAML configuration — Thing classes, function state machines, typed command and event classes.
How an Adapter Fits In¶
PQ Server (API, UI, ABAC)
│
│ NATS (events, commands, status)
│
Adapter Process
│ ├─ Your protocol/SDK code
│ └─ Generated framework scaffolding
│
Physical Device(s)
Where to Start¶
Follow these steps in order. Each step names the page with the details.
Step 1 — Understand the architecture (15 min)
Read 00-overview.md. Pay attention to the Thing hierarchy, Functions, and the YAML-to-code generation workflow.
Step 2 — Prepare your development machine
- Install PQ with the PQ Installer. On Adapters & Integrations, also select PQ SDK Tooling
(
pq-tools). See PQ SDK Tooling. - Switch the PQ box to development mode. Development mode publishes NATS and opens the Internal API, so an adapter that runs outside the box can connect. See Local adapter development setup. Use development mode only on a development machine, never on a customer installation.
Step 3 — Pick your adapter family (10 min)
Browse archetypes/ and find the shape closest to your device's protocol (TCP, HTTP streaming, gRPC, native SDK, CCTV).
Step 4 — Build the minimal adapter (10 min)
Follow tutorials/00-hello-world.md. You will have a compiling, running adapter skeleton before reading anything else.
Step 5 — Implement and debug from your IDE
Implement the device protocol with 01-step-by-step.md and the
patterns. Run the adapter from Visual Studio or Rider against your development box, as
Local adapter development setup describes.
Step 6 — Build the image and test it on the device
- Build the adapter image. See Image anatomy.
- Start the lab rig with that image. The lab runs the image, records the adapter's protocol log, events and statuses, and sends commands through PQ. See Lab rig.
- Check each capability on the real device against the acceptance tests.
The lab commands
mark,commandandexpectshow whether the expected event arrives.
Step 7 — Write the documentation
- Fill
docs/connection.mdwith the connection guide template. - Create the coverage file and answer the questions:
docker run --rm -it -v "$PWD:/work" repo.protequ.com/pq/pq-tools:<tag> docs --bundle /work --assess. - Check the bundle with
--validateand read the generated pages with--preview /work/preview.
The full procedure is in Writing and delivering adapter documentation and PQ SDK Tooling.
Step 8 — Deliver Add the documentation bundle to the image, label it, and publish it. See Publishing an adapter and the definition of done.
What a Finished Adapter Looks Like¶
Pq.Adapter.Vendor.Product/
├─ adapter-registration.yaml # Device types, functions, commands — you write this
├─ access-model.yaml # Credential sync entities (optional)
├─ Communication/
│ ├─ Protocol.cs # Device communication — always required
│ └─ Transport.cs # Custom transport — only for gRPC/serial/SDK processes
├─ Devices/
│ ├─ ControllerDevice.cs # Extend generated Thing classes
│ └─ DoorDevice.cs
└─ Commands/
└─ DoorCommands.cs # Command handler methods
Typical adapter: 8–15 files, most of the complexity in Protocol.cs and event translation logic. Generated code handles the rest.
Key Reference Documents¶
Keep these open while implementing:
reference/generated-code-api.md—PqEventbuilders, command classes, function shortcut methodsreference/functions-registry.md— all standard functions (Door, Reader, Power, Tamper, …)02-patterns.md— index of proven implementation patternsdefinition-of-done.md— completion checklist, review before finishing
When You Get Stuck¶
- Check
03-troubleshooting.md— covers the most common build, connection, and event issues - Search the
concepts/directory for the specific area (commands, events, address resolution, …) - Check
patterns/for the nearest matching implementation pattern