# dotprompt

> Dotprompt: Executable GenAI Prompt Templates

Latest version **1.1.3** (published 2026-11-18) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install dotprompt
pnpm add dotprompt
yarn add dotprompt
bun add dotprompt
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 1.1.3 |
| Published | 2026-11-18 |
| First published | 2024-07-16 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 659.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 577 |
| Author | Google LLC |
| Maintainers | pavelgj, google-wombot |
| Keywords | genai, prompting, llms, templating, handlebars |

## Links

- npm: https://www.npmjs.com/package/dotprompt
- Repository: https://github.com/google/dotprompt
- Homepage: https://github.com/google/dotprompt#readme
- Issues: https://github.com/google/dotprompt/issues
- npm.io page: https://npm.io/package/dotprompt

## Dependencies (2)

- [yaml](https://npm.io/package/yaml.md) ^2.8.2
- [handlebars](https://npm.io/package/handlebars.md) ^4.7.8

## Recent versions

- 1.1.3 (latest) — 2026-11-18
- 1.1.2 — 2025-09-15
- 1.1.1 — 2025-03-31
- 1.1.0 — 2025-03-31
- 1.0.1 — 2025-02-05
- 1.0.0-dev.3 — 2025-01-25
- 1.0.0-dev.2 — 2025-01-24
- 1.0.0-dev.1 — 2025-01-04
- 0.0.2 — 2025-01-04
- 0.0.1 — 2024-07-16

## README

# TypeScript Dotprompt (Reference Implementation)

Executable GenAI prompt templates in TypeScript/JavaScript.

## Overview

This is the reference implementation of the Dotprompt format -- a
language-neutral executable prompt template format for Generative AI. All
other language runtimes (Python, Go, Rust, Dart, Java) are tested against
the shared [spec suite](../spec/) to ensure cross-language compatibility.

## Features

- YAML frontmatter for prompt metadata (model, config, input/output schemas)
- Handlebars templating with 7 built-in helpers (role, media, history,
  section, json, ifEquals, unlessEquals)
- Picoschema: compact schema notation with JSON Schema conversion
- Multi-message prompts with role markers
- Named partials with recursive resolution and cycle detection
- PromptStore interface with DirStore (file system) implementation
- Custom loaders and schema/tool resolvers
- Tools/functions and safety settings via config passthrough

## Installation

```bash
npm install dotprompt
# or
pnpm add dotprompt
```

## Usage

```typescript
import { Dotprompt } from 'dotprompt';

const dp = new Dotprompt();
const source = `---
model: gemini-2.0-flash
input:
  schema:
    name: string
---
Hello, {{name}}!`;

const rendered = await dp.render(source, { input: { name: 'World' } });
```

## Building

```bash
pnpm install
pnpm run build
```

## Testing

```bash
pnpm test
```

## Published Package

- **npm**: [dotprompt](https://www.npmjs.com/package/dotprompt)

## License

Apache-2.0

---
_Source: https://npm.io/package/dotprompt · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
