Create a Python program that creates a new Blender file and edits the scene
Background mode

Can run blender in background mode. 

How can I run blender from command line or a python script without opening a GUI?

Run the command using language of choice. For example in python using  subprocess.Popen(...) or a 3rd party module like plumbum or something akin to https://stackoverflow.com/questions/17733849/launch-an-external-application-from-node-js via node.js

Very basic example script. My startup file has default cube with material "Material". The material's diffuse color in 2.79 is rgb, in 2.8 rgba.  Simply sets material to red, and saves the file as "output.blend"

test.py

import bpy

mat = bpy.data.materials.get("Material")
red = (1, 0, 0)
if len(mat.diffuse_color) == 4: # has alpha
    red += (1) # alpha

mat.diffuse_color = red    
bpy.ops.wm.save_as_mainfile(filepath="output.blend")


Run from command line with

blender -b -P test.py 


creates a blend file named output.blend with a red cube in the folder in which it was run from terminal.

Extend by passing arguments see

How to pass command line arguments to a Blender Python script?