Thanks for considering contributing. Barn is the template engine for the grainulation ecosystem -- it turns structured data into polished HTML artifacts.
git clone https://github.com/grainulation/barn.git
cd barn
node bin/barn.js --helpNo npm install needed -- barn has zero dependencies.
Open an issue with:
- What you expected
- What happened instead
- Your Node version (
node --version) - Steps to reproduce
Open an issue describing the use case, not just the solution. "I need X because Y" is more useful than "add X."
- Fork the repo
- Create a branch (
git checkout -b fix/description) - Make your changes
- Run the tests:
node test/basic.test.js - Commit with a clear message
- Open a PR
Templates live in templates/. Each template is a pair: an HTML file and a JSON schema file. To add one:
- Create
templates/your-template.htmlandtemplates/your-template.json - Follow the pattern of existing templates (use
template.schema.jsonas the base schema) - Ensure the HTML is self-contained (inline CSS/JS, no external dependencies)
- Add it to the README templates table
bin/barn.js CLI entrypoint -- dispatches subcommands
lib/index.js Core library -- template resolution and rendering
lib/server.js Local preview server (SSE, zero deps)
templates/ HTML + JSON schema pairs for each artifact type
public/ Web UI -- two-column template nav + preview
site/ Public website (barn.grainulation.com)
tools/ Utility scripts
test/ Node built-in test runner tests
The key architectural principle: templates are self-contained HTML with inline CSS/JS. No external dependencies, no build step, no CDN links.
- Zero dependencies. If you need something, write it or use Node built-ins.
- No transpilation. Ship what you write.
- ESM imports (
import/export). Node 20+ required. - Keep functions small. If a function needs a scroll, split it.
- No emojis in code, CLI output, or templates.
node test/basic.test.jsTests use Node's built-in test runner. No test framework dependencies.
Follow the existing pattern:
barn: <what changed>
Examples:
barn: add postmortem template
barn: fix server SSE reconnection
barn: update schema validation for nested fields
MIT. See LICENSE for details.