---
title: "Deploy Grist — Self-Hosted Relational Spreadsheet on Railway"
description: "Self-host Grist: Python formulas, relational data. No per-user fees."
category: "Analytics"
url: https://railway.com/deploy/grist-spreadsheet-database
---

# Deploy Grist — Self-Hosted Relational Spreadsheet on Railway

Self-host Grist: Python formulas, relational data. No per-user fees.

**[Deploy Grist — Self-Hosted Relational Spreadsheet on Railway on Railway](https://railway.com/template/grist-spreadsheet-database)**

- **Creator:** SilverBanana
- **Category:** Analytics
- **Total deploys:** 6

## Template content

### Deploy Grist https://lhbaovhjuhitknbfclbg.supabase.co/storage/v1/object/public/logos//grist.png

- **Image:** gristlabs/grist
- **Public domain:** Yes

## Documentation

# Deploy and Host Grist on Railway

Grist is an open-source relational spreadsheet that combines the flexibility of a spreadsheet
with the structure of a real database — **Python formulas**, typed columns, granular row-level
access controls, SSO, a REST API, and a portable SQLite-based format you can download and open
with any tool. Unlike Airtable which locks your data in a proprietary format, or Google Sheets
which lacks relational structure, Grist lets you build interconnected data models with the
formula power of Python rather than limited cell-based scripting.

Self-host on Railway for ~$2–5/month flat versus Grist Team at $8/user/month or Airtable Pro
at $20/user/month — with zero per-user fees and full data ownership.

---

## What This Template Deploys

| Service | Purpose |
|---|---|
| **Grist** | The relational spreadsheet engine — web UI, Python formula engine, REST API, real-time collaboration, and access control served on port `8484` |
| **Persistent Volume** | Mounted at `/persist` — stores all Grist documents, user data, and SQLite databases across redeploys |

Single-service architecture. No external database required — Grist uses SQLite internally,
with each document stored as a portable `.grist` file on the persistent volume.

---

## About Hosting Grist

Running Grist in production requires a persistent volume for document storage, a public HTTPS
endpoint for browser and API access, and environment variable management for authentication
configuration and SSO integration. Without a managed host, you're configuring Docker, volume
mounts, SSL certificates, and reverse proxy rules manually.

Railway handles all of it. This template deploys Grist from the official Docker image, mounts
a persistent volume at `/persist`, and exposes a secure HTTPS endpoint immediately after
deploy. All documents, user accounts, and access rules survive every redeploy.

Typical cost: **~$2–5/month** on Railway's Hobby plan — the lowest cost per-user of any
Airtable alternative available. Grist Team costs $8/user/month. Airtable Pro costs
$20/user/month. For a 5-person team, self-hosting on Railway saves $35–95/month.

---

## Deploy in Under 3 Minutes

1. Click **Deploy on Railway** — Grist builds and deploys automatically (~2 minutes)
2. Set `GRIST_SESSION_SECRET` to a random 32+ character string in the Variables tab
3. Open your Railway-assigned URL — the Grist login screen loads immediately
4. Create your admin account and start building documents

No SSH. No database configuration. No SSL certificates to manage.

![Grist document editor with linked tables and Python formulas](YOUR_GRIST_DOCUMENT_SCREENSHOT_URL_HERE)

---

## Common Use Cases

- **Self-hosted alternative to Airtable** — replace $20/user/month with ~$2–5/month flat;
  get relational database structure, Python formulas, and full data ownership in a portable
  SQLite format you can download and open with any tool
- **Self-hosted alternative to Google Sheets for structured data** — Grist's typed columns
  and relational linking replace the fragility of cross-sheet references and VLOOKUP hacks
  with proper relational data models
- **Python-powered data analysis without a data engineering stack** — write Python formulas
  directly in cells using the full standard library; no Jupyter notebook, no server setup
- **Team data workspace with row-level access controls** — restrict which rows, columns, and
  tables each user or role can see; set rules from CEO to intern without exporting separate
  sheets
- **Internal tools and operational dashboards** — link tables, cards, and charts in drag-and-drop
  layouts; build app-like views without code for CRM, project tracking, inventory, and reporting
- **n8n and automation workflow integration** — connect Grist's REST API to n8n, Zapier, or
  Make to trigger workflows from data changes or push data from external services into tables

---

## Configuration

| Variable | Required | Description |
|---|---|---|
| `GRIST_SESSION_SECRET` | ✅ Required | Session signing secret — generate a random 32+ character string |
| `APP_HOME_URL` | Recommended | Your Railway public domain — e.g. `https://your-app.up.railway.app`. Required for correct URL generation |
| `GRIST_DEFAULT_EMAIL` | Optional | Pre-configure the first admin account email at deploy time |
| `GRIST_SANDBOX_FLAVOR` | Optional | Formula sandbox — `gvisor` for maximum isolation, `pyodide` for WASM-based sandboxing (default) |
| `GRIST_SINGLE_ORG` | Optional | Set to your org name to lock Grist to a single organisation — simplifies multi-user setups |
| `GRIST_OIDC_IDP_ISSUER` | Optional | OIDC provider issuer URL — enables SSO via Google, Auth0, Keycloak, or any OIDC provider |
| `GRIST_OIDC_IDP_CLIENT_ID` | Optional | OIDC client ID — required if using SSO |
| `GRIST_OIDC_IDP_CLIENT_SECRET` | Optional | OIDC client secret — required if using SSO |
| `GRIST_FORCE_LOGIN` | Optional | Set to `true` to require login before accessing any document |
| `PORT` | Auto-set | Railway injects the port automatically — do not set manually |

---

## Grist vs. Alternatives

| | Grist (self-hosted) | Airtable Pro | NocoDB | Google Sheets |
|---|---|---|---|---|
| **Monthly cost** | ~$2–5 flat | $20/user | Free (self-hosted) | Free |
| **Python formulas** | ✅ Full standard library | ❌ No | ❌ No | ❌ No |
| **Relational structure** | ✅ Typed columns + links | ✅ Yes | ✅ Yes | ❌ Flat only |
| **Data ownership** | ✅ Portable SQLite file | ❌ Airtable servers | ✅ Self-hosted | ❌ Google servers |
| **Row-level access control** | ✅ Granular rules | ✅ Yes | ⚠️ Limited | ❌ No |
| **SSO (OIDC/SAML)** | ✅ Built-in | ❌ Enterprise only | ⚠️ Limited | ❌ No |
| **REST API** | ✅ Yes | ✅ Yes | ✅ Yes | ⚠️ Via Apps Script |
| **Offline / portable format** | ✅ SQLite file | ❌ No | ❌ No | ❌ No |
| **n8n / Zapier integration** | ✅ Native | ✅ Yes | ✅ Yes | ✅ Yes |
| **Self-hostable** | ✅ Yes | ❌ No | ✅ Yes | ❌ No |

---

## Dependencies for Grist Hosting

- Railway account — Hobby plan (~$2–5/month) covers the single-service deployment
- No external database, no Redis, no additional services required
- Optional: OIDC provider (Google, Auth0, Keycloak) for SSO authentication

### Deployment Dependencies

- [Grist GitHub Repository](https://github.com/gristlabs/grist-core) — source and releases
- [Grist Documentation](https://support.getgrist.com/) — full configuration and self-hosting reference
- [Grist Self-Hosting Guide](https://support.getgrist.com/self-managed/) — environment variable reference
- [Grist REST API Documentation](https://support.getgrist.com/api/) — API reference
- [Railway Volumes Documentation](https://docs.railway.com/volumes) — persistent storage setup

### Implementation Details

This template deploys Grist from the official `gristlabs/grist` Docker image with a Railway
volume at `/persist`. Documents are stored as individual `.grist` SQLite files — portable,
self-contained, and downloadable at any time. The Python formula engine runs sandboxed via
Pyodide (WASM) or gVisor depending on `GRIST_SANDBOX_FLAVOR`. The web UI and REST API are
served behind Railway's automatic HTTPS proxy.

---

## Frequently Asked Questions

**How much does Grist cost on Railway vs Airtable or Grist Cloud?**
Self-hosting on Railway runs at ~$2–5/month flat with no per-user fees. Grist Team costs
$8/user/month — for a 5-person team that's $40/month. Airtable Pro costs $20/user/month —
$100/month for 5 users. Railway self-hosting removes per-user billing entirely, with only
flat compute costs regardless of how many people use the instance.

**What makes Grist different from NocoDB or Baserow?**
Grist's primary differentiator is Python formulas — you can write full Python code with the
standard library directly in formula columns. NocoDB and Baserow both use JavaScript or no
scripting. Grist also stores each document as a portable SQLite file that you can download
and open independently. NocoDB and Baserow use a shared PostgreSQL database with no
per-document portability.

**Do I lose my documents if Railway redeploys?**
No. All Grist documents are stored as SQLite files on the Railway persistent volume at
`/persist`, not inside the container. Redeploys, version updates, and container restarts
do not affect your documents or data.

**Can I use Grist with SSO (Google, Auth0, or Okta)?**
Yes. Grist supports SSO via OIDC and SAML natively. Set `GRIST_OIDC_IDP_ISSUER`,
`GRIST_OIDC_IDP_CLIENT_ID`, and `GRIST_OIDC_IDP_CLIENT_SECRET` to your provider's credentials.
Detailed setup guides for Google Workspace, Auth0, and Keycloak are in the Grist
self-hosting documentation.

**Can I export my data if I want to leave Grist?**
Yes. Every Grist document is stored as a portable `.grist` SQLite file. Download any document
from the Grist UI as `.grist`, `.csv`, or `.xlsx` at any time. The SQLite file can be opened
directly with any SQLite browser or tool — no vendor lock-in, no export restrictions.

**Can I connect Grist to n8n or Zapier?**
Yes. Grist has a full REST API with per-document and per-table endpoints. Use any HTTP
request node in n8n or Zapier to read from and write to Grist tables. Grist also has a
native Zapier integration and community-maintained n8n nodes for direct connection.

---

## Why Deploy Grist 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 Grist on Railway, you get a self-hosted relational spreadsheet with Python
formulas, granular access controls, SSO, a REST API, and fully portable document storage —
at ~$2–5/month flat with no per-user fees and no proprietary data lock-in.

## Similar templates

- [Matomo Analytics + MariaDB](https://railway.com/deploy/matomo-analytics-mariadb) — Privacy-friendly analytics with MariaDB and persistent volumes.
- [Bugsink](https://railway.com/deploy/bugsink) — Self-hosted Error Tracking. Sentry-SDK compatible
- [SubTrackr](https://railway.com/deploy/bscottsubtrackr) — Self-hosted Subscription Tracker

Open this page in a browser: https://railway.com/deploy/grist-spreadsheet-database
