Getting Started

This guide will walk you through setting up .prompt and writing your first prompt file.

Prerequisites

  • Docker (for running the container)
  • or Elixir 1.17+ (for using the library directly)

Quick Start with Docker

The fastest way to get started is using our Docker container:

docker run -v ./prompts:/app/priv/prompts \
  -p 4040:4040 -p 4041:4041 \
  dotprompt/server

What you get:

  • Viewer at localhost:4040 — Select params, see compiled output in real time
  • HTTP API at localhost:4041 — Compile prompts from your application
  • Live reload — File watcher recompiles on every save
  • MCP server — Connect your LLM coding tools

Your First .prompt File

Create a file called hello.prompt in your prompts folder:

init do
  @version: 1.0
  @major: 1

  def:
    mode: greeting
    description: A friendly greeting.

  params:
    @name: str -> The user's name

end init

Hello, @name! Welcome to our app.

Compile and Render

Call the API to compile the prompt:

curl -X POST http://localhost:4041/api/render \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "hello",
    "runtime": { "name": "World" }
  }'

Response:

{
  "prompt": "Hello, World! Welcome to our app.",
  "response_contract": {
    "type": "object",
    "properties": {}
  }
}

Next Steps