
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
@gboutte/nestjs-hbs
Advanced tools
This package provide a service to render handlebars templates for nestjs.
npm install @gboutte/nestjs-hbs
@Module({
imports: [
HandlebarsModule.forRoot({
templateDirectory: 'templates',
partialDirectory: 'templates/partials',
compileOptions: {},
templateOptions: {},
})
],
controllers: [],
providers: [],
})
export class AppModule {}
| Description | |
|---|---|
templateDirectory | This will define the folder where the templates files are located |
compileOptions | The templates options can be found on: https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access |
templateOptions | The compile options can be found on https://handlebarsjs.com/api-reference/compilation.html#handlebars-compile-template-options |
partialDirectory | This will load all files as partials. If you have a file named myPartial.hbs, a partial named myPartial will be added. |
helpers | An array of helpers to add in handlebars, each helpers has a property name and fn |
You can use the HandlebarsService, there is currently two methods
| Description | Parameters | |
|---|---|---|
| renderFile | This will render a handlebars template (located in the template folder previously defined), and will return the rendered string. | - file: the template file to render - parameters: an array of parameters that will be used inside the template |
| render | This will render a template string using handlebars | - html: the template - parameters: an array of parameters that will be used inside the template string |
| Here is an example |
@Controller()
export class AppController {
constructor(private readonly hbsService: HandlebarsService) {}
@Get()
async getTest() {
return this.hbsService.renderFile('hello.hbs', { name: 'John Doe'});
}
@Get('template-string')
async getTest() {
return this.hbsService.render('<h1>Hello {{name}}</h1>', { name: 'John Doe'});
}
}
FAQs
This package provide a service to render handlebars templates for nestjs.
We found that @gboutte/nestjs-hbs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.