It's better if you can use TensorFlow Python to train the model, and TensorFlow.js only to serve it, since TF.js API is very limited ( https://js.tensorflow.org/api/latest/ ). If you don't need complex tools from the Python API, there are some good videos on the TF.js in Coursera that can be audited for free.
I don't understand what you're trying to predict, but usually regression problems use Mean Squared Error Losses, and classification uses Softmax activation on the last layer + Categorical Cross-entropy. And Adam is a good general optimizer.