Deploy CouchDB | Open Source NoSQL Database
Self Host CouchDB. Persistent storage, Fauxton admin UI and more.
CouchDB
Just deployed
/opt/couchdb/data
Deploy and Host CouchDB on Railway
Deploy CouchDB on Railway to get a fully managed, persistent NoSQL document database with a built-in web UI.
Self-host CouchDB and run it on Railway with automatic HTTPS, persistent volumes, and zero infrastructure management. This template deploys a single CouchDB service backed by a persistent volume for data storage.
CouchDB stores data as JSON documents, exposes a RESTful HTTP API, and includes Fauxton — a browser-based admin dashboard for managing databases, documents, and replication. Every document operation is an HTTP request, making it trivially scriptable from any language.
Getting Started with CouchDB on Railway
After deployment completes, open your Railway-generated URL with /_utils appended (e.g. https://your-app.up.railway.app/_utils/) to access the Fauxton admin dashboard. Log in with the COUCHDB_USER and COUCHDB_PASSWORD credentials from your Railway environment variables.
Create your first database by clicking "Create Database" in Fauxton, or use the HTTP API directly:
curl -X PUT https://admin:[email protected]/my_database
Add a document to your new database:
curl -X POST https://admin:[email protected]/my_database \
-H "Content-Type: application/json" \
-d '{"name": "first-doc", "type": "example", "value": 42}'
The system databases (_users, _replicator, _global_changes) are pre-created during deployment — you can start using replication and user management immediately.

About Hosting CouchDB
Apache CouchDB is an open-source NoSQL database from the Apache Software Foundation that stores data as JSON documents. It was first released in 2005 and powers infrastructure at CERN, IBM Cloud, npm, United Airlines, and the Red Cross.
Key features:
- RESTful HTTP API — every operation is a standard HTTP request (GET, PUT, POST, DELETE)
- Multi-master replication — sync data bidirectionally between nodes with automatic conflict detection
- Offline-first architecture — pairs with PouchDB for client-side sync that works without connectivity
- MapReduce views — define JavaScript functions for indexing and querying documents
- Fauxton web UI — built-in browser-based dashboard for database and document management
- MVCC (Multi-Version Concurrency Control) — no read locks, high concurrency
Why Deploy CouchDB on Railway
- One-click deploy with persistent storage and automatic HTTPS
- No Erlang/OTP installation or cluster configuration needed
- Environment variables handle all configuration — no config files to manage
- Railway's private networking enables secure service-to-service communication
- Scale vertically by adjusting Railway resource limits
Common Use Cases for Self-Hosted CouchDB
- Offline-first mobile and web apps — sync PouchDB clients with a CouchDB server, enabling full offline functionality with automatic reconciliation
- Distributed data collection — field research, disaster relief, and remote retail POS systems that must work without reliable connectivity
- IoT event storage — store sensor readings and telemetry as JSON documents with the HTTP API
- Content management backends — flexible JSON schema adapts to evolving content models without migrations
Dependencies for Self-Hosted CouchDB on Railway
- CouchDB —
couchdb:latest(Docker Hub official image, currently v3.5.1) - Persistent volume mounted at
/opt/couchdb/data - No external database dependency — CouchDB is the database
Environment Variables Reference for CouchDB on Railway
| Variable | Description |
|---|---|
COUCHDB_USER | Admin username for Fauxton and API access |
COUCHDB_PASSWORD | Admin password (use a static generated value) |
COUCHDB_SECRET | Shared cluster secret for cookie authentication |
Deployment Dependencies
- Docker image:
couchdbon Docker Hub - Source code: apache/couchdb on GitHub
- Documentation: docs.couchdb.org
- Runtime: Erlang/OTP (included in Docker image)
Hardware Requirements for Self-Hosting CouchDB
| Resource | Minimum | Recommended |
|---|---|---|
| CPU | 1 vCPU | 2+ vCPUs |
| RAM | 512 MB | 2–4 GB (CouchDB uses filesystem cache heavily) |
| Storage | 1 GB | 10+ GB (depends on dataset size) |
| Runtime | Docker | Docker |
CouchDB is lightweight at idle but benefits significantly from available RAM — it uses the OS filesystem cache for read performance. View building (MapReduce) is CPU-intensive.
Self-Hosting CouchDB with Docker
Run CouchDB locally with Docker:
docker run -d --name couchdb \
-p 5984:5984 \
-e COUCHDB_USER=admin \
-e COUCHDB_PASSWORD=your_secure_password \
-e COUCHDB_SECRET=your_cluster_secret \
-v couchdb_data:/opt/couchdb/data \
couchdb:latest
Or with Docker Compose:
services:
couchdb:
image: couchdb:latest
ports:
- "5984:5984"
environment:
COUCHDB_USER: admin
COUCHDB_PASSWORD: your_secure_password
COUCHDB_SECRET: your_cluster_secret
volumes:
- couchdb_data:/opt/couchdb/data
volumes:
couchdb_data:
After starting, create system databases:
curl -X PUT http://admin:your_secure_password@localhost:5984/_users
curl -X PUT http://admin:your_secure_password@localhost:5984/_replicator
curl -X PUT http://admin:your_secure_password@localhost:5984/_global_changes
Is CouchDB Free to Self-Host?
Apache CouchDB is 100% open-source under the Apache License 2.0 — free for commercial and personal use with no feature restrictions, user limits, or paid tiers. The managed alternative is IBM Cloudant (CouchDB-compatible, starts free, paid tiers for production). When self-hosting on Railway, your only cost is Railway infrastructure usage — typically a few dollars per month for light workloads.
CouchDB vs MongoDB for Self-Hosting
| Feature | CouchDB | MongoDB |
|---|---|---|
| Data format | JSON documents | BSON documents |
| API | RESTful HTTP | Binary wire protocol |
| Replication | Multi-master, bidirectional | Primary-secondary |
| Offline sync | Native (PouchDB) | Requires Realm |
| Query language | MapReduce + Mango | MQL (rich query language) |
| Scaling model | Replication-first | Sharding-first |
| License | Apache 2.0 | SSPL |
| Best for | Offline-first, replication | High-throughput CRUD |
CouchDB excels when you need offline-first sync or multi-master replication across unreliable networks. MongoDB is better suited for high-throughput applications with complex query requirements.
FAQ
What is CouchDB and why should you self-host it? Apache CouchDB is an open-source NoSQL document database that stores data as JSON and exposes a RESTful HTTP API. Self-hosting gives you full control over your data, no vendor lock-in, and eliminates per-query pricing from managed services like IBM Cloudant.
What does this CouchDB Railway template deploy?
This template deploys a single CouchDB 3.5.x container with a persistent volume for data storage, an admin user configured via environment variables, and a public HTTPS domain with the Fauxton web UI accessible at /_utils.
Why does the CouchDB template include a persistent volume?
CouchDB stores all database files on disk at /opt/couchdb/data. Without a persistent volume, all data would be lost on every redeploy. The volume ensures your databases, documents, and indexes survive container restarts.
How do I connect to self-hosted CouchDB from my application?
CouchDB uses a standard HTTP API. From any language, make HTTP requests to https://your-domain.up.railway.app/your_database. Use Basic Auth with your COUCHDB_USER and COUCHDB_PASSWORD. Libraries like Nano (Node.js), python-couchdb, or PouchDB provide higher-level clients.
How do I set up CouchDB replication on Railway?
Use the Fauxton UI (/_utils/#/replication) or POST to /_replicate with source and target database URLs. CouchDB supports continuous replication — changes propagate automatically. For PouchDB sync, point your PouchDB instance at your Railway CouchDB URL.
Can I use CouchDB as a backend for Obsidian LiveSync? Yes — CouchDB is the recommended backend for the Obsidian LiveSync plugin (obsidian-livesync). Deploy CouchDB on Railway, configure CORS headers, and point the plugin at your Railway URL.
Template Content
CouchDB
couchdb:latestCOUCHDB_USER
Admin username
COUCHDB_PASSWORD
Create Admin password