It's allowed to follow an opening from a book or database but the moment
you or your opponent deviates then you are on your own.
These book/database moves are called 'opening theory' and it is constantly changing.
If you follow a line in a book then it's important for your own development as a
chess player that you understand the reason why a move is played and you
are not just playing it because someone else has.
(Opening theory is made up of other players moves and ideas).
Interesting game you had v draft6969. Game 7484257
You will be pleased to know you left recognised opening theory
round about move three.
There followed quite a few tactical blunders as both players were taking
pot-shots at each other. That's OK and is the norm when less experianced
players meet each other.
As you get better you will find your games do not stutter along with
one move ideas and pieces all fighting mini battles of their own but follow
a smooth series of a mini-plans with ALL your pieces working together.
And that is why players follow theory because it (usually) gets them
into the Middle Game (where all the real fun is) with their army still intact
and their pieces posted on active squares ready to attack or defend.
Back to game Game 7484257
Your opponent, though two pieces down, missed a mate in two
to give you a mate in one. It won't do you any harm if you went over
the game to see if you can spot his missed mate in two.