Project Structure¶
Version: CalVer, YYYY.MM.N (2026.09.7 at the time of writing)
Framework: React 19, built with Vite and tested with Vitest
Directory layout¶
The repository is ttl-editor. Test files are colocated with their source
(foo.js โ foo.test.js) and are left out of the tree below; see
Testing.
ttl-editor/
โโโ index.html # Vite entry page (at the root, not in public/)
โโโ vite.config.mjs # Build and Vitest configuration; output to dist/
โโโ eslint.config.mjs # ESLint flat config
โโโ playwright.config.js # End-to-end journeys
โโโ tailwind.config.js
โโโ postcss.config.js
โโโ package.json
โโโ package-lock.json
โโโ renovate.json # Dependency update policy
โโโ SECURITY-PIPELINE.md # Pins, required checks, accepted risks
โโโ .nvmrc # Exact Node version (24.20.0); CI reads it
โโโ .npmrc # min-release-age=14 โ npm's 14-day cooldown
โโโ .env.development # Local: backend :3001, Operaton :8081
โโโ .env.production # Loaded by every `vite build`
โโโ .env.acceptance # Loaded by nothing unless --mode acceptance
โโโ .env.example
โโโ .husky/
โ โโโ pre-commit # npx lint-staged
โ โโโ pre-push # deps:check, lint, check-format
โ
โโโ public/ # Copied verbatim into dist/
โ โโโ favicon.svg, favicon.ico, favicon-96x96.png, apple-touch-icon.png
โ โโโ manifest.json, web-app-manifest-192x192.png, web-app-manifest-512x512.png
โ โโโ robots.txt
โ โโโ CognitatieAnnotationExport.xml
โ โโโ examples/
โ โโโ organizations/svb/ # RONL_BerekenLeeftijden_CPRMV.dmn
โ
โโโ src/
โ โโโ App.jsx # Main orchestrator: layout, navigation, import
โ โโโ App.css
โ โโโ index.jsx # React entry point
โ โโโ index.css # Global styles, Tailwind imports
โ โโโ parseTTL.enhanced.js # TTL parser with DMN preservation
โ โโโ setupTests.js # Vitest setup
โ โโโ logo.svg
โ โ
โ โโโ components/
โ โ โโโ PreviewPanel.jsx # Live TTL preview side panel
โ โ โโโ PublishDialog.jsx # TriplyDB publish dialog + pre-publish SHACL panel
โ โ โโโ tabs/
โ โ โโโ index.js # Barrel export โ the four lazy tabs deliberately excluded
โ โ โโโ ServiceTab.jsx
โ โ โโโ CostSection.jsx # Embedded in ServiceTab
โ โ โโโ OutputSection.jsx # Embedded in ServiceTab
โ โ โโโ OrganizationTab.jsx
โ โ โโโ LegalTab.jsx
โ โ โโโ RulesTab.jsx # RPP: Rules
โ โ โโโ ParametersTab.jsx # RPP: Parameters
โ โ โโโ CPRMVTab.jsx # RPP: Policy (lazy-loaded)
โ โ โโโ DMNTab.jsx # DMN upload, deploy, test (lazy-loaded)
โ โ โโโ ConceptsTab.jsx # NL-SBB concept definitions
โ โ โโโ VendorTab.jsx # Vendor integration, hosts the iKnow UI (lazy-loaded)
โ โ โโโ IKnowMappingTab.jsx # iKnow mapping config (rendered inside VendorTab)
โ โ โโโ ChangelogTab.jsx # Version history and build provenance (lazy-loaded)
โ โ
โ โโโ hooks/
โ โ โโโ useEditorState.js # Centralised state management
โ โ โโโ useArrayHandlers.js # DRY CRUD for array-based fields
โ โ โโโ useDsoImport.js # DSO โ DMN deep-link import
โ โ
โ โโโ utils/
โ โ โโโ index.js # Barrel export
โ โ โโโ constants.js # Shared constants, TTL_NAMESPACES, dropdown options
โ โ โโโ ttlGenerator.js # TTL generation class
โ โ โโโ ttlHelpers.js # TTL string/IRI helpers (escapeTTLString, sanitizeIri, โฆ)
โ โ โโโ importHandler.js # Import logic
โ โ โโโ cprmvImport.js # CPRMV 0.4.1 Rules API โ flat model
โ โ โโโ shaclHelper.js # Pre-publish SHACL validation
โ โ โโโ dmnHelpers.js # DMN-specific utilities
โ โ โโโ validators.js # Form validation
โ โ โโโ triplydbHelper.js # TriplyDB API integration, buildGraphIRI
โ โ โโโ ronlHelper.js # RONL vocabulary SPARQL queries
โ โ โโโ iknowParser.js # iKnow XML parser
โ โ โโโ problem.js # Reads the backend's RFC 9457 error detail
โ โ โโโ buildInfo.js # Build SHA and run number, injected at build time
โ โ
โ โโโ data/
โ โ โโโ changelog.json # Powers ChangelogTab
โ โ โโโ roadmap.json # Planned features for ChangelogTab
โ โ โโโ cprmv-example.json # Conformant 0.4.1 example for CPRMV "Load Example"
โ โ
โ โโโ config/
โ โโโ vocabularies.config.js # RDF vocabulary mappings for parser
โ โโโ iknow-mappings/ # iKnow default field mapping templates
โ
โโโ e2e/ # Playwright journeys and their global setup
โโโ e2e-fixtures/ # Journey fixtures, with a provenance manifest
โโโ examples/ # Reference TTL/DMN exports; round-trip test fixtures
โ โโโ organizations/ # Per-organisation examples and test cases
โ
โโโ scripts/
โ โโโ check-deps.sh # npm run deps:check โ install vs lockfile; warns on npm < 11.10
โ โโโ write-deps-marker.mjs # postinstall โ snapshots the lockfile deps:check compares with
โ โโโ check-supply-chain.mjs # npm run check-supply-chain โ pin truth and register agreement
โ โโโ audit-tree.mjs # Daily dependency audit, grouped by advisory
โ โโโ write-sbom.mjs # npm run sbom โ CycloneDX SBOM into docs/sbom/
โ โโโ check-mirror.sh # npm run check-mirror โ GitLab mirror vs GitHub (never pushes)
โ โโโ check-previews.sh # npm run check-previews โ orphaned preview environments (never deletes)
โ
โโโ docs/
โ โโโ sbom/ # <name>-<version>.cdx.json, one per release
โ
โโโ .github/
โโโ zizmor.yml # zizmor configuration
โโโ workflows/
โโโ azure-static-web-apps-orange-beach-0574c2a03.yml # Deploy ACC
โโโ azure-static-web-apps-white-sky-02b674303.yml # Deploy PROD
โโโ close-preview-environments.yml
โโโ dependency-audit.yml
โโโ sbom.yml
โโโ semgrep.yml
โโโ zizmor.yml # Supply-chain audit
What each workflow does is on Deployment.
Key modules¶
src/hooks/useEditorState.js¶
Centralises all editor state into a single custom hook, providing:
- State slices for every tab (service, organization, legalResource, ronlAnalysis, ronlMethod, temporalRules, parameters, cprmvRules, concepts, cost, output, dmnData, vendorService, iknowMappingConfig, triplyDBConfig)
- Shared RONL vocabulary concepts (analysis/method/vendor), fetched once on mount and shared across the Legal and Vendor tabs
- A
clearAllData()action that resets the entire editor
This replaces dozens of individual useState calls that were previously spread across the main component.
src/hooks/useArrayHandlers.js¶
Provides DRY CRUD handlers for any array-based state (rules, parameters, CPRMV rules):
{
handleAdd, // Append new item with auto-incremented ID
handleUpdate, // Update item by ID with partial patch
handleRemove, // Remove item by ID
handleUpdateField,// Update a single field (convenience wrapper)
handleClear, // Clear the entire array
handleReplace // Replace the entire array
}
IDs use Math.max(...ids) + 1 โ stable under rapid additions, unlike Date.now().
src/utils/ttlGenerator.js¶
Class-based TTL generation. Each tab section has a corresponding generate method. Called by App.jsx on export and by PreviewPanel on every state change.
src/parseTTL.enhanced.js¶
Full TTL parser. Handles vocabulary detection, multi-line values, namespace resolution, date parsing, array extraction (keywords), and DMN block capture and preservation. Returns a data structure matching the editor state shape for direct use in useEditorState.
src/config/vocabularies.config.js¶
Configuration-driven vocabulary management. Defines namespace-to-prefix mappings, RDF type-to-editor-section mappings, and property aliases, plus the detectEntityType() helper. See Vocabulary Configuration for how to extend it.
RPP tab mapping¶
| Layer | Tab | Badge label | Colour |
|---|---|---|---|
| Rules | RulesTab | RPP Layer: Rules | Blue |
| Policy | CPRMVTab | RPP Layer: Policy | Purple |
| Parameters | ParametersTab | RPP Layer: Parameters | Green |
State flow¶
Import:
Export / Live preview: