The Japanese term for independently-published works of entertainment media, such as comics, animation, music, and video games.
A large part of the doujinshi community involves the creation of fanworks - unofficial works based on (e.g. borrowing settings, characters, themes, or music from) pre-existing copyrighted material - rather than original creations.
A large portion of fanworks, in turn, contain explicit sexual content ("ero"), which is usually not found in the original material. Most of these are comics.
For tagging purposes on Danbooru, doujinshi refers to images which are scans of fan-comics. The rating:e tag should suffice to differentiate erotic doujinshi from the more mainstream ones.