Works of fanfiction are rarely commissioned or authorized by the original work's owner, creator, or publisher; also, they are almost never professionally published. However, some owners of a published work open their universe to other writers. Star Trek and Star Wars are two examples of fictional universes that includes official fanfiction.
Fanfiction is defined by being both related to its subject's canonical fictional universe and simultaneously existing outside the canon of that universe. Most fanfiction writers assume that their work is read primarily by other fans and therefore tend to presume that their readers have knowledge of the canon universe (the world of the original work) in which their works are based.