(written from a Production point of view)
Fan fiction is a name given to any fictional story or material based in and around the Star Trek universe, that is not produced with the input of the creators or licensees who create new Star Trek material for Paramount Pictures. Although the most common form is in prose, similar to the various novels, it can also come under the form of scripts, poetry, reference material, games, audio recordings, and films.
It is illegal to buy or sell "fan-produced" memorabilia for profit, due to the copyrights of the name Star Trek, in addition to the copyrights of the major names involved, being owned by Paramount. Despite this, some fans take it upon themselves to create their own versions of Trek on a "not-for-profit" basis.
A related concept is "fanon", a contraction for "fan canon". Fanon is a belief held by fans that is not canon. Fanon can range from discounting part of Star Trek as non-canon to making up a explanation for unexplained inconsistencies such as the differing appearance of the Trill.
In the mid-1970s, Star Trek Lives! was published by Bantam Books documenting the fan culture around Star Trek. In the late 1990s a film, Trekkies, was released documenting the fan culture twenty years later.
In the early days of fan fiction, the easiest way for fans to read, and circulate, their works was through fanzine or folios. Some of these fan productions were even used in Star Trek productions, such as pages of fan-published reference manuals being used on screen as background artwork, and some were created by authors who went on to work on legitimate Star Trek productions. Paramount has even supported the professional publication of fan fiction through their The New Voyages, The New Voyages 2, and Strange New Worlds series of books.
Franz Joseph was one of the first to publish fan reference material starting in 1973 when he created and published his blueprints Booklet of General Plans – USS Constitution-class for the USS Enterprise. His blueprints were used in a number of the early Star Trek films. Other creators that began with fan publications include Rick Sternbach, an illustrator for Star Trek: The Motion Picture and the spin-off series, and Geoffrey Mandel, a scenic artist on Star Trek: Voyager, Star Trek: Enterprise, and Star Trek: Insurrection.
Kirk, Spock, and the creation of Slash
The friendship between Kirk and Spock created a subculture of Star Trek fans who believed the relationship between the two to be not merely platonic, but explicitly romantic – in 1974, the short story "A Fragment out of Time" by author Diane Marchant was the first explicitly sexual fanfiction piece featuring two men to be published in a fanzine, although they were not mentioned by name. In the next edition of that fanzine, Marchant confirmed that the two men were Kirk and Spock and wrote an essay defending the pairing.
Gene Roddenberry's novelization of Star Trek: The Motion Picture, revealed that Spock thought of Kirk as his "t'hy'la", a Vulcan word meaning "friend/brother/lover." When asked about this possibility, the actors and Roddenberry neither confirmed nor denied this interpretation. Gene Roddenberry, when interviewed for the authorized William Shatner biography Shatner: Where No Man..., was asked about comparisons between Kirk and Spock and the historical relationship of Alexander the Great and his friend and sometime second-in-command Hephaestion, two men widely believed to have been lovers. He replied:
- "Yes, there's certainly some of that, certainly with love overtones. Deep love. The only difference being, the Greek ideal... we never suggested in the series... physical love between the two. But it's the... we certainly had the feeling that the affection was sufficient for that, if that were the particular style of the 23rd century." (He looks thoughtful.) "That's very interesting. I never thought of that before." (Shatner: Where No Man..., p. 148)
The notion of "slash" as a genre – or the idea that certain relationships between two men or women in popular films, television shows, and literature are subtextually homoerotic – has since spread to fans of other entertainment media.
Another major concept that originated in Star Trek fan fiction was the idea of a Mary Sue. This was an original character, stereotypically an adolescent girl, written as if it were an insertion of the writer in some sort of wish-fulfillment fantasy. A Mary Sue character would often be exceptional in many ways, have Kirk, Spock and/or McCoy fawning over her, and save the day in some unrealistic way. In short, she would just implausibly have everything going for her and be the center around which the whole ship revolves.
The name originated from the short parody story in the fanzine "Menagerie", "A Trekkie's Tale".  Writer Paula Smith had observed the trend towards including such characters in fan fiction stories, and stirred up considerable sentiment with her lampshading of the phenomenon. Contemporary opinions on Mary Sue characters ranged from not seeing anything wrong with it to passionate hate. When deliberately invoked, the concept is subject to ridicule.
The term remains widely known to this day and has spread far beyond Star Trek fan fiction circles, to all kinds of fan fiction and regular fiction. The definition of what constitutes a Mary Sue is very fluid, and has sometimes even be used to decry strong and capable characters intended to be likable but not received as such.
The concept came full circle when Wesley Crusher became criticized for being a Mary Sue by some, because, among other things, he was serving on the Enterprise at an unusually young age and shared Gene Roddenberry's middle name.
One contemporary example of the Mary Sue character would be the alternate-reality based webcomic parody "Ensign Sue Must Die!".
Some fan-produced games have joined into licensing agreements with Paramount including Star Trek: A Call to Duty and the Star Trek Simulation Forum. The Simulation Forum was created in 2002 as the official chat based role-playing game of StarTrek.com but had lost its official affiliation by late 2007.
One of the more recent phenomena in fan fiction is the fan film. These films vary in length from short clips to full episodes, some even comprising of several seasons of episodes. In the past, production technology and cost were major limitations to amateur projects, but in more recent times, films can be distributed cheaply via the internet (most notably the video-sharing website YouTube), and convincing visual effects can be created as CGI using home computers. Some of these productions are popular enough to have some former Star Trek cast and crew lend their support, with the 2008 fan film Star Trek: Of Gods and Men not only being an early, but also a prime example of such supported films. Alec Peters' Star Trek: Axanar, as of 2019 yet to be released, is slated to become another one of such films.
In addition to films, a number of spinoff Star Trek fan series exist(ed) including Star Trek: Hidden Frontier (2000-2007, one of the earliest and longest running ones), James Cawley's Star Trek: Phase II (né Star Trek: New Voyages, 2004- , also served by several former Star Trek alumni both cast and crew), Star Trek Continues (2013-2017), and Star Trek: Renegades (2015- ). One of the least known of these was Star Trek: Aurora (2006-2015), an early computer animated mini-series that did not deal with Starfleet, but rather with the two-woman crew of a small space tramp freighter. The fan production is mentionable as CBS Studios had in 2019 a similarly-conceived – as in dealing with "the little people" of the Star Trek universe – animated production in development, tentatively called Star Trek: Lower Decks.
Former Star Trek franchise owner Paramount has tolerated non-profit fan films in the past, but subsequent owner CBS increasingly and more stringently views fan films as an infringement of their copyright as of late, especially the by-them-deemed for-profit ones. By 2015, non-profit fan films were still permitted – that is, on paper at least – but unlike Paramount, who declined to do so when Of Gods and Men DVDs and Blu-ray Discs were sold through the fan film's website, CBS formally declared war on the phenomenon when it filed an injunction against the film Star Trek: Axanar, which paid its producer with funds generated from crowdfunding.  Star Trek Beyond director Justin Lin expressed outrage at the lawsuit, with J.J. Abrams later announcing the case would be dropped and that CBS and Paramount were working on a new set of guidelines for fan films. 
On 23 June 2016, StarTrek.com announced fan film guidelines in a short letter to the public.  Axanar producer Alec Peters responded that the guidelines were too restrictive, effectively canning the project due to the limits imposed on fan film running times and budgets. Despite Abrams' May 2016 assertions to the contrary, the lawsuit remained pending.   CBS' guidelines however, has caused the producers of Renegades to dispense with the Star Trek pedigree altogether,  whereas those of Star Trek Continues decided to stay in front of any potential legal litigation by cutting their series short to eleven episodes, terminating production in 2017.
In 2017, it was announced that CBS was launching a training school to enable and teach future Star Trek fan film makers. A somewhat ironic and hitherto unheard of deal was struck with James Cawley by having his Ticonderoga, New York-based Star Trek: Phase II assets slated to become the "official" training grounds, coined the "Star Trek Film Academy".  Nonetheless, Cawley's own website indicates that the "academy" still has to come to fruition as of 2019,  whereas the franchise itself observes a complete blackout on the subject matter, making it debatable how sincere the franchise's intents had been to begin with, if at all. Indicative of the latter is that production on additional Star Trek: Phase II episodes seems to have been terminated as well as of 2019 – their last completed production was in 2016, with the development of three subsequent episodes "put on hold indefinitely" (a motion picture industry euphemism for "cancelled") because of the guidelines, and removed from their website, no longer mentioned.
The CBS crackdown on the phenomenon has all the hallmarks of the two-decades-long fan-produced Star Trek film/series era drawing to a close. Nonetheless, it was in the wake of the publication of the guidelines, that CBS finally agreed to drop the lawsuit against Anaxar in January 2017, provided Peters adhered to the stipulations expressed therein.  
- Star Trek Expanded Universe – a wiki that collects information about and from various fan-made projects, including RPGs, fan fiction, and fan movies
- Memory Gamma – the wiki for writing Star Trek fan fiction
- Fan fiction at StarTrek.com, the official Star Trek website – a listing of various fan reference sites (including Memory Alpha)
- Before Home Video, Science-Fiction Fans Worked Harder to Keep Fandom Alive at StarTrek.com, the official Star Trek website
- Fan film at Wikipedia
- Fan fiction at Wikipedia
- Slash fiction at Wikipedia