{"id":20037503,"url":"https://github.com/maurerkrisztian/template-api-tm","last_synced_at":"2025-10-07T09:10:32.957Z","repository":{"id":133941165,"uuid":"491167735","full_name":"MaurerKrisztian/template-api-tm","owner":"MaurerKrisztian","description":null,"archived":false,"fork":false,"pushed_at":"2022-05-21T20:48:09.000Z","size":826,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-12T18:52:08.680Z","etag":null,"topics":["api","emailtemplate","helper","microservice","template"],"latest_commit_sha":null,"homepage":"","language":"Handlebars","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/MaurerKrisztian.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-11T15:24:41.000Z","updated_at":"2022-05-21T15:04:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"b9ee5b53-9feb-4840-982b-ea55346dee6c","html_url":"https://github.com/MaurerKrisztian/template-api-tm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaurerKrisztian%2Ftemplate-api-tm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaurerKrisztian%2Ftemplate-api-tm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaurerKrisztian%2Ftemplate-api-tm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaurerKrisztian%2Ftemplate-api-tm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MaurerKrisztian","download_url":"https://codeload.github.com/MaurerKrisztian/template-api-tm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241467548,"owners_count":19967675,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["api","emailtemplate","helper","microservice","template"],"created_at":"2024-11-13T10:19:52.566Z","updated_at":"2025-10-07T09:10:27.934Z","avatar_url":"https://github.com/MaurerKrisztian.png","language":"Handlebars","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tempalte-api-tm\n\nTemplate microservice. Generate html (email compatible) and pdf from the given template and data.\n\n### Features:\n- fill html templates with data\n- convert html css to inline css for emails\n- pdf creation form template with data (get buffer / stream)\n- Send email with template.\n\n### Add template:\n1. In /src/templates/template create a new forlder with {templateName}\n2. Add a {templateName}.handlebars file (template)\n    1. Your html \\\u003cstyle\u003e  will be replaced with inline css because this is the only way it will work with emails\n3. Add a Validator class to {templateName} folder (extend TemplateValidatorAbstract\u003cYourTemplateData\u003e - implement the validate(data: YourTemplateData) and exampleData(): YourTemplateData)\n4. Add the validator to TemplateFactory validators[]\n5. Done. You can see the generated links in the GET /template root, You can get the template as: html string, pdf buffer, pdf stream. Experiment and test with  the playground link.\n\n\n### get template  html / pdf:\n\n{{type}} = html_string | pdf_buffer | pdf_stream\n\nPOST /template/:name?type=html_string\n```json\nbody: templateData\n```\n\n\n### mail send with template:\nPOST /mail\n```typescript\nbody: {\n    mailOptions: Omit\u003cMail.Options, 'html'\u003e;\n    template: { name: string; data: any };\n}\n```\n\n```json\n//example body\n{\n   \"mailOptions\": {\n      \"to\": \"test@gmail.com\", \n      \"subject\": \"test email\"\n   }, \n   \"template\": {\n   \"name\": \"test_template\", \n      \"data\": {\n         \"title\": \"test title\", \n         \"description\": \"This is a test description\", \n         \"color\": \"#DEB887\"\n      }\n   }\n}\n```\nDemo: https://template.mytaskplan.me/template\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaurerkrisztian%2Ftemplate-api-tm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaurerkrisztian%2Ftemplate-api-tm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaurerkrisztian%2Ftemplate-api-tm/lists"}