---
title: "Deploy apap-sample"
description: "Accord Project Agreement Protocol (APAP) & MCP Server"
category: "Starters"
url: https://railway.com/deploy/apap-sample
---

# Deploy apap-sample

Accord Project Agreement Protocol (APAP) & MCP Server

**[Deploy apap-sample on Railway](https://railway.com/template/apap-sample)**

- **Creator:** Matt Roberts's Projects
- **Category:** Starters
- **Total deploys:** 6

## Template content

### apap

- **Source:** https://github.com/accordproject/apap
- **Start command:** `cd dist && npm start`
- **Public domain:** Yes

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

## Documentation

# Deploy and Host the Accord Project APAP Reference Server on Railway

The [Accord Project Agreement Protocol (APAP)](https://docs.accordproject.org/docs/ref-apap) is an open standard that defines how agreement tools — including AI agents — communicate with a smart contract template server over REST and [MCP (Model Context Protocol)](https://modelcontextprotocol.io). This deployment runs the official reference implementation: a ready-to-use server for template management, document generation, and format conversion.

## About Hosting the APAP Reference Server

The APAP Reference Implementation is a Node.js/Express server backed by Postgres. It exposes the full [APAP REST API](https://docs.accordproject.org/docs/ref-apap) for managing contract templates and agreements, and an MCP interface that lets AI assistants and LLM-powered tools interact with agreements directly using natural language. This Railway template provisions the server and a managed Postgres instance, runs schema migrations automatically on each deploy, and exposes the API on a public Railway domain. No additional infrastructure setup is required.

## Common Use Cases

- Connect AI assistants and LLM agents to contract template workflows via the built-in MCP server
- Rapidly prototype agreement automation by deploying a compliant APAP server without writing infrastructure code
- Integrate document generation and format conversion (HTML, PDF) into agreement tooling via the standardised REST API and the [Accord Project](https://www.accordproject.org) open-source ecosystem

## Dependencies for APAP Reference Server Hosting

- Node.js ≥ 20
- PostgreSQL 18

### Deployment Dependencies

- [Accord Project APAP on GitHub](https://github.com/accordproject/apap)
- [APAP API Documentation](https://docs.accordproject.org/docs/ref-apap)
- [Accord Project](https://www.accordproject.org)
- [Model Context Protocol](https://modelcontextprotocol.io)

### Implementation Details

The REST API exposes the following resources:

- `GET /capabilities` — advertises supported protocol features
- `/templates` — CRUD for contract templates (`.cta` archives)
- `/agreements` — CRUD for agreements, plus `POST /agreements/:id/trigger` and `POST /agreements/:id/convert/:format` for document generation and format conversion (HTML, PDF, etc.)

The server also exposes two MCP transports on the same port as the REST API:
- `GET /sse` — legacy SSE transport (for Claude custom integrations)
- `POST /mcp` — Streamable HTTP transport (session-stateful)

Schema migrations run automatically via `npm run db:migrateprod` before each deploy. The `HOST` environment variable must be set to `0.0.0.0` for Railway's networking — this is pre-configured in the template.

## Why Deploy the APAP Reference Server on Railway?


Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying the APAP Reference Server on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


## Similar templates

- [open-excalidraw](https://railway.com/deploy/open-excalidraw) — Self-hostable collaborative drawing built on Excalidraw
- [caring-vibrancy](https://railway.com/deploy/caring-vibrancy) — Deploy and Host caring-vibrancy with Railway
- [Appsmith](https://railway.com/deploy/appsmith-1) — Low-code platform for internal tools, dashboards, and admin panels.

Open this page in a browser: https://railway.com/deploy/apap-sample
