Deploy S4N Donate System
S4N Donate manages sponsorships and payments with PostgreSQL and gateways.
Just deployed
/var/lib/postgresql/data
s4n-donate-system
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
- S4N Donate System GitHub Repository
- S4N Donate System Docker Image
- PostgreSQL Docker Image
- ECPay
- O'Pay
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.
| 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:
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:
| 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:
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:
- Open the PostgreSQL service in Railway.
- Go to Settings.
- Open Volumes.
- Add a volume named
postgres-data. - 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:
- Deploy the PostgreSQL service.
- Add the
postgres-datavolume and mount it at/var/lib/postgresql/data. - Deploy the S4N Donate System service.
- Configure all required environment variables.
- Ensure
DATABASE_URLreferences the PostgreSQL service. - Go to the S4N Donate System service's Settings → Networking.
- Generate a Railway domain for port
3000. - 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
s4n-donate-system
lokisalmonneko/s4n-donate-system:latestOPAY_HASH_IV
OPAY_HASH_KEY
ADMIN_PASSWORD
ADMIN_USERNAME
ECPAY_HASH_KEY
OPAY_MERCHANT_ID
ECPAY_MERCHANT_ID
