\documentclass{book}

\begin{document}

\frontmatter
\input{frontmatter}

\mainmatter
\input{chapters}

\appendix
\input{appendix}

\backmatter
\input{backmatter}

\end{document}