{"_id":"@anzaui/engine","name":"@anzaui/engine","dist-tags":{"latest":"0.5.0"},"versions":{"0.5.0":{"name":"@anzaui/engine","version":"0.5.0","description":"Ultra-fast, zero-dependency, cryptographically verified Server-Templated UI (STUI) engine for JavaScript and TypeScript","type":"module","main":"./dist/src/index.js","module":"./dist/src/index.js","types":"./dist/src/index.d.ts","homepage":"https://github.com/anzaui/ts#readme","repository":{"type":"git","url":"git+https://github.com/anzaui/ts.git"},"publishConfig":{"access":"public"},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./dist/src/index.js","default":"./dist/src/index.js"},"./adapters/*":{"types":"./dist/src/adapters/*.d.ts","import":"./dist/src/adapters/*.js","default":"./dist/src/adapters/*.js"}},"scripts":{"build":"tsc","test":"tsc && node --test dist/tests/*.test.js"},"keywords":["stui","template-engine","ssr","declarative-shadow-dom","crypto-verification","zero-dependency","web-components"],"author":{"name":"Aduki"},"license":"MIT","dependencies":{},"devDependencies":{"typescript":"^5.7.0","@types/node":"^20.0.0"},"_id":"@anzaui/engine@0.5.0","gitHead":"f878fc0afdc77d3a61861d69d5c25025e94b78cb","bugs":{"url":"https://github.com/anzaui/ts/issues"},"_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-B/My4vOym5WXR77yn53A+LQSlSA/OTEBVbNjGbKEPJjHdfpSoPEsx4dIDocc8vHyY9s8SV5EJZ/E0tVN2Bzzkg==","shasum":"2ca08824ed9897dc03f904ea7645bcdee78a5079","tarball":"https://registry.npmjs.org/@anzaui/engine/-/engine-0.5.0.tgz","fileCount":72,"unpackedSize":76506,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCaEsm0QJHBMQBZERu7ASwQG9Mv6A2xtOvfNY/fBKqRdAIgW2zDFmX3XPOGIx37IBGHoLng95bqITQl3UlQaWpzXJM="}]},"_npmUser":{"name":"fescii","email":"adukiorg@gmail.com"},"directories":{},"maintainers":[{"name":"fescii","email":"adukiorg@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/engine_0.5.0_1787864514946_0.41307480653215056"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-27T21:01:54.781Z","0.5.0":"2026-08-27T21:01:55.085Z","modified":"2026-08-27T21:01:55.354Z"},"maintainers":[{"name":"fescii","email":"adukiorg@gmail.com"}],"description":"Ultra-fast, zero-dependency, cryptographically verified Server-Templated UI (STUI) engine for JavaScript and TypeScript","homepage":"https://github.com/anzaui/ts#readme","keywords":["stui","template-engine","ssr","declarative-shadow-dom","crypto-verification","zero-dependency","web-components"],"repository":{"type":"git","url":"git+https://github.com/anzaui/ts.git"},"author":{"name":"Aduki"},"bugs":{"url":"https://github.com/anzaui/ts/issues"},"license":"MIT","readme":"# Anza (TypeScript / JavaScript Engine)\n\nA zero-dependency template and dynamic fragment rendering library for Node.js, Bun, Deno, and Edge runtimes.\n\n## What It Does\n\n1. **Full-Page Rendering**: Renders complete HTML pages with `<template shadowrootmode=\"open\">` Declarative Shadow DOM templates.\n2. **Dynamic Fragment Envelopes**: Generates signed JSON `Envelope` payloads to update specific client UI slots.\n3. **Cryptographic Signing**: Uses the Web Crypto API (`crypto.subtle`) for HMAC-SHA256 and Ed25519 payload signatures.\n4. **Streaming**: Helpers for Server-Sent Events (SSE) and WebSocket message formats.\n5. **No External Dependencies**: Built entirely on standard JavaScript and web platform APIs.\n\n## Installation\n\n```bash\nnpm install @anzaui/engine\n```\n\n## Usage\n\n### 1. Initialize Engine\n\n```typescript\nimport { Setup } from '@anzaui/engine';\n\nconst engine = await new Setup({\n  root: './templates',\n  signing: {\n    mode: 'hmac',\n    secret: 'your-secret-key-at-least-32-chars-long',\n  },\n}).run();\n```\n\n### 2. Render Full Pages\n\n```typescript\nimport { Page } from '@anzaui/engine';\n\nconst doc = await new Page('/', { title: 'Dashboard' }).run(engine);\nconsole.log(doc.html);\n```\n\n### 3. Render Signed JSON Fragments\n\n```typescript\nimport { Fragment } from '@anzaui/engine';\n\nconst envelope = await new Fragment('card.html', 'feed', {\n  title: 'New Post',\n  content: 'Article content here',\n}).run(engine);\n\n// envelope contains: slot, html, ts, and signature\nconsole.log(envelope);\n```\n\n### 4. HTTP Server Example (Web Standard fetch / Bun / Deno)\n\n```typescript\nimport { Setup, Page, Fragment, htmlResponse, jsonResponse } from '@anzaui/engine';\n\nconst engine = await new Setup({\n  root: './templates',\n  signing: { mode: 'hmac', secret: 'your-secret-key-at-least-32-chars-long' },\n}).run();\n\nexport default {\n  port: 3000,\n  async fetch(req: Request): Promise<Response> {\n    const url = new URL(req.url);\n\n    if (url.pathname === '/') {\n      const doc = await new Page('/', { title: 'Home' }).run(engine);\n      return htmlResponse(doc);\n    }\n\n    if (url.pathname === '/api/card') {\n      const env = await new Fragment('card.html', 'feed', { title: 'Card' }).run(engine);\n      return jsonResponse(env);\n    }\n\n    return new Response('Not Found', { status: 404 });\n  },\n};\n```\n\n## License\n\nMIT © 2026 aduki, Labs\n","readmeFilename":"README.md","_rev":"1-abc2220984a0953f67d88584590e5d0a"}