This post describes how to build a very basic background map of the world with d3.js. Note that the same kind of code would work with any geospatial data stored in geojson format. You can see many other examples in the background map section of the gallery. This example works with d3.js v4 and v6
The Html part of the code just creates a div that will be modified by d3 later on.
In this example the world country boundaries are used. Data comes from here. They are provided at geojson format. If you have a shapefile format, visit the background map section to see how to proceed.