The Hobbit (1937) is a novel written by J. R. R. Tolkien in the tradition of fairy tales, originally written as a children's story. It serves as a preface to The Lord of the Rings written later and sets the stage for that work.
It may be read as a bildungsroman in which Bilbo matures from an initially insular, superficial, and rather useless person to one who is versatile, brave, self-sufficient, and relied-upon by others when they are in need of assistance.
Tolkien, a professor, later recalled that the book's writing began from a single senseless sentence ("In a hole in the ground there lived a hobbit") scrawled on an exam paper he was grading. When he began, he did not intend to connect the story with the much more profound mythology he was working on (see The Silmarillion). We can witness the fact that Tolkien inteded it to be "only" a non-related fairy tale in his choice of names: Cockney names for the goblins, and Norse names for the dwarves rather than the Elvish names of the heroes of the Silmarillion.
However as Tolkien continued, he began to feel that the events of The Hobbit really could belong to the same universe as the Silmarillion. The appearance of Elrond and the mentioning of Gondolin (as well as other nameless hints) are proof of that. However Tolkien also left a lot of "loose ends" and gaps that he filled in by his much later Lord of the Rings.