---
title: "Deploy MongoDB Single Replica"
description: "Single MongoDB replica set for use with clients needing a replica set."
category: "Storage"
url: https://railway.com/deploy/dxhww9
---

# Deploy MongoDB Single Replica

Single MongoDB replica set for use with clients needing a replica set.

**[Deploy MongoDB Single Replica on Railway](https://railway.com/template/dxhww9)**

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

- **Creator:** Brody's Projects
- **Category:** Storage
- **Total deploys:** 73

## Template content

### Mongo Single Replica https://devicons.railway.app/mongo

- **Source:** railwayapp-templates/mongo-replica-set

### Init Single Replica

- **Source:** railwayapp-templates/mongo-replica-set

## Documentation

This template deploys a single MongoDB instance for your data layer needs.

### Network Communication

All database communication is done over the [private network](https://docs.railway.app/reference/private-networking).

### Configuration tuning

To tune the configuration of your MongoDB instance, refer to the [MongoDB documentation](https://www.mongodb.com/docs/manual/replication/) or the [documentation page in Docker Hub](https://hub.docker.com/_/mongo).

### Authentication

The MongoDB instance is deployed with standard authentication enabled.

### Connecting to MongoDB

To connect to MongoDB from another service in Railway, you should create a URI in the service's environment variables. As an example:

```
MONGO_HOST=${{mongo.RAILWAY_PRIVATE_DOMAIN}}:27017
MONGO_URI=mongodb://${{mongo.MONGO_INITDB_ROOT_USERNAME}}:${{mongo.MONGO_INITDB_ROOT_PASSWORD}}@${{MONGO_HOST}}
```

With these variables set, you can then reference the `MONGO_URI` environment variable when configuring the client in your service code.

### Template source

The source for this template can be found in the [Railway Templates GitHub](https://github.com/railwayapp-templates/mongo-replica-set/tree/main).

The MongoDB instance is built directly from the [official MongoDB image in Docker Hub](https://hub.docker.com/_/mongo).

### Resources
- [MongoDB documentation](https://www.mongodb.com/docs/manual/)
- Tutorial: [Deploy MongoDB on Railway](https://docs.railway.app/tutorials/deploy-and-monitor-mongo)This template deploys a single MongoDB instance for your data layer needs.

### Network Communication

All database communication is done over the [private network](https://docs.railway.app/reference/private-networking).

### Configuration tuning

To tune the configuration of your MongoDB instance, refer to the [MongoDB documentation](https://www.mongodb.com/docs/manual/replication/) or the [documentation page in Docker Hub](https://hub.docker.com/_/mongo).

### Authentication

The MongoDB instance is deployed with standard authentication enabled.

### Connecting to MongoDB

To connect to MongoDB from another service in Railway, you should create a URI in the service's environment variables. As an example:

```
MONGO_HOST=${{mongo.RAILWAY_PRIVATE_DOMAIN}}:27017
MONGO_URI=mongodb://${{mongo.MONGO_INITDB_ROOT_USERNAME}}:${{mongo.MONGO_INITDB_ROOT_PASSWORD}}@${{MONGO_HOST}}
```

With these variables set, you can then reference the `MONGO_URI` environment variable when configuring the client in your service code.

### Template source

The source for this template can be found in the [Railway Templates GitHub](https://github.com/railwayapp-templates/mongo-replica-set/tree/main).

The MongoDB instance is built directly from the [official MongoDB image in Docker Hub](https://hub.docker.com/_/mongo).

### Resources
- [MongoDB documentation](https://www.mongodb.com/docs/manual/)
- Tutorial: [Deploy MongoDB on Railway](https://docs.railway.app/tutorials/deploy-and-monitor-mongo)

## Similar templates

- [RustFS | (Just Updated) S3 Object Store, Public URL and Keys Set](https://railway.com/deploy/rustfs-or-just-updated-s3-object-store-p) — S3-compatible object store, keys and public URL preset, volume kept
- [TimescaleDB](https://railway.com/deploy/timescaledb-railway-template) — A PostgreSQL-based time-series database for analytics on Railway.
- [Neo4j 2026.10 Community](https://railway.com/deploy/neo4j-202610-community) — Neo4j graph database with APOC, Browser, Bolt TCP proxy and a volume

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