
Product
Microsoft Teams Notifications Are Now Available in Socket
Socket can now send alerts and supply chain attack notifications to Microsoft Teams, with filters that route the right updates to each channel.
@memberjunction/templates
Advanced tools
MemberJunction Templating Engine and Utilities - Used for any application that requires templating utility functionality. NOTE: this package does use Angular Universal for compilation but is not marked with the usual ng prefix because it is a server-side
Server-side template rendering engine for MemberJunction, built on Nunjucks. Extends TemplateEngineBase with rendering capabilities, custom filters, and MJ-specific extensions for AI prompt integration and recursive template embedding.
graph TD
subgraph "@memberjunction/templates"
A[TemplateEngineServer] --> B[Nunjucks Environment]
A --> C[Template Cache]
A --> D[TemplateEntityLoader]
B --> E[Custom Filters]
B --> F[Extensions]
F --> G[AIPrompt Extension]
F --> H[TemplateEmbed Extension]
end
subgraph "Base Layer"
I["TemplateEngineBase<br/>(from base-types)"]
end
A -->|extends| I
subgraph "Rendering"
J[Template Entity] --> K[Validation]
K --> L[Merge Defaults]
L --> M[Nunjucks Render]
M --> N[TemplateRenderResult]
end
style A fill:#2d6a9f,stroke:#1a4971,color:#fff
style B fill:#2d8659,stroke:#1a5c3a,color:#fff
style C fill:#7c5295,stroke:#563a6b,color:#fff
style G fill:#b8762f,stroke:#8a5722,color:#fff
style H fill:#b8762f,stroke:#8a5722,color:#fff
style I fill:#2d6a9f,stroke:#1a4971,color:#fff
style N fill:#2d8659,stroke:#1a5c3a,color:#fff
This package is the server-side rendering engine for MemberJunction templates. It is NOT used within Angular applications despite using Angular Universal internally for compilation.
Key capabilities:
json, jsoninline, and jsonparse filters for JSON manipulationTemplateExtensionBase for custom Nunjucks tagsnpm install @memberjunction/templates
import { TemplateEngineServer } from '@memberjunction/templates';
const engine = TemplateEngineServer.Instance;
await engine.Config(false, contextUser);
// Find and render a template
const template = engine.FindTemplate('Welcome Email');
const content = template.Content[0]; // First content variant
const result = await engine.RenderTemplate(template, content, {
userName: 'John Doe',
companyName: 'Acme Corp'
});
if (result.Success) {
console.log(result.Output); // Rendered HTML/text
} else {
console.error(result.Message); // Validation or rendering error
}
For ad-hoc templates not stored in the database:
const result = await engine.RenderTemplateSimple(
'Hello {{ name }}, welcome to {{ company }}!',
{ name: 'Jane', company: 'MemberJunction' }
);
// result.Output: "Hello Jane, welcome to MemberJunction!"
The engine provides built-in filters for JSON operations:
{# Convert object to formatted JSON #}
{{ userData | json }}
{# Compact JSON output #}
{{ userData | jsoninline }}
{# Parse a JSON string back to object #}
{% set parsed = jsonString | jsonparse %}
Extensions are registered via the MJ class factory:
graph LR
A[TemplateExtensionBase] --> B[AIPrompt Extension]
A --> C[TemplateEmbed Extension]
A --> D[Custom Extensions]
style A fill:#2d6a9f,stroke:#1a4971,color:#fff
style B fill:#2d8659,stroke:#1a5c3a,color:#fff
style C fill:#2d8659,stroke:#1a5c3a,color:#fff
style D fill:#7c5295,stroke:#563a6b,color:#fff
{% aiprompt %} tags{% templateembed %} tags| Member | Type | Description |
|---|---|---|
Instance | static getter | Singleton instance |
Config() | method | Load metadata and initialize Nunjucks environment |
RenderTemplate() | method | Render a stored template with validation |
RenderTemplateSimple() | method | Render an ad-hoc template string |
AddTemplate() | method | Add a template to the Nunjucks loader |
SetupNunjucks() | method | Re-initialize the Nunjucks environment |
ClearTemplateCache() | method | Clear cached compiled templates |
TemplateRenderResult with Success, Output, and optional Message| Package | Purpose |
|---|---|
@memberjunction/templates-base-types | Base engine and result types |
@memberjunction/core | UserInfo, logging utilities |
@memberjunction/core-entities | Template entity types |
@memberjunction/global | Class factory for extensions |
@memberjunction/ai | AI integration for prompts |
@memberjunction/ai-core-plus | AI core utilities |
nunjucks | Template rendering engine |
ISC
FAQs
MemberJunction Templating Engine and Utilities - Used for any application that requires templating utility functionality. NOTE: this package does use Angular Universal for compilation but is not marked with the usual ng prefix because it is a server-side
The npm package @memberjunction/templates receives a total of 1,064 weekly downloads. As such, @memberjunction/templates popularity was classified as popular.
We found that @memberjunction/templates demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 11 open source maintainers collaborating on the project.

Product
Socket can now send alerts and supply chain attack notifications to Microsoft Teams, with filters that route the right updates to each channel.

Security News
pnpm 12 rewrites the package manager in Rust, cutting install times by up to 90% while preserving pnpm 11 workflows and lockfiles.

Security News
Socket CTO Ahmad Nassri joins AppSec leaders at Black Hat to discuss active malware, package manager risks, and software supply chain defense.