---
title: "Deploy Deploy CaseCite Legal AI Research"
description: "Self-hosted legal RAG for caselaw research and document review"
category: "AI/ML"
url: https://railway.com/deploy/deploy-casecite-legal-ai-research
---

# Deploy Deploy CaseCite Legal AI Research

Self-hosted legal RAG for caselaw research and document review

**[Deploy Deploy CaseCite Legal AI Research on Railway](https://railway.com/template/deploy-casecite-legal-ai-research)**

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

- **Creator:** onepush
- **Category:** AI/ML

## Template content

### CaseCite

- **Image:** ghcr.io/onepush-dev/casecite:1.3.0
- **Health check:** /health
- **Public domain:** Yes

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

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

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

## Documentation

# Deploy and Host self hosted CaseCite (Legal AI Research) on Railway

CaseCite is a source-available legal research platform you self-host.

## About Hosting CaseCite on Railway (self hosted CaseCite template)

This template runs CaseCite as three Railway services: the app, a private Postgres database, and a private Redis instance. It has no separate Caddy service; the app's public domain targets port 80, and nginx inside the app also listens on 8080.

## Why Deploy CaseCite, the source-available legal research platform on Railway (Railway Free Trial)

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 CaseCite 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.

### Railway vs Other Hosting Providers and VPS for CaseCite self hosting

| Provider | What You Get with Railway | What You Get with the Other Provider |
|----------|---------------------------|--------------------------------------|
| DigitalOcean | Template CaseCite, Postgres, Redis on a private network, with /app/data volume. | A droplet you configure: Docker, firewall, TLS, backups. |
| AWS | One project view of the three services. | Broad networking and IAM control. |
| Hetzner | Same template services, private networking, no host OS management. | Low-cost servers; you maintain everything. |

Verify backups and disk encryption.

## Common Use Cases for hosted CaseCite

- **Document-grounded questions:** Check what uploaded deposition transcripts say about a date.
- **Caselaw research:** Pulls CourtListener opinions; verify against a citator.
- **Contract review:** Compare indexed contracts by clause.
- **CourtListener tools:** Check citations for negative treatment or review a judge's opinions.

## Dependencies for CaseCite Docker hosted on Railway

CaseCite runs as three Railway services: the app (image ghcr.io/onepush-dev/casecite:1.3.0, upstream tag v1.3.0 plus a Railway startup overlay), plus private Postgres and Redis, with generated defaults.

The app mounts /app/data for the Chroma index and instance data; Postgres and Redis have private volumes. Domain port is 80; no Caddy.

DATABASE_URL on CaseCite uses postgresql+asyncpg against the Postgres private host, and REDIS_URL points at Redis database /0. Do not reference Postgres.DATABASE_URL directly for the app.

### Deployment Dependencies for Managed CaseCite Service (CaseCite app, private Postgres and Redis; /app/data app volume with Chroma and instance data plus DB volumes)

| Variable | Service | Purpose |
|---|---|---|
| CaseCite.SECRET_KEY | CaseCite | Generated 64-hex key signing JWTs and sessions; changing it signs everyone out |
| CaseCite.ENCRYPTION_SALT | CaseCite | Generated 32-hex salt for deriving keys that encrypt stored user secrets; keep stable |
| CaseCite.AUDIT_HMAC_KEY | CaseCite | Generated 64-hex key for the tamper-evident audit-log HMAC chain |
| CaseCite.REGISTRATION_BOOTSTRAP_TOKEN | CaseCite | Generated token required to register the first admin account |
| CaseCite.DATABASE_URL | CaseCite | Async SQLAlchemy URL of bundled Postgres over private network |
| CaseCite.REDIS_URL | CaseCite | Bundled Redis (noeviction) URL for rate limits, lockouts, revoked-token markers |
| CaseCite.ALLOWED_HOSTS | CaseCite | Hostnames accepted by TrustedHost; Railway domain, add custom domains comma-separated |
| CaseCite.CORS_ORIGINS | CaseCite | Browser origins allowed to call the API; Railway domain over HTTPS |
| CaseCite.FRONTEND_URL | CaseCite | Public URL used in password-reset and invitation links |
| Postgres.POSTGRES_PASSWORD | Postgres | Generated password for the postgres superuser |
| Postgres.PGPASSWORD | Postgres | Same as POSTGRES_PASSWORD, for psql-style clients |
| Postgres.PGHOST | Postgres | Private hostname of the Postgres service |
| Postgres.PGDATA | Postgres | Data directory on the Postgres volume |
| Postgres.DATABASE_URL | Postgres | Plain postgresql:// URL (private network, database postgres) |
| Redis.REDIS_PASSWORD | Redis | Generated password for the Redis default user |
| Redis.REDISPASSWORD | Redis | Same as REDIS_PASSWORD (legacy name) |
| Redis.REDISHOST | Redis | Private hostname of the Redis service |
| Redis.REDIS_URL | Redis | redis:// connection URL over the private network |

### Implementation Details for CaseCite (onepush-dev/casecite:1.3.0 builds upstream root Dockerfile at tag v1.3.0 with Railway startup overlay)

REGISTRATION_BOOTSTRAP_TOKEN protects the first admin account; the first user registered with it becomes admin. Add optional provider keys (OpenAI, Anthropic, Voyage, CourtListener, SendGrid) after deploy. Back up /app/data and Postgres.

## How does CaseCite compare against other tools

### CaseCite vs Dify (Dify Alternative)

- **Focus:** Dify is general; CaseCite targets legal research and drafting.
- **Citations:** Answers carry inline source citations and CourtListener links.
- **Where Dify wins:** Custom workflows.

### CaseCite vs RAGFlow (RAGFlow Alternative)

- **Scope:** RAGFlow is an engine you adapt; CaseCite is a finished legal workspace.
- **Data:** Documents, index and chat history stay on your servers; content goes only to configured providers.
- **Where RAGFlow wins:** Flexible engine control.

### CaseCite vs general chat assistants (General Chat Assistant Alternative)

- **Grounding:** Chat assistants answer from training data; CaseCite retrieves from your documents.
- **Limits:** CaseCite is a research aid, not a citator replacement.

### CaseCite with Docker Compose vs Railway (Docker Compose Alternative)

- **Setup:** Docker Compose on a VPS runs app, Postgres, Redis and Caddy; the Railway template runs app, Postgres and Redis, with Railway providing HTTPS.
- **Storage:** App data sits on /app/data and databases on volumes; backups are yours.
- **Where Docker Compose wins:** Direct control of disk encryption and networking.

## How to use CaseCite on Railway?

Steps after deploy:

1. Open your Railway domain and register the first account with REGISTRATION_BOOTSTRAP_TOKEN from CaseCite service variables; that account becomes admin.
2. Invite colleagues from the admin panel; self-registration is closed by default.
3. Configure chat and embedding providers before expecting AI processing, using API keys or self-hosted compatible endpoints in Settings or on the service.
4. Upload only documents your firm may process; uploads go to your embedding provider.
5. Verify every answer against the cited source; CaseCite is not a citator or legal judgment.

```
/health returning OK only confirms the app is reachable.
It does not prove the AI output is correct or current.
```

## How to self host CaseCite on other VPS Services (CaseCite self hosting guide)

### Clone the Repository

Clone upstream at tag v1.3.0.

```bash
git clone --branch v1.3.0 https://github.com/thomasunise/casecite.git
cd casecite
```

### Install Dependencies

You need Docker with the Compose plugin and openssl.

### Configure Environment Variables

Copy the example file to `.env` and generate each secret with `openssl rand -hex` (32 bytes for SECRET_KEY and AUDIT_HMAC_KEY, 16 for ENCRYPTION_SALT and REGISTRATION_BOOTSTRAP_TOKEN). Set DOMAIN, POSTGRES_PASSWORD and REDIS_PASSWORD in the production section (DOMAIN=localhost for trials). Set DISK_ENCRYPTION_ACKNOWLEDGED=true only after verifying host disk encryption; this flag does not enable encryption or prove compliance.

```bash
cp .env.example .env
openssl rand -hex 32   # SECRET_KEY
openssl rand -hex 32   # AUDIT_HMAC_KEY
openssl rand -hex 16   # ENCRYPTION_SALT
openssl rand -hex 16   # REGISTRATION_BOOTSTRAP_TOKEN
```

### Start the CaseCite Application

Start the bundled stack.

```bash
docker compose -f docker-compose.prod.yml up -d
```

## Official Pricing of CaseCite (CaseCite pricing)

CaseCite is licensed under the Elastic License 2.0 (ELv2), source-available, not OSI open source. Providers bill your own keys directly.

## CaseCite hosted vs self hosted comparison (Pricing, features, costs, and more)

CaseCite is source-available (ELv2), not OSI open source.

### Monthly cost of self hosting CaseCite on Railway

Railway bills on usage (RAM, CPU, storage).

### System Requirements for Hosting CaseCite on a VPS

Depends on corpus size and users.

## Frequently Asked Questions (FAQs)

### What license does CaseCite use?

CaseCite is licensed under the Elastic License 2.0 (ELv2): source-available, not OSI open source, not Apache-2.0. You may self-host it free for internal use and modify it, but may not offer it to third parties as a hosted or managed service without a separate license.

### Who becomes the admin?

The first account you register becomes the admin, and it requires the REGISTRATION_BOOTSTRAP_TOKEN from your service variables.

### Does my AI provider see my text?

Yes. Uploads go to your embedding provider; questions and relevant text go to your chat provider. Content stays local only if OPENAI_BASE_URL and EMBEDDING_BASE_URL point at self-hosted, OpenAI-compatible models.

### What should I back up?

Back up /app/data (instance data and Chroma index), your Postgres database, and encryption material (SECRET_KEY, ENCRYPTION_SALT, AUDIT_HMAC_KEY) stored off-platform. Rehearse restore first.

### Is all data encrypted?

No. DISK_ENCRYPTION_ACKNOWLEDGED=true only acknowledges that disk encryption is your responsibility; it does not enable or prove encryption or establish compliance. Derived text, chat history and vector chunks are stored in cleartext, while uploaded originals and stored API keys are encrypted at the application layer.

### Is CaseCite legal advice?

No. CaseCite is a research aid, not a substitute for legal judgment or a citator; verify answers against sources and current law.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius v0.1 Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

Open this page in a browser: https://railway.com/deploy/deploy-casecite-legal-ai-research
