|
| 1 | +# Knowledge-as-Code Template |
| 2 | + |
| 3 | +A template for building structured, version-controlled knowledge bases with an ontology-first approach. Edit a config file, add markdown data, get a full HTML site + JSON API. |
| 4 | + |
| 5 | +## Quick Start |
| 6 | + |
| 7 | +1. **Use this template** — click "Use this template" on GitHub, or clone locally |
| 8 | +2. **Edit `project.yml`** — define your domain entities, groups, colors, and site identity |
| 9 | +3. **Add data** — create markdown files in `data/` following the schema in `data/_schema.md` |
| 10 | +4. **Build** — `node scripts/build.js` |
| 11 | +5. **Deploy** — push to GitHub, Pages deploys automatically |
| 12 | + |
| 13 | +## What You Get |
| 14 | + |
| 15 | +- **Static HTML site** — homepage, list pages, detail pages, coverage matrix, timeline, comparison tool |
| 16 | +- **JSON API** — programmatic access at `docs/api/v1/` |
| 17 | +- **Bridge pages** — SEO-targeted pages like "Does X require Y?" |
| 18 | +- **Dark/light theme** — with persistence |
| 19 | +- **Client-side search** — lazy-loaded, keyboard-navigable |
| 20 | +- **Zero dependencies** — Node.js built-ins only |
| 21 | + |
| 22 | +## Project Structure |
| 23 | + |
| 24 | +``` |
| 25 | +project.yml # Domain configuration (edit this first) |
| 26 | +data/ |
| 27 | + examples/ # Example data (replace with your own) |
| 28 | + primary/ # Stable anchor entities (e.g., requirements, obligations) |
| 29 | + container/ # Grouping entities (e.g., frameworks, regulations) |
| 30 | + authority/ # Source entities (e.g., organizations, regulators) |
| 31 | + mapping/ # index.yml connecting containers to primaries |
| 32 | +scripts/ |
| 33 | + build.js # Config-driven site generator |
| 34 | + validate.js # Cross-reference validator |
| 35 | +docs/ # Generated output (do not edit) |
| 36 | +``` |
| 37 | + |
| 38 | +## The Ontology |
| 39 | + |
| 40 | +Every knowledge-as-code project has four entity roles: |
| 41 | + |
| 42 | +``` |
| 43 | +Authority → Container → Provision → Primary |
| 44 | +``` |
| 45 | + |
| 46 | +| Role | What it is | Example domains | |
| 47 | +|------|-----------|----------------| |
| 48 | +| **Primary** | Stable anchors that don't change when sources change | Requirements, Obligations, Capabilities, Controls | |
| 49 | +| **Container** | Grouping entities that contain provisions | Regulations, Frameworks, Products, Standards | |
| 50 | +| **Authority** | Source entities that produce containers | Regulators, Vendors, Standards bodies | |
| 51 | +| **Secondary** | Mapping entities connecting containers to primaries | Provisions, Implementations, Mappings | |
| 52 | + |
| 53 | +Primaries are stable; containers are unstable. When a framework is amended, its provisions change, but the underlying requirements persist. |
| 54 | + |
| 55 | +## Configuration |
| 56 | + |
| 57 | +All domain-specific settings live in `project.yml`: |
| 58 | + |
| 59 | +- **Entity names** — what to call each entity type (e.g., "Requirement" vs "Obligation") |
| 60 | +- **Groups** — categories for primary entities, with dark/light mode colors |
| 61 | +- **Statuses** — lifecycle states for containers, with colors |
| 62 | +- **Navigation** — site nav items |
| 63 | +- **Bridge pages** — which SEO pages to generate |
| 64 | +- **Theme** — accent colors |
| 65 | + |
| 66 | +## Commands |
| 67 | + |
| 68 | +```bash |
| 69 | +node scripts/build.js # Build the site |
| 70 | +node scripts/validate.js # Validate cross-references |
| 71 | +``` |
| 72 | + |
| 73 | +## Architecture |
| 74 | + |
| 75 | +- **File-over-App** — data in markdown files, not a database |
| 76 | +- **Zero dependencies** — no npm install, no supply chain risk |
| 77 | +- **Bespoke static generation** — the build script _is_ the specification |
| 78 | +- **GitOps** — Git is the single source of truth |
| 79 | + |
| 80 | +## License |
| 81 | + |
| 82 | +MIT |
0 commit comments