---
title: "Deploy Mix Space Core"
description: "A modern personal website backend server"
category: "Starters"
url: https://railway.com/deploy/mix-space-core
---

# Deploy Mix Space Core

A modern personal website backend server

**[Deploy Mix Space Core on Railway](https://railway.com/template/mix-space-core)**

- **Category:** Starters

## Template content

### mx-server

- **Image:** innei/mx-server:latest
- **Public domain:** Yes

### MongoDB https://devicons.railway.app/i/mongodb.svg

- **Image:** mongo:8.0
- **Start command:** `docker-entrypoint.sh mongod --ipv6 --bind_ip ::,0.0.0.0 --setParameter diagnosticDataCollectionEnabled=false`

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

- **Image:** redis:8.2.1
- **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 Mix Space Core on Railway

Mix Space Core is a modern backend server for personal websites built with Node.js. It provides RESTful APIs for personal websites, blogs, and content management workflows. The application includes MongoDB database support, Redis caching, JWT authentication, and content management capabilities for building and powering a personal website backend.

## About Hosting Mix Space Core

Hosting Mix Space Core on Railway involves deploying the application together with MongoDB and Redis as three services within the same Railway project. The Mix Space Core service runs on port `2333` and communicates with MongoDB and Redis through Railway's private networking. MongoDB requires persistent storage mounted at `/data/db`, while Redis uses a volume mounted at `/data`. The application also uses `/root/.mx-space` for its own persistent data. Railway provides the public HTTP endpoint for the API while keeping the database and Redis services private. JWT authentication requires a secure secret, and CORS origins can be configured through the `ALLOWED_ORIGINS` variable.

## Common Use Cases

* Providing a REST API backend for a personal website or blog
* Managing website and blog content through a centralized content management backend
* Powering applications that require MongoDB storage, Redis caching, and JWT authentication

## Dependencies for Mix Space Core Hosting

* MongoDB
* Redis
* Persistent Railway Volumes
* JWT secret
* Allowed CORS origins

### Deployment Dependencies

* [Mix Space Core Official Website](https://mx-space.js.org/?utm_source=chatgpt.com)
* [Mix Space Core GitHub Repository](https://github.com/mx-space/core?utm_source=chatgpt.com)

### Implementation Details

#### Docker

Deploy the following Docker images as separate Railway services:

**Mix Space Core**

```docker id="3a4n8p"
innei/mx-server:latest
```

**MongoDB**

```docker id="h8k2s1"
mongo:latest
```

**Redis**

```docker id="f6p4r2"
redis:alpine
```

Railway can deploy these prebuilt Docker images directly, so no custom Dockerfile or build command is required.

#### Public Networking

Only the Mix Space Core service needs public networking.

| Service     | Protocol | Proxy Type         | Target Port | Public |
| ----------- | -------- | ------------------ | ----------: | ------ |
| `mx-server` | HTTP     | HTTP Proxy         |        2333 | Yes    |
| `MongoDB`   | TCP      | Private networking |       27017 | No     |
| `Redis`     | TCP      | Private networking |        6379 | No     |

Generate a Railway domain for the `mx-server` service on port `2333`. MongoDB and Redis should remain private and should be accessed through Railway private networking.

#### Environment Variables

Configure the following variables on the `mx-server` service:

| Variable          | Required | Description                                                            |
| ----------------- | -------- | ---------------------------------------------------------------------- |
| `ALLOWED_ORIGINS` | Yes      | Comma-separated list of origins allowed to access the API through CORS |
| `DB_HOST`         | Yes      | Private hostname of the MongoDB service                                |
| `JWT_SECRET`      | Yes      | Secure secret used for JWT token encryption                            |
| `NODE_ENV`        | Yes      | Application environment. Set to `production`                           |
| `REDIS_HOST`      | Yes      | Private hostname of the Redis service                                  |
| `TZ`              | Yes      | Application timezone                                                   |

Raw Editor example:

```env id="6q7m2x"
ALLOWED_ORIGINS=https://your-domain.com
DB_HOST=${{MongoDB.RAILWAY_PRIVATE_DOMAIN}}
JWT_SECRET=YOUR_SECURE_JWT_SECRET
NODE_ENV=production
REDIS_HOST=${{Redis.RAILWAY_PRIVATE_DOMAIN}}
TZ=Asia/Shanghai
```

Use Railway reference variables for the database services rather than public hostnames. The service names used in the references must match the corresponding Railway service names.

Generate a strong, unique value for `JWT_SECRET`. Do not reuse publicly exposed secrets or commit the value to source control.

#### Persistent Storage

Persistent storage is required for all three services.

For **MongoDB**, add a Railway Volume with:

```text id="1q8r4t"
/data/db
```

For **Redis**, add a Railway Volume with:

```text id="9s3k5v"
/data
```

For **Mix Space Core**, add a Railway Volume with:

```text id="2m7p6w"
/root/.mx-space
```

These volumes preserve the database, Redis data, and Mix Space Core application data across service restarts and redeployments.

#### Database

Mix Space Core requires MongoDB.

Deploy:

```text id="j4n6c8"
mongo:latest
```

MongoDB listens on port `27017` and should remain private.

Configure the Mix Space Core service's `DB_HOST` to reference the MongoDB Railway private domain:

```env id="5v2x8m"
DB_HOST=${{MongoDB.RAILWAY_PRIVATE_DOMAIN}}
```

The supplied template does not document MongoDB authentication variables, so no additional database credentials should be invented.

#### Redis

Mix Space Core also requires Redis for caching.

Deploy:

```text id="p8k3d6"
redis:alpine
```

Redis listens on port `6379` and should remain private.

Configure the Mix Space Core service to reference Redis through Railway private networking:

```env id="r5c9t2"
REDIS_HOST=${{Redis.RAILWAY_PRIVATE_DOMAIN}}
```

#### Build &amp; Start

No custom build or start commands are required.

Railway deploys the prebuilt `innei/mx-server:latest` image directly.

#### Accessing the Application

1. Create a new Railway project.
2. Create a MongoDB service using `mongo:latest`.
3. Add a MongoDB Volume mounted at `/data/db`.
4. Create a Redis service using `redis:alpine`.
5. Add a Redis Volume mounted at `/data`.
6. Create the Mix Space Core service using `innei/mx-server:latest`.
7. Add a Volume to Mix Space Core mounted at `/root/.mx-space`.
8. Configure the required environment variables.
9. Set `DB_HOST` to the MongoDB Railway private domain.
10. Set `REDIS_HOST` to the Redis Railway private domain.
11. Generate a Railway domain for Mix Space Core on port `2333`.
12. Access the API using the generated HTTPS URL.

The supplied template does not document default credentials or a default administrative login.

The Mix Space Core API is available through the generated Railway domain, for example:

```text
https://
```

Only the Mix Space Core service should be publicly accessible. Keep MongoDB and Redis on Railway's private network.

## Why Deploy Mix Space Core 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 Mix Space Core 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.


## Similar templates

- [open-excalidraw](https://railway.com/deploy/open-excalidraw) — Self-hostable collaborative drawing built on Excalidraw
- [caring-vibrancy](https://railway.com/deploy/caring-vibrancy) — Deploy and Host caring-vibrancy with Railway
- [Appsmith](https://railway.com/deploy/appsmith-1) — Low-code platform for internal tools, dashboards, and admin panels.

Open this page in a browser: https://railway.com/deploy/mix-space-core
