While running your own Ethereum node with geth by using web3js from node.js (backend) app is a common solution, connecting to a public Ethereum node such as infura.io and using [truffle-contract](https://github.com/trufflesuite/truffle-contract] gives some benefits:

How to do it?

asyncawait module provides async / await capabilities to make code much shorter. If you use node.js version with built-in async / await you can ignore this and just remove parentheses after each async / await in the code sample below.

RPC_SERVER contains path to infura.io node (in this case, I choose to connect to Ropsten for testing) and your API token (currently you can obtained for free by registering). TOKEN_SALE_CONTRACT contains the path to your smart contracts build result. Usually it is inside build/contracts subdirectory within your Truffle project directory. You can just copy them from there to your node.js project directory. While privateKey is your Ethereum wallet private key from account that you want to use sign the transaction.

Please also make sure you have some ETH in the wallet in case you are invoking transaction (which require gas). Otherwise you will hit insufficient funds error.

Then we need to setup custom provider/engine to enable implicit transaction self-signing: