Document Generation: Overview¶
Document Generation v2 moves away from Word (.doc) templates and uses HTML files with embedded CSS. Templates are rendered by the Java backend using the Handlebars/Mustache engine and converted to PDF. Configuration lives in the client config repository (in Git), enabling code reviews and consistent styling across clients.
v1 vs v2¶
| Version | Description |
|---|---|
| v1 (legacy) | Word (.doc) templates processed by an AWS Lambda. Still supported but deprecated. Not recommended for new implementations. |
| v2 (recommended) | HTML + CSS templates rendered in the Java backend. Configured in document-template/ directory. Supports partial templates, data mapping from risk/policy, and Handlebars helpers. |
Note
The version of document generation is controlled at the business class workflow level. This allows a phased rollout by LOB — you can run v1 for some lines of business and v2 for others simultaneously during migration.
Repository structure¶
Document generation spans several directories:
| Directory | Purpose |
|---|---|
document-template/config/{bc}/{placing-type}.json |
Metadata config: links operation names to template HTML files, with date ranges and criteria |
document-template/files/{bc}/*.html |
The actual HTML template files |
document-template/files/common/*.html |
Shared partial templates (headers, footers, insurer info) |
document-clause/config/{bc}/{placing-type}.json |
Defines which clause file applies for a business class and placing type |
document-clause/files/{bc}/clauses.json |
Individual clause/subjectivity definitions |
screen-meta-data/config/{bc}/ |
Links operations to data capture screen layout files |
screen-meta-data/files/{bc}/ |
Screen meta data layout files for the data capture form |
business-constants/action_group.json |
Defines action group codes (rate, broker_response) |
How it works end to end¶
- The underwriter completes the
document_creationrisk action - They select clauses and subjectivities from the clause library
- They fill in the data capture form (for any data not already on the risk record)
- They preview the rendered document
- They confirm generation — the backend renders the HTML template with Handlebars, converts it to PDF, and stores it in S3
- The document appears in the Documents tab on the risk record
Delivery checklist¶
For a new document generation implementation:
- Define action groups in
business-constants/action_group.json - Add
document_creationandbr_document_creationrisk actions with correct prerequisites andadditionalProperties - Create the HTML template structure (layout, CSS, headers, footers)
- Add data mappings to the template (
{{risk.*}},{{policyGroup.*}}, clause loops) - Create screen meta data config for any data capture not already in the risk object
- Configure clause library if required
- Set
documentGenerationConfig.clientPartialTemplatesLookup: trueinbe_config.json(S3 business config) if using partial templates - Deploy and test: preview document, generate PDF, verify data mappings
Next steps¶
- Action Approaches — choose between the two-action and three-action patterns
- Template Config — link operations to HTML files
- Authoring HTML Templates — write and structure your templates
- Handlebars Reference — all available helpers
- Clause Library — manage clauses and subjectivities