Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!
[Rusty Hearts] API (node.js)

[Rusty Hearts] API (node.js) 1.2

No permission to download
Hello ragezone! :)
Since there's no movement in the development of Rusty Hearts I've decided to kickstart some Open Source projects. :msmile:

Rusty Hearts API

Rusty Hearts API is a Node.js-based REST API that enables authentication, billing, and launcher functionalities for Rusty Hearts Retail Server.

The API consists of three independent servers (Auth API, Billing API and Launcher API) running on different ports.


api - [Rusty Hearts] API (node.js) - RaGEZONE Forums

API region support

The api currently only support the usa (PWE) region.

*usa (PWE) - Full api support
*chn (Xunlei) - Only launcher support

Server Descriptions

- The Auth API is responsible for in-game authentication
- The Billing API manages the shop's zen balance and purchases. It is essential to bind the Auth/Billing API only to a local IP address and prevent external access to these APIs.
- The Launcher API is a web server intended to handle the client connection to the gateserver and for the Rusty Hearts Launcher, which handles registration, login, client updates, and processing static elements (public directory). This API must be accessible from the outside and proxied by Nginx or bound to an external IP.

Public folder description

Launcher self-update

In order for the launcher to automatically update itself, you need to use the launcher_info.ini in the launcher_update directory of the api. This file specifies the version of the launcher. After each update of the launcher, you need to change the version in the ini, as well in the launcher executable file.

Client download
In order to create client download, you need to use the `client` directory of the api.
The tool for creating the patch files is available here: Rusty Hearts MIP Tool

Client patch
In order to create client patches, you need to use the `patch` directory of the api.
The tool for creating the patch files is available here: Rusty Hearts MIP Tool

News panel
Used to display the html page in the Rusty Hearts Launcher, uses the `news` directory of the api


Before deploying, ensure that you have the following software installed:

* Node.js version 18.5.0 or higher
* Microsoft SQL Server version 2019 or 2022 Developer edition recommended
* Rusty Hearts Retail Server


To deploy, follow these steps:

Basic Installation

1. Install the latest version of Node.js.
2. Download or clone the repository and copy all RustyHearts-API files to a directory of your choice (e.g., c:\RustyHearts-API).
3. Open a terminal window, navigate to the RustyHearts-API directory, and execute the npm install command. Alternatively, you can run the install.bat file.
4. Import the database file RustyHearts_Account.sql to your Microsoft SQL Server.
5. Configure the parameters in the .env file.
6. Start RustyHearts-API servers by executing the node src/app command or running the rh-api.bat file.
7. The server region must be set to usa on service_control.xml

.env file setup:


- PORT: The port number for receiving connections (default 3000).
- AUTH_PORT: The port number for the Auth API.
- BILLING_PORT: The port number for the Billing API.
- ENABLE_HELMET: Determines whether the helmet middleware is enabled or disabled. If enabled, https need to be used for the api.
- TZ: The timezone for the server.


- LOG_LEVEL: The level of logging to use (e.g. debug, info, warn, error).
- LOG_AUTH_CONSOLE: Whether to log Auth API messages to the console.
- LOG_BILLING_CONSOLE: Whether to log Billing API messages to the console.
- LOG_ACCOUNT_CONSOLE: Whether to log Account API messages to the console.
- LOG_MAILER_CONSOLE: Whether to log email messages to the console.


- DB_SERVER: The IP address or hostname of the SQL Server.
- DB_DATABASE: The name of the database to connect to (RustyHearts_Account).
- DB_USER: The user to connect to the database.
- DB_PASSWORD: The password for the database user.
- DB_ENCRYPT: Whether to encrypt the connection to the database.


- GATESERVER_IP: The IP address of the gate server.
- GATESERVER_PORT: The port number of the gate server.


- SMTP_HOST: The hostname or IP address of the SMTP server.
- SMTP_PORT: The port number of the SMTP server.
- SMTP_ENCRYPTION: The encryption protocol to use (e.g. ssl, tls).
- SMTP_USERNAME: The username for the SMTP server.
- SMTP_PASSWORD: The password for the SMTP server.
- SMTP_FROMNAME: The name to use as the sender in emails.

Available endpoints

The api provides the following endpoints:

/serverApi/authPOSTXML with account, password, game and IPAuthenticates a user based on their account information and sends an XML response with their user ID, user type, and success status. If authentication fails, it sends an XML response with a failure status.
/serverApi/billingPOSTXML with currency-request or item-purchase-request and associated arguments | Handles billing requests. For currency requests, it retrieves the user's Zen balance from the database and sends an XML response with the balance. For item purchase requests, it deducts the cost of the item from the user's Zen balance and logs the transaction in the database. If the transaction is successful, it sends an XML response with the success status. If the transaction fails, it sends an XML response with a failure status and an error message.
/serverApi/gatewayGETReturns an XML response containing the IP address and port number of the gateway server.

GETReturns an response containing the gateway endpoint. Used by the chn region.
/serverApi/gateway/statusGETChecks the status of the gateway server by attempting to establish a connection to the server. Returns a JSON object with the status of the server (online or offline) and an HTTP status code indicating the success or failure of the connection attempt.
/accountApi/registerPOSTwindyCode, email, passwordCreate a new account with the provided windyCode, email, and password. The password is first combined with the windyCode to create an MD5 hash, which is then salted and hashed again using bcrypt before being stored in the database. An email confirmation is sent to the provided email address, and a success or error message is returned.
/accountApi/loginPOSTaccount, passwordAuthenticates a user account in the launcher by username or email address and password. Return a token if the authentication is successful (token is currently unsued).
/accountApi/codeVerificationPOSTemail, verification_code_type, verification_codeVerify a user's email by checking the verification code
/accountApi/changePasswordPOSTemail, password, verification_codeChange the password of a user's account, given the email and password verification code
/accountApi/sendVerificationEmailPOSTemailSends a verification email to the specified email address.
/launcherApi/launcherUpdater/getLauncherVersionGETReturns the version of the launcher by reading the launcher_info.ini file.
/launcherApi/launcherUpdater/updateLauncherVersionPOSTversionDownload the specified launcher versionr from the launcher_update folder.
/serverApi/onlineCountGETReturns the number of online players. Returns a JSON object with the count.

Contributions from the community are welcome! If you encounter a bug or have a feature request, please submit an issue on GitHub. If you would like to contribute code, please fork the repository and submit a pull request.

If you need help with the api, please submit an issue on GitHub.

* Add support for other regions

Consider leaving a like/star on github if you like it. ❤️
First release
Last update
5.00 star(s) 2 ratings

More resources from JuniorDark

Latest updates

  1. 1.1

    You must be registered for see element.: *Added onlineCount endpoint *Added launch with PM2...

Latest reviews

Thank you very much for your selfless open source
Upvote 0
This's a really good contribution for those who loves RH
Upvote 0