Standalone Node app for viewing the KeepRight specification.
This app reads the latest public spec files from Deep-Keep-Group/keepright-spec, caches them briefly on the backend, and displays them as source code.
The spec.json file is the single source of truth, the other files are generated from that for convenience.
Different formats have slightly different previews, the .json and .xml are supposed to be for code to read, we've added a 'Colourful view' to make it slightly easier on the eye to us to read.
The .txt and .md versions are the most "human readable" versions of the spec.
The two .html versions, one is just another "human readable" version of the spec, once again making it easier for us to share. The FORM html version is a rending of what the spec could look like as a form, although the javascript that toggles elements of the form on and off are disabled.
Install dependencies:
npm installRun the viewer at the root path:
PORT=3001 npm run devOpen http://localhost:3001/.
Pages load standalone.css from this app first, then /css/main.css from the main site when it is available (for example when proxied through keepright.info). Running the viewer alone still gives readable layout without the main app.
Run the viewer under the same path used by keepright.info:
PORT=3001 BASE_PATH=/spec-viewer npm run devOpen http://localhost:3001/spec-viewer.
The landing page links to:
spec.jsoni18n/en-GB/spec_form.htmli18n/en-GB/spec.htmli18n/en-GB/spec.mdi18n/en-GB/spec.txti18n/en-GB/spec.xml
When we start doing i18n properly, we'll make this selectable.
By default the viewer fetches raw files from:
https://raw.githubusercontent.com/Deep-Keep-Group/keepright-spec/main/
Environment variables:
| Variable | Default | Notes |
|---|---|---|
SPEC_REPO_OWNER |
Deep-Keep-Group |
GitHub owner/org |
SPEC_REPO_NAME |
keepright-spec |
GitHub repo |
SPEC_REPO_REF |
main |
Branch, tag, or commit SHA |
SPEC_CACHE_TTL_SECONDS |
300 |
In-memory cache freshness |
The cache is intentionally small and boring: fresh cached content is served until the TTL expires; after that the next request refreshes from GitHub. If GitHub is unavailable and stale content exists, the viewer serves the stale copy with a warning.