JavaScript Mining System Design How do I verify a unconfirmed transaction using JavaScript ?
It is not possible to verify just a single transaction, without knowing the state of the network. To know the state of the network, you must verify all of it's historical transactions (aka, run a full node). 

So this means it is not possible to just take a single transaction alone, and verify it using some bit of code. Rather, you will need the entire history of transactions, so that you can determine whether the transaction is valid in relation to the current state of the network (ie, does the person who is attempting to spend some coins rightfully own them?).

There are various implementations of a bitcoin node available, written in various languages. You'll want to find one that you can interact with programmatically using javascript.

EDIT: I now see you seem to be asking about building some mining software. My answer above still holds true (you'll need a full node to determine the network state and create block templates), but otherwise I think your question (build mining software) is overly broad.