Think of a book as three parts, not one long file. The front matter introduces the book and proves it is a real book. The body is the book itself. The back matter is where you keep the reader after the last page. Readers never think about these pages by name, but they feel it at once when they are wrong: a book that opens with ten pages of thanks before the story starts, or one that ends dead, with no author bio and nowhere to go next.
Here is the front matter in the order publishers use it, following the Chicago Manual of Style and KDP's own help page. Few books have every part, and that is normal.
First, the half-title page: just the title, alone on a page. Print books often have one; ebooks usually skip it. Then the title page, with the full title, subtitle, author name, and publisher if you have one. Then the copyright page, on the back of the title page in print: the copyright notice, the year, the edition, your ISBN if the book has one, and a short line saying the work may not be reproduced without permission. Fiction adds one more line here, "This is a work of fiction", so no reader mistakes a character for a real person. After that comes the dedication, one or two lines, and the epigraph, a short quotation that sets the tone. Then the table of contents, then the foreword, the preface, the acknowledgments if you put them up front, and the introduction.
Three of those get mixed up, so here is the plain difference. A foreword is written by someone else, about why you and the book matter. A preface is written by you, about how and why the book came to exist. An introduction is also written by you, but it is about what the reader is going to get. Most nonfiction books need only the introduction. If you have all three, you almost certainly have two too many.
What you must have is short. For fiction, a title page, a copyright page and the story will do, with a dedication if you want one. For nonfiction, add a table of contents and an introduction. Everything else earns its place only if it helps the reader. A foreword from a nobody adds nothing. A preface that repeats the introduction wastes a page. And acknowledgments at the front should be short: thank people at length at the back, where readers who care will find them, not up front where every reader has to walk past them.
The table of contents deserves care because KDP checks it. In a print book it lists chapters with page numbers. In an ebook it must be a list of links, every entry tappable, landing on the right chapter, with no page numbers at all, because a reflowable book has no fixed pages. Do not build it as a table to line things up, and keep it to two levels at most, parts and chapters, or chapters and sections. Behind it, your file also needs the invisible navigation that feeds the Kindle "Go To" menu, which is built from your headings, so heading styles are not decoration: they are what makes the contents work. Our guide to formatting a book for KDP covers the heading and layout side in full.
Print and ebook differ in one more way that costs real readers. In print, front matter pages are traditionally numbered in small roman numerals, i, ii, iii, and page 1 starts again at the body, and the half-title and title pages always fall on right-facing pages with no page numbers or headers. In an ebook there are no pages, so there are no page numbers and no headers or footers. And keep the ebook front short on purpose. Amazon's free sample is a fixed slice of the start of the book, so every page of front matter is a page of sample spent on something other than the story or the argument. Worse, if the reading start point is set on your copyright page, a reader who taps "Go To, Beginning" lands on legal boilerplate instead of chapter one. Set the start point on chapter one.
Now the back matter, in the usual order. Acknowledgments if they are not at the front. Then the appendix, for material that supports the book but would have interrupted it: maps, timelines, worksheets, longer data. Then notes or endnotes, a glossary if your book uses special terms, and a bibliography if it draws on sources. Then the index, which matters for nonfiction in print and is usually skipped in ebooks. Then the about-the-author page, and the "also by" list.
The last pages are also the best selling space you own, and most self-published books waste them. A reader who has just finished your book is the most likely person in the world to buy your next one, so do not end on a blank page. Put a short review request right after the last chapter, one or two sentences, while the feeling is still warm. Then your about-the-author page, with a photo and a link to your website or mailing list; your Amazon Author Central page is where that same bio works for you on the store. Then the list of your other books, and a sample chapter of the next one if you have it. That order matters: ask for the review first, then show them where to go next, because a reader who leaves to look at another book may never come back to leave the review.
Two mistakes show up again and again. The first is front matter that never ends: praise pages, a long dedication, a foreword and a preface and an introduction, so the reader is ten pages in before the book starts. Cut it to what the reader needs. The second is a book with no back matter at all: the story ends, the file ends, and the reader closes the app with nowhere to go. Even three pages at the back, a review ask, an author bio and a list of your other books, turn a finished book into the start of the next sale.
Try it today: open your manuscript and list what sits before chapter one and after the last chapter. Keep the title page, the copyright page, the contents and anything that truly helps the reader, move the long thanks to the back, add the review ask and the author page if they are missing, and check the ebook contents links by tapping every entry before you upload.