OpenChip is a reference implementation of an open, federated pet microchip registry protocol.
It is not just a centralized pet registry app. The goal is to provide a durable, founder-independent recovery layer that can coexist with manufacturer registries and AAHA-style lookup systems while remaining useful as a single-node deployment today.
- A reference node for a future federated registry network.
- A practical single-node deployment for owners, shelters, and operators.
- A protocol-first system built around append-only event history, public/private data separation, and exportability.
- Not a replacement for chip manufacturers.
- Not a design that assumes one permanent operator or one permanent hosted service.
- Not a public directory of owner email, phone, or address data.
OpenChip is in a migration phase from a centralized CRUD-style registry toward a federation-ready reference node.
Current foundations in the repo:
ownership_eventsprovide append-only event history for critical state changes.owner_contactsseparate private contact channels from public registry metadata.organizationsandnodesmodel future independent operators.- public snapshot and event-stream exports provide a path toward mirroring and survivability.
- legacy tables still exist as local projections to keep the current app usable.
Architecture docs:
api/: Go API, local auth, event/projection writes, export endpointsweb/: Next.js owner and public portaldb/: PostgreSQL schema, migrations, and seedsinfra/: Docker Compose for local developmentdocs/: OpenAPI and architecture RFCs
- Public lookup must never expose raw owner PII.
- Owner contact is mediated by default.
- Trusted organization workflows should also move toward mediated contact by default.
- Any future direct-contact exception must be explicit, auditable, role-scoped, and easy to disable by policy.
- Shelter lookup responses are minimized to pet metadata plus mediated-contact semantics; they do not return raw owner contact data or owner names by default.
- Create the local env file:
cp .env.example infra/.env- Start the stack:
cd infra
docker-compose up --build- Open:
- Web UI: http://localhost:3000
- API: http://localhost:8080
- Adminer: http://localhost:8081
- Check health:
curl http://localhost:8080/healthcd api
go mod tidy
go run ./cmd/servercd web
npm install
npm run devThe API expects PostgreSQL 16 and runs migrations automatically on startup.
GET /.well-known/openchip-nodeGET /api/v1/federation/snapshotGET /api/v1/federation/events
These are phase 1 reference-node surfaces, not a full federation implementation yet.
GET /api/v1/aaha/lookup/{chip_id}remains a compatibility layer.- AAHA-style interoperability is not the protocol core.
The OpenAPI document lives at docs/openapi.yaml.
- Provision PostgreSQL 16.
- Set
DATABASE_URL,JWT_SECRET,BASE_URL,FROM_EMAIL, andADMIN_EMAIL. RESEND_API_KEYis only required whenDISABLE_EMAILis nottrue.- Configure
SHELTER_API_KEYSaskey:Organizationpairs if needed. - Run the API and web behind TLS in non-local environments.
- Back up the database and exported snapshots.
- Magic links are single-use and expire after 15 minutes.
- Magic-link completion is a deliberate
POSTflow rather than a side-effectingGET. - Browser sessions use an
HttpOnlycookie; the web app does not persist auth tokens inlocalStorage. - JWTs are node-local session tokens, not federation truth.
- Transfer tokens are hashed at rest before storage.
- Default owner exports redact lookup requester IP and user-agent metadata.
- Owner deletion anonymizes contact details while preserving auditability.
- Critical state changes should be represented as append-only events.
- Avoid logging full owner contact data.
- Inspect the existing implementation before making major changes.
- Update docs/architecture/ before changing schema or API behavior.
- Update docs/openapi.yaml when endpoints change.
- Run the relevant build/test commands before marking work complete.
- Summarize what changed, what remains centralized, and what federation path the work enables next.
openchip/
api/
web/
infra/
db/
docs/
.env.example
AGENTS.md