---
title: "Deploy Mike Legal AI"
description: "Open-source legal AI for document review and drafting, fully self-hosted"
category: "AI/ML"
url: https://railway.com/deploy/mike-legal-ai
---

# Deploy Mike Legal AI

Open-source legal AI for document review and drafting, fully self-hosted

**[Deploy Mike Legal AI on Railway](https://railway.com/template/mike-legal-ai)**

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

- **Creator:** Youssef Siam
- **Category:** AI/ML

## Template content

### backend

- **Image:** ghcr.io/youssefsiam38/mike-railway-backend:1.0.0
- **Health check:** /health

### redis

- **Image:** valkey/valkey:8.1.10-alpine
- **Start command:** `sh -c 'exec valkey-server --requirepass "$REDIS_PASSWORD" --appendonly yes --bind :: 0.0.0.0'`

### auth

- **Image:** supabase/gotrue:v2.196.0

### storage

- **Image:** ghcr.io/youssefsiam38/mike-railway-storage:1.0.0
- **Public domain:** Yes

### frontend

- **Image:** ghcr.io/youssefsiam38/mike-railway-frontend:1.0.0
- **Health check:** /login
- **Public domain:** Yes

### db

- **Image:** ghcr.io/youssefsiam38/mike-railway-db:1.0.0

### kong

- **Image:** ghcr.io/youssefsiam38/mike-railway-kong:1.0.0

### rest

- **Image:** postgrest/postgrest:v14.17

## Documentation

# Deploy and Host Mike on Railway

Mike (MikeOSS) is an open-source legal AI platform. Lawyers chat with contracts and filings, review
documents and apply suggested edits, run drafting and tabular-review workflows across many documents,
verify citations and research US case law, and organise matters into projects, folders and a shared
library. It works with Anthropic, OpenAI, Gemini, routers or a local Ollama model. This is a
community-maintained template; it is not affiliated with the Mike project.

## About Hosting Mike

Mike is a Next.js web app and an Express API on Supabase Auth and Postgres, with S3-compatible storage for
documents, Redis for its job queues and LibreOffice for document conversion. Upstream's Docker Compose
stack runs all of it on one machine with demo credentials and open registration.

This template runs the same stack on Railway, in one project, eight services with every secret generated:
a self-hosted Supabase (Postgres, Auth, PostgREST and its gateway), RustFS object storage, Valkey, and
Mike's API and web app, built from a pinned upstream commit. No Supabase account and no external bucket.

The first start does upstream's one-shot steps for you: it builds the database from upstream's schema (or
applies only the new migrations on an existing install), creates your owner account from the e-mail you
enter, creates the storage bucket with an upload policy for your web app's origin, imports Mike's workflow
catalogue, and only then starts the API. Signup is closed by default and enforced in the database: only
the owner, the addresses or domains you list, and colleagues invited to your organisations get accounts.

## Why Deploy Mike 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 Mike 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.

Concretely, this template keeps the database, authentication, API and queues on Railway's private network,
exposes only the web app and a signed-URL storage endpoint over HTTPS, runs Mike in production mode with
secure session cookies, and attaches volumes to the database, the document store and the queue.

## Common Use Cases

- A firm's or legal team's private AI assistant for contract review, drafting and research.
- Tabular review: extract the same clauses and terms across a batch of agreements.
- Reusable legal workflows (NDA, DPA and MSA review and drafting) shared across a team.
- Keep privileged documents and chats in storage and a database you control.

## Dependencies for Mike Hosting

- A model provider key (Anthropic, OpenAI, Gemini, OpenRouter or Vercel AI Gateway), set on the backend or
  added by each user in the app, or an Ollama server the backend can reach.
- Optional: a CourtListener API token for higher-rate US case-law lookups.
- Optional: SMTP for account e-mails, and a Google OAuth client for Google sign-in.

### Deployment Dependencies

- Mike: https://github.com/open-legal-products/mike (AGPL-3.0)
- Mike workflows: https://github.com/Open-Legal-Products/mike-workflows (MIT)
- Supabase self-hosting stack: https://github.com/supabase/supabase/tree/master/docker (Apache-2.0)
- RustFS: https://github.com/rustfs/rustfs (Apache-2.0)
- Template repository, images and tests: https://github.com/youssefsiam38/mike-railway

### Implementation Details

The API and web app are built from a pinned upstream commit exactly as upstream's Dockerfiles build them,
with no code changes; the API image adds a start-up that runs upstream's one-shot steps. Thin wrappers
adapt Supabase and RustFS to Railway: init scripts baked in, API keys minted from the shared JWT secret,
the Vault key kept on the database volume, and RustFS's data directory prepared on its volume with the
console off. Every service refuses to start on missing, short or published example secrets. The bundle is
tested as a whole in CI, including sign-in, an organisation invitation, a chat against a stand-in model,
and a document uploaded through a signed URL and converted to PDF, on fresh and reused volumes.

The deploy form asks for one value, `OWNER_EMAIL`. After deploying, copy `OWNER_PASSWORD` from the backend
service's variables, sign in on the web app's domain, and add a model key.


## 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/mike-legal-ai
