Getting started
Run the vendors service locally, add a firm and a person, and record a certificate of insurance.
Start it
make dev-up
./localenv up vendors-apiThe service listens on localhost:8146. Its database is vendors
on the local Postgres. Swagger UI is at
localhost:8146/api-docs.
Locally there is no Cloudflare Access. The runner starts the service with DEV_AUTH=1,
and the caller is whoever the X-Dev-Principal header names, or DEV_PRINCIPAL without
one. Only the emails in VENDORS_EDITORS can change anything, and locally that is the
dev principal, the same person construction treats as its editor. Under DEV_AUTH any
service token is accepted, so construction needs no secret to call it locally.
Add a firm and a person
curl -s -X POST localhost:8146/v1/vendors \
-H "X-Dev-Principal: $ME" \
-H "Idempotency-Key: $(uuidgen)" \
-H 'Content-Type: application/json' \
-d '{"data": {"name": "Acme Structural", "kind": "engineer", "disciplines": ["structural"]}}' | jq
curl -s -X POST "localhost:8146/v1/vendors/$VENDOR_ID/contacts" \
-H "X-Dev-Principal: $ME" \
-H "Idempotency-Key: $(uuidgen)" \
-H 'Content-Type: application/json' \
-d '{"data": {"email": "[email protected]", "name": "Vendor Local"}}' | jqRecord a certificate
curl -s -X POST "localhost:8146/v1/vendors/$VENDOR_ID/insurance" \
-H "X-Dev-Principal: $ME" \
-H "Idempotency-Key: $(uuidgen)" \
-H 'Content-Type: application/json' \
-d '{"data": {"coverage": "general_liability", "carrier": "Hiscox", "policy_number": "GL-1",
"limit_minor": 200000000, "effective_on": "2026-01-01", "expires_on": "2027-01-01"}}' | jq
curl -s "localhost:8146/v1/vendor-insurance?status=expiring" -H "X-Dev-Principal: $ME" | jqChange the database
SQL lives in services/vendors/queries/vendor.sql; the Go under
db/vendordb is generated. Run go tool sqlc generate from the repository root after
changing it, and make generate GEN_SERVICES=vendors after changing a route.