Railway

Deploy S4N Donate System

S4N Donate manages sponsorships and payments with PostgreSQL and gateways.

Deploy S4N Donate System

/var/lib/postgresql/data

Just deployed

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

Implementation Details

Docker

The application uses the following Docker image:

lokisalmonneko/s4n-donate-system:latest

The PostgreSQL database uses:

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.

ProtocolProxy TypeTarget PortPurpose
HTTPHTTP Proxy3000S4N Donate System web application and dashboard
TCPInternal Networking5432PostgreSQL database connection

The application binds to all interfaces:

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:

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:

VariableRequiredDescription
ADMIN_USERNAMEYesUsername used to access the administrative dashboard
ADMIN_PASSWORDYesPassword used to access the administrative dashboard
JWT_SECRETYesSecret used for JWT authentication
DATABASE_URLYesPostgreSQL connection string
ECPAY_MERCHANT_IDYesECPay merchant ID
ECPAY_HASH_KEYYesECPay Hash Key
ECPAY_HASH_IVYesECPay Hash IV
OPAY_MERCHANT_IDYesO'Pay merchant ID
OPAY_HASH_KEYYesO'Pay Hash Key
OPAY_HASH_IVYesO'Pay Hash IV
NEXT_PUBLIC_BASE_URLYesPublic URL used by the application

Raw Editor example:

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:

${{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:
/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:

postgres:15-alpine

The database listens on port 5432.

The application connects to PostgreSQL through:

DATABASE_URL=${{postgres.POSTGRES_CONNECTION_STRING}}

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

/var/lib/postgresql/data

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

Build & 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:

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:

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:

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:

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.


Template Content

More templates in this category

View Template
Rocky Linux
[Jul'26] Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀

codestorm
39
View Template
Foundry Virtual Tabletop
A Self-Hosted & Modern Roleplaying Platform

Lucas
71
View Template
Letta Code Remote
Run a Letta Code agent 24/7. No inbound ports, just deploy.

Letta
51