---
title: "Deploy pREST"
description: "Instant REST and MCP API for Postgres, with JWT auth enforced"
category: "Other"
url: https://railway.com/deploy/prest
---

# Deploy pREST

Instant REST and MCP API for Postgres, with JWT auth enforced

**[Deploy pREST on Railway](https://railway.com/template/prest)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/prest/manifest.json

- **Creator:** My Projects
- **Category:** Other

## Template content

### pREST https://raw.githubusercontent.com/prest/prestd.com/master/assets/images/logo-blue-80x80.png

- **Image:** prest/prest:v2
- **Start command:** `/bin/prestd`
- **Health check:** /_health
- **Public domain:** Yes

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

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

## Documentation

# Deploy and Host pREST on Railway

[pREST](https://github.com/prest/prest) (prestd) serves an instant REST API and an MCP endpoint on top of PostgreSQL: CRUD on every table, filtering, joins, custom SQL routes and a built-in Studio UI, without writing a backend.

## About Hosting pREST

This template runs pREST against a private Railway Postgres database with authentication forced on.

- pREST service (prest/prest:v2) on port 3000 with a public domain
- Postgres service with a persistent volume, reachable only over the private network by pREST
- Generated secrets: PREST_JWT_KEY (token signing key) and PREST_ADMIN_PASSWORD (admin login)
- JWT auth enforced: every table, catalog, query and /_mcp request without a valid token gets 401; only /auth, /_health, /_ready and the static Studio assets are open
- A readable pre-deploy step creates the auth table and seeds the admin user (bcrypt hash) on first deploy

**After deploy:**

1. Open the pREST service Variables tab and copy PREST_ADMIN_PASSWORD (username: PREST_ADMIN_USER, default admin).
2. Get a token: POST https://YOUR-RAILWAY-DOMAIN/auth with JSON body {"username":"admin","password":"..."}. Tokens are valid for 6 hours.
3. Call the API with the header Authorization: Bearer TOKEN, for example GET https://YOUR-RAILWAY-DOMAIN/railway/public/your_table (database is railway, schema public).
4. Create your tables with the Postgres service Data tab or any SQL client; pREST picks them up immediately.
5. Point MCP clients at https://YOUR-RAILWAY-DOMAIN/_mcp with the same bearer token. Studio is at https://YOUR-RAILWAY-DOMAIN/_studio.
6. Changing PREST_ADMIN_PASSWORD later does not rotate the existing user; the seed runs only once. Update the password column of public.prest_users with a bcrypt hash instead.

## Common Use Cases

- Expose an existing Postgres schema as a REST API for frontends, scripts and no-code tools
- Give AI agents read access to your data through the authenticated MCP endpoint
- Prototype a backend quickly with CRUD, filters and custom SQL routes
- Run an internal data API without writing or maintaining API code

## Dependencies for pREST Hosting

- Source: https://github.com/prest/prest (MIT license)
- Image: prest/prest:v2 on Docker Hub
- No external API keys required

### Deployment Dependencies

- https://github.com/prest/prest
- https://hub.docker.com/r/prest/prest
- https://docs.prestd.com

### Implementation Details

- pREST reads DATABASE_URL from the Railway Postgres service over the private network.
- pREST silently turns auth off when the JWT key is missing or shorter than 32 characters, so the template always generates a 64-character key.
- The admin user is seeded with prestd migrate up from the PREST_SEED_SQL variable, using pgcrypto bcrypt; the migration is recorded in public.schema_migrations, so redeploys do not overwrite it.
- Authenticated users can read and write all tables (pREST public mode). Enable pREST ACLs (PREST_ACCESS_RESTRICT plus table rules in a config file) if you need per-table permissions.

## Why Deploy pREST 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 pREST 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

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/prest
