Superconducting nanowire single-photon detectors promise efficient (∼100%) and fast (∼Gcps) detection of light at the single-photon level. They constitute one of the building blocks to realize integrated quantum optical circuits in a waveguide architecture. The optical response of single-photon detectors, however, is limited to measure only the presence of photons. It misses the capability to resolve the spectrum of a possible broadband illumination. In this work, we propose the optical design for a superconducting nanowire single-photon spectrometer in an integrated optical platform. We exploit a cascade of cavities with different resonance wavelengths side-coupled to a photonic crystal bus waveguide. This allows to demultiplex different wavelengths into different spatial regions, where individual superconducting nanowires that measure the presence of single photons are placed next to these cavities. We employ temporal coupled-mode theory to derive the optimal conditions to achieve a high absorption efficiency in the nanowire with fine spectral resolution. It is shown that the use of a mirror at the end of the cascaded system that terminates the photonic crystal bus waveguide increases the absorption efficiency up to unity, in principle, in the absence of loss. The expected response is demonstrated by full-wave simulations for both two-dimensional and three-dimensional structures. Absorption efficiencies of about 80% are achieved both in two-dimensional structures for four cascaded cavities and in three-dimensional structures for two cascaded cavities. The achieved spectral resolution is about 1 nm. We expect that the proposed setup, both analytically studied and numerically demonstrated in this work, offers a great impetus for future quantum nanophotonic on-chip technologies. arXiv:1908.01681v1 [physics.optics]