Massachusetts Building Code — n8n RAG Assistant
Ask plain-language questions about the Massachusetts Building Code using a self-hosted n8n RAG workflow over your own document index.
Built for architects, engineers, code consultants, and facility teams in Massachusetts who already maintain digital code references and want a conversational layer on top — with full control via n8n and your vector store.
Tools in this Stack
Why This Stack?
Reading dense code sections against a deadline is slow and error-prone. A retrieval-augmented workflow keeps answers grounded in the chunks you indexed (current code cycle, amendments, and your annotations) instead of the model guessing from memory. n8n wires ingestion, retrieval, and the LLM in one place you can audit, version, and run on your own infrastructure.
The Workflow
Step 1 — Curate and ingest code sources
Collect the official Massachusetts Building Code sources you are licensed or permitted to use (current edition, local amendments, and AHJ bulletins). In n8n, use nodes to fetch or read files, split text into chunks, generate embeddings, and upsert into your vector database (e.g. Postgres + pgvector, Pinecone, or Qdrant). Schedule re-ingestion when the code cycle updates.
Step 2 — Build the RAG chat workflow in n8n
Create a workflow triggered by a Webhook node. On each request, accept message and optional sessionId (UUID) so downstream nodes can load prior turns from memory or a thread store. Run similarity search on the user query, assemble a prompt with citations or chunk IDs, call your LLM provider, and return a JSON body with a single assistant string field (e.g. reply).
Step 3 — Try the public lab (optional demo)
We host a small Next.js page that proxies chat to your n8n webhook so the URL and tokens stay server-side. Open the Building Code lab to send test questions. The lab generates a session id on first send and sends it on every follow-up so your workflow can thread context without storing full history in the browser.
Limitations
- Not legal or engineering advice. Outputs depend on your indexed material and model settings; always verify against the official code and your Authority Having Jurisdiction (AHJ).
- Demo availability depends on configuring
N8N_MASS_BUILDING_WEBHOOK_URLin the deployment environment.
Estimated Monthly Cost
| Component | Notes | Cost |
|---|---|---|
| n8n | Self-hosted | From $0 (infra only) |
| n8n Cloud | If you prefer managed | From ~$20/mo |
| Embeddings + LLM | Provider-dependent | Varies |
Total depends entirely on hosting and model choices.
Try the lab
Send test questions through our Next.js proxy to your n8n webhook (session-aware).
Open Building Code labStack Details
- Category
- Compliance
- Difficulty
- Advanced
- Tools
- 1
- Added
- Apr 2026