Can you cast a bonus action spell and attack?

As a cleric can I do the following: cast level 1 healing word as a bonus action spell, draw my mace, move 20ft and then attack? Or as a paladin: cast thunderous smite, move 20ft, attack, move 10ft through a doorway and close the door shut.

Biggest question, can you cast a bonus action spell and attack?

I am having a hard time determining how a bonus action is created for spells. Does simply preparing a casting time 1 bonus action spell create either the bonus action or the scenario to use a bonus action?

My friend and I are trying to figure out how a bonus action is created as there are very few situations that explicitly state that something can be used as a bonus action. Spells do not explicitly state that the are being cast as a bonus action, but are cast at the speed of a bonus action for their casting time. At least thats how its being interpretted.

Are bonus actions always present or are they only created when a situation arises where you can use one?
Brainy Mike
PHB p. 189 “You can take a bonus action only when a special ability, spell, or other feature of the game states that you can do something as a bonus action. You otherwise don’t have a bonus action to take.”

“…and anything that deprives you of your ability to take actions also prevents you from taking a bonus action.”
So if action is prevented bonus action is not possible.
Here are some answers from Maser Jeremy
https://www.sageadvice.eu/2014/11/24/bonus-action-2/
https://www.sageadvice.eu/2014/09/06/action-and-bonus-action/

You’ve got it right . Bonus action cast if that’s the casting time , draw as part of move , action to attack . Same with paladin scenario if that smite is a bonus action . Yes you can use bonus and use a normal action to attack. You can even use a bonus action to cast , and cast again with your normal action , if the latter is a cantrip

Ranger spell components

Monster spellcasting ability casting time

Cleric marriage

Teleportation Circle on floating surface