---
title: "Deploy selfreview"
description: "Self-hosted AI code reviewer for GitHub PRs, using cheap open models"
category: "AI/ML"
url: https://railway.com/deploy/selfreview
---

# Deploy selfreview

Self-hosted AI code reviewer for GitHub PRs, using cheap open models

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

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

- **Creator:** jayssj11's Projects
- **Category:** AI/ML

## Template content

### cron

- **Source:** https://github.com/hackertron/selfreview

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

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

### worker

- **Source:** https://github.com/hackertron/selfreview

### api

- **Source:** https://github.com/hackertron/selfreview
- **Health check:** /health
- **Public domain:** Yes

## Documentation

# Deploy and Host Selfreview on Railway

Selfreview is a self-hosted AI code reviewer for GitHub. Open a pull request and it posts line-level comments on real bugs (security holes, broken logic, async mistakes, money math), each saying what breaks and how to fix it. By default it uses cheap open models through OpenRouter, so a review typically costs $0.002–0.007.

## About Hosting Selfreview

This template deploys one Docker image as three services, plus Postgres:

- **api** receives GitHub webhooks and serves the setup page and the dashboard. It has a public domain and a healthcheck on `/health`.
- **worker** reviews pull requests. When it's redeployed, it gets 120 seconds to finish the review it's working on.
- **cron** runs every 10 minutes. It resends webhooks GitHub failed to deliver and tracks which comments were acted on.
- **Postgres** is both the job queue and the database. It stores metadata only, never code.

Each service takes its role from its service name. `ADMIN_PASSWORD` and `ENCRYPTION_KEY` are generated for you, and the only value you provide is an OpenRouter API key.

After deploying:

1. Open the api service's URL and log in with `ADMIN_PASSWORD` from the api's Variables tab.
2. Click **Create GitHub App** and choose your personal account or an organization. GitHub creates the app with every setting filled in.
3. Install the app on the repositories you want reviewed, then open a pull request.

The project costs about $3 a month while idle.

## Common Use Cases

- Review every pull request in a small team without paying per seat.
- Keep your code on your own infrastructure, sent only to the model provider you choose, or to your own vLLM or Ollama server.
- Cap AI review spending with a per-review limit and a monthly budget.
- Try different models on your own PRs: pick a model per repo in `.selfreview.yml`, and see the cost and how often comments were acted on in the dashboard.

## Dependencies for Selfreview Hosting

- An OpenRouter API key, or an Anthropic, OpenAI or OpenAI-compatible key set on the worker
- A GitHub account or organization to create the GitHub App on

### Deployment Dependencies

- Source code: https://github.com/hackertron/selfreview
- Architecture: https://github.com/hackertron/selfreview/blob/main/docs/ARCHITECTURE.md
- OpenRouter API keys: https://openrouter.ai/keys
- Example review: https://github.com/selfreviewhq/demo/pull/2

## Why Deploy Selfreview on Railway?

Selfreview needs a public webhook endpoint, a background worker that can finish long jobs during a redeploy, a scheduled job and a database. On Railway these are four services in one project, created from one template, with private networking between them and generated secrets. When your team grows, add worker replicas.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [stella](https://railway.com/deploy/stella) — Self-host stella with web, API, Postgres, Redis, and object storage.
- [Hermes Agent | OpenClaw Alternative with Dashboard](https://railway.com/deploy/hermes-agent-or-openclaw-alternative-wit) — Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

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