Narrow-line Seyfert 1 galaxies (NLS1s) is one of the few classes of active galactic nuclei (AGN) harboring powerful relativistic jets and detected in $gamma$ rays. NLS1s are well-known X-ray sources. While in non-jetted sources the origin of this X-ray emission may be a hot corona surrounding the accretion disk, in jetted objects, especially beamed ones, the contribution of corona and relativistic jet is difficult to disentangle without a proper sampling of the hard X-ray emission. For this reason, we observed with textit{NuSTAR} the first four NLS1s detected at high energy $gamma$ rays. These data, along with textit{XMM-Newton} and textit{Swift/XRT} observations, confirmed that X rays originate both in the jet and in the accretion disk corona. Time variability in hard X rays furthermore suggests that, as observed in flat-spectrum radio quasars, the dissipation region during flares could change its position from source to source, and it can be located both inside and outside the broad-line region. We find that jetted NLS1s, and other blazars as well, seem not to follow the classical fundamental plane of black hole activity, which therefore should be used as a black hole mass estimator in blazars with extreme care only. Our results strengthen the idea according to which $gamma$-NLS1s are smaller and younger version of flat-spectrum radio quasars, in which both a Seyfert and a blazar component co-exist.