{"id":18518190,"url":"https://github.com/marcuwynu23/js-templater-nodejs","last_synced_at":"2026-04-30T09:32:19.976Z","repository":{"id":57286391,"uuid":"438102451","full_name":"marcuwynu23/JS-templater-nodejs","owner":"marcuwynu23","description":"NodeJS Library/Tool to use pure DOM javascript render with view Engine","archived":false,"fork":false,"pushed_at":"2025-12-15T03:07:17.000Z","size":96,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-17T20:49:01.620Z","etag":null,"topics":["dom","html","html5","javascript","nodejs","pure-javascript","reactjs-alternative","template-engine","view-engine"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcuwynu23.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-14T03:18:49.000Z","updated_at":"2025-12-15T03:07:08.000Z","dependencies_parsed_at":"2022-08-25T11:20:08.759Z","dependency_job_id":null,"html_url":"https://github.com/marcuwynu23/JS-templater-nodejs","commit_stats":null,"previous_names":["marcuwynu23/jstemplater-nodejs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/marcuwynu23/JS-templater-nodejs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcuwynu23%2FJS-templater-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcuwynu23%2FJS-templater-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcuwynu23%2FJS-templater-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcuwynu23%2FJS-templater-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcuwynu23","download_url":"https://codeload.github.com/marcuwynu23/JS-templater-nodejs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcuwynu23%2FJS-templater-nodejs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32460781,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dom","html","html5","javascript","nodejs","pure-javascript","reactjs-alternative","template-engine","view-engine"],"created_at":"2024-11-06T17:12:26.123Z","updated_at":"2026-04-30T09:32:19.971Z","avatar_url":"https://github.com/marcuwynu23.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JS-templater\n\nA Node.js library/tool to use pure DOM JavaScript rendering with a view engine. JS-templater allows you to build modern web applications by rendering JavaScript templates on the server side while maintaining a clean separation between your Node.js backend and JavaScript frontend.\n\n## Features\n\n- 🚀 **Simple Integration**: Easy to integrate with Express.js and other Node.js web frameworks\n- 🎨 **Pure JavaScript**: Use vanilla JavaScript for rendering, no framework dependencies\n- 📦 **Template Engine**: Server-side template generation with context data passing\n- 🔧 **Flexible**: Pass JSON context data to your JavaScript templates\n- 📝 **Clean HTML**: Generates clean, semantic HTML structure\n\n## Installation\n\n```bash\nnpm install js-templater\n```\n\nOr install from source:\n\n```bash\ngit clone https://github.com/marcuwynu23/JSTemplater-NodeJS.git\ncd JSTemplater-NodeJS\nnpm install\n```\n\n## Quick Start\n\n### 1. Basic Express.js Setup\n\n```javascript\nconst express = require('express');\nconst JSTemplate = require('js-templater');\n\nconst app = express();\n\n// Initialize JSTemplate with your static files root\nconst jsTemplate = new JSTemplate('/static/');\n\n// Serve static files\napp.use('/static', express.static('public'));\n\napp.get('/', (req, res) =\u003e {\n  // Render a JavaScript template\n  const html = jsTemplate.render('index', {\n    title: 'Welcome',\n    user: 'John'\n  });\n  res.send(html);\n});\n\napp.listen(3000, () =\u003e {\n  console.log('Server running on port 3000');\n});\n```\n\n### 2. Project Structure\n\nYour Node.js application should have the following structure:\n\n```\nyour-app/\n├── server.js\n└── public/\n    ├── css/\n    │   └── style.css\n    └── js/\n        └── index.js\n```\n\n### 3. JavaScript Template Example\n\nCreate `public/js/index.js`:\n\n```javascript\n// Get the root element\nconst root = document.getElementById(\"root\");\n\n// Parse context data if provided\nlet context = {};\nif (root.dataset.content) {\n  context = JSON.parse(root.dataset.content);\n}\n\n// Render your application\nroot.innerHTML = `\n    \u003ch1\u003e${context.title || \"Hello World\"}\u003c/h1\u003e\n    \u003cp\u003eWelcome, ${context.user || \"Guest\"}!\u003c/p\u003e\n`;\n```\n\n## API Reference\n\n### `JSTemplate(staticRoot)`\n\nInitialize the JSTemplate engine.\n\n**Parameters:**\n\n- `staticRoot` (string): The root path for static files (e.g., '/static/')\n\n**Example:**\n\n```javascript\nconst jsTemplate = new JSTemplate('/static/');\n```\n\n### `render(scriptName, context)`\n\nRender a JavaScript template.\n\n**Parameters:**\n\n- `scriptName` (string): Name of the JavaScript file (without .js extension)\n- `context` (object, optional): Context data to pass to the template as JSON\n\n**Returns:**\n\n- `string`: Complete HTML document with embedded script\n\n**Example:**\n\n```javascript\nconst html = jsTemplate.render('dashboard', {\n  users: ['Alice', 'Bob']\n});\n```\n\n## Examples\n\nSee the [examples](./examples/) directory for more detailed usage examples.\n\n## Testing\n\nRun tests using Jest:\n\n```bash\nnpm test\n```\n\nOr run tests in watch mode:\n\n```bash\nnpm run test:watch\n```\n\n## Requirements\n\n- Node.js \u003e= 10.0.0\n- Express.js (for web framework integration) or any Node.js HTTP server\n\n## License\n\nSee [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## Author\n\nMark Wayne B. Menorca\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcuwynu23%2Fjs-templater-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcuwynu23%2Fjs-templater-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcuwynu23%2Fjs-templater-nodejs/lists"}