Using web3js you would need to create a custom provider to set the default account.
Using etherJS you can do something like the following:
const ethers = require('ethers');
const Wallet = ethers.Wallet;
const Contract = ethers.Contract;
const utils = ethers.utils;
const providers = ethers.providers;
let network = "ropsten";
let privateKey = "0x3a1076bf45ab87712ad64ccb3b1021.......";
let infuraAPIKey = "XXXXXX";
let provider = new providers.InfuraProvider(network, infuraAPIKey);
let serverWallet = new Wallet(privateKey, provider);