The Shire has a lot of written records kept by the different great Hobbit families.
In particular, the records that deal with the particular adventures in this book begin with the Red Book of Westmarch, a four-volume set bound in leather and written by Bilbo Baggins; Bilbo then gave these books to Frodo.
To these four volumes, other Hobbit members of the Fellowship have added commentaries and genealogies. (Not the most thrilling stuff.)
These volumes were copied for the descendants of Samwise Gamgee. The most important copy of the Red Book was done by a scribe in Gondor; it became known as the "Thain's Book."
It is an exact copy of the book Peregrin Took – a.k.a. Pippin – brought with him to Gondor when he retired during the Fourth Age.
This book contains "much that was later omitted or lost. In Minas Tirith [the capital city of Gondor] it received much annotation, and many corrections, especially of names, words, and quotations in the Elvish languages; and there was added to it an abbreviated version of those parts of The Tale of Aragorn and Arwen which lie outside the account of the War" (prologue.4.4). Translation: it's pretty comprehensive.
Meriadoc Brandybuck and Peregrin Took (remember them, they'll be back) each became heads of their great families.
Thus, they maintained huge libraries connecting the Hobbits to the lands of Rohan and Gondor.
Meriadoc has tried to keep records of the Elder Days, the first days of the Elves in Middle-earth.
But when Celeborn, the consort of Galadrial, passed to the Gray Havens, there with him "went the last living memory of the Elder Days in Middle-earth" (prologue.4.6).