---
title: "Deploy S4N Donate System"
description: "S4N Donate manages sponsorships and payments with PostgreSQL and gateways."
category: "Other"
url: https://railway.com/deploy/s4n-donate-system
---

# Deploy S4N Donate System

S4N Donate manages sponsorships and payments with PostgreSQL and gateways.

**[Deploy S4N Donate System on Railway](https://railway.com/template/s4n-donate-system)**

- **Category:** Other

## Template content

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

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

### s4n-donate-system

- **Image:** lokisalmonneko/s4n-donate-system:latest
- **Public domain:** Yes

## Documentation

# Deploy and Host S4N Donate System on Railway

S4N Donate System is a donation and sponsorship management application with an administrative dashboard and payment integrations. It uses PostgreSQL to persist application and sponsorship data and supports ECPay and O'Pay payment providers. The application also provides JWT-based authentication and configurable administrator credentials for dashboard access.

## About Hosting S4N Donate System

Hosting S4N Donate System on Railway involves running the application and PostgreSQL database as separate Railway services. The application uses the `lokisalmonneko/s4n-donate-system:latest` Docker image and listens on port `3000`. PostgreSQL runs from the `postgres:15-alpine` image and uses persistent storage mounted at `/var/lib/postgresql/data` to retain sponsorship records and application data. The application connects to PostgreSQL through the `DATABASE_URL` Railway reference variable. Railway provides the public HTTPS domain used by the application through `RAILWAY_PUBLIC_DOMAIN`, while the database can remain private and accessible through Railway's internal networking.

## Common Use Cases

* Managing online donations and sponsorship records.
* Providing an administrative dashboard for donation management.
* Processing donations through ECPay and O'Pay payment integrations.

## Dependencies for S4N Donate System Hosting

* S4N Donate System application
* PostgreSQL 15 database
* ECPay merchant credentials
* O'Pay merchant credentials

### Deployment Dependencies

* [S4N Donate System GitHub Repository](https://github.com/LokiSalmonNeko/s4n-donate-system?utm_source=chatgpt.com)
* [S4N Donate System Docker Image](https://hub.docker.com/r/lokisalmonneko/s4n-donate-system?utm_source=chatgpt.com)
* [PostgreSQL Docker Image](https://hub.docker.com/_/postgres?utm_source=chatgpt.com)
* [ECPay](https://www.ecpay.com.tw/?utm_source=chatgpt.com)
* [O'Pay](https://www.opay.tw/?utm_source=chatgpt.com)

### Implementation Details

#### Docker

The application uses the following Docker image:

```docker
lokisalmonneko/s4n-donate-system:latest
```

The PostgreSQL database uses:

```docker
postgres:15-alpine
```

Both services should be deployed as separate Railway services.

Railway uses the Docker runtime for this deployment. No custom build or start commands are documented.

#### Public Networking

The S4N Donate System application listens on port `3000`.

| Protocol | Proxy Type          | Target Port | Purpose                                         |
| -------- | ------------------- | ----------: | ----------------------------------------------- |
| HTTP     | HTTP Proxy          |        3000 | S4N Donate System web application and dashboard |
| TCP      | Internal Networking |        5432 | PostgreSQL database connection                  |

The application binds to all interfaces:

```env
HOST=0.0.0.0
```

After deploying the application, generate a Railway domain under **Settings → Networking → Generate Domain**.

The public application URL is then available through:

```text
https://
```

The PostgreSQL service does not need a public domain. The application should connect to PostgreSQL through Railway's internal service networking.

#### Environment Variables

Configure the following variables in the S4N Donate System service:

| Variable               | Required | Description                                          |
| ---------------------- | -------- | ---------------------------------------------------- |
| `ADMIN_USERNAME`       | Yes      | Username used to access the administrative dashboard |
| `ADMIN_PASSWORD`       | Yes      | Password used to access the administrative dashboard |
| `JWT_SECRET`           | Yes      | Secret used for JWT authentication                   |
| `DATABASE_URL`         | Yes      | PostgreSQL connection string                         |
| `ECPAY_MERCHANT_ID`    | Yes      | ECPay merchant ID                                    |
| `ECPAY_HASH_KEY`       | Yes      | ECPay Hash Key                                       |
| `ECPAY_HASH_IV`        | Yes      | ECPay Hash IV                                        |
| `OPAY_MERCHANT_ID`     | Yes      | O'Pay merchant ID                                    |
| `OPAY_HASH_KEY`        | Yes      | O'Pay Hash Key                                       |
| `OPAY_HASH_IV`         | Yes      | O'Pay Hash IV                                        |
| `NEXT_PUBLIC_BASE_URL` | Yes      | Public URL used by the application                   |

Raw Editor example:

```env
ADMIN_USERNAME=your_admin_username
ADMIN_PASSWORD=your_admin_password
JWT_SECRET=your_jwt_secret

DATABASE_URL=${{postgres.POSTGRES_CONNECTION_STRING}}

ECPAY_MERCHANT_ID=your_ecpay_merchant_id
ECPAY_HASH_KEY=your_ecpay_hash_key
ECPAY_HASH_IV=your_ecpay_hash_iv

OPAY_MERCHANT_ID=your_opay_merchant_id
OPAY_HASH_KEY=your_opay_hash_key
OPAY_HASH_IV=your_opay_hash_iv

NEXT_PUBLIC_BASE_URL=https://${{RAILWAY_PUBLIC_DOMAIN}}
```

The `DATABASE_URL` variable should reference the PostgreSQL service's connection string:

```text
${{postgres.POSTGRES_CONNECTION_STRING}}
```

Replace `postgres` with the actual Railway PostgreSQL service name if you use a different service name.

`NEXT_PUBLIC_BASE_URL` should reference the public Railway domain so the application can generate URLs using its deployed address.

Keep administrator credentials, JWT secrets, and payment-provider credentials private.

#### Persistent Storage

Persistent storage is required for PostgreSQL.

Create a volume for the PostgreSQL service:

1. Open the PostgreSQL service in Railway.
2. Go to **Settings**.
3. Open **Volumes**.
4. Add a volume named `postgres-data`.
5. Set the mount path to:

```text
/var/lib/postgresql/data
```

The volume is required to persist PostgreSQL sponsorship records and application database data across restarts and redeployments.

#### Database

S4N Donate System requires PostgreSQL.

Deploy PostgreSQL using:

```docker
postgres:15-alpine
```

The database listens on port `5432`.

The application connects to PostgreSQL through:

```env
DATABASE_URL=${{postgres.POSTGRES_CONNECTION_STRING}}
```

Deploy PostgreSQL as a separate Railway service in the same project and configure its persistent volume at:

```text
/var/lib/postgresql/data
```

Use Railway's private service networking for communication between the application and database.

#### Build &amp; Start

No custom build or start commands are documented.

Railway runs the supplied S4N Donate System Docker image using the Docker runtime.

#### Accessing the Application

After deployment:

1. Deploy the PostgreSQL service.
2. Add the `postgres-data` volume and mount it at `/var/lib/postgresql/data`.
3. Deploy the S4N Donate System service.
4. Configure all required environment variables.
5. Ensure `DATABASE_URL` references the PostgreSQL service.
6. Go to the S4N Donate System service's **Settings → Networking**.
7. Generate a Railway domain for port `3000`.
8. Open the generated HTTPS URL.

The public application URL will be:

```text
https://
```

Use the configured `ADMIN_USERNAME` and `ADMIN_PASSWORD` values to access the administrative dashboard.

The application should be configured with the same public URL through:

```env
NEXT_PUBLIC_BASE_URL=https://${{RAILWAY_PUBLIC_DOMAIN}}
```

#### Payment Provider Configuration

S4N Donate System requires the relevant merchant credentials for its supported payment providers.

For ECPay, configure:

```env
ECPAY_MERCHANT_ID=your_ecpay_merchant_id
ECPAY_HASH_KEY=your_ecpay_hash_key
ECPAY_HASH_IV=your_ecpay_hash_iv
```

For O'Pay, configure:

```env
OPAY_MERCHANT_ID=your_opay_merchant_id
OPAY_HASH_KEY=your_opay_hash_key
OPAY_HASH_IV=your_opay_hash_iv
```

Obtain these values from the respective payment provider accounts. Do not expose payment credentials in source code or public documentation.

## Why Deploy S4N Donate System 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 S4N Donate System 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

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — [Jul'26] Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/s4n-donate-system
