Site teams upload field reports, photos, logs and incident documents; an audit pipeline compares them against OSHA construction standards and an AI agent answers safety questions grounded in the regulations.
01
The problem
Construction safety compliance runs on spreadsheets, email threads and binders. Inspections get done, but the evidence lives in ten places, and ‘are we compliant with this standard?’ depends on who you ask.
Who it’s for
Compliance and safety teams on construction sites.
02
Goals & constraints
Goals
- One pipeline from upload to audit.
- Automate evidence classification.
- An assistant that answers from the actual regulations.
Constraints
- Wrong answers about safety are worse than no answer, so the AI had to be grounded and citeable.
- Business rules change often, so they had to stay isolated from plumbing.
03
Approach
- 1.
API gateway + independent services
An API gateway in front of a compliance service and an AI worker, so audit logic and AI processing scale and deploy separately.
- 2.
Domain-driven core
Compliance rules sit in their own domain layer, separate from transport and storage.
- 3.
Event-driven evidence pipeline
Uploads emit jobs on BullMQ/Redis; the AI worker classifies and audits them asynchronously.
04
Architecture
Microservices, DDD, event-driven queues and a RAG agent, containerised with Docker.
- 01SvelteKit UI → API gateway
- 02compliance service ⇄ domain layer ⇄ Prisma / Postgres
- 03upload → BullMQ (Redis) → AI worker
- 04question → RAG agent → OSHA standard chunks → grounded answer
05
Key decisions
RAG over fine-tuning
Standards get updated. Retrieval means updating a document store, not retraining, and every answer can point back to its source.
Queue-first evidence handling
Classification is slow and failure-prone. Doing it off the request path keeps the UI fast and makes retries free.
!
Challenges
Docker on Windows
Prisma binary-target mismatches, Alpine OpenSSL conflicts and BuildKit DNS failures, each solved and written down.
Chunking regulations well
Retrieval quality depended far more on how standards were chunked than on the model.
✓
Outcome & lessons
- Working end-to-end system shown on video; hosted instance currently offline.
- My first build combining microservices, DDD, event-driven design and RAG.
What I learned
- Grounding is a product feature, not an implementation detail.
- DDD pays for itself the first time a rule changes.
What’s next
- Bring the hosted demo back online
- Inline citations in agent answers