Harry Potter and the Methods of Rationality (HPMOR) is a Harry Potter fan fiction by Eliezer Yudkowsky, published on FanFiction.Net. It adapts the story of Harry Potter to explain complex concepts in cognitive science, philosophy, and the scientific method. Yudkowsky published HPMOR as a serial from February 28, 2010 to March 14, 2015, totaling 122 chapters and about 660,000 words.
Wikipedia
read it here
or here
available in 100+ languages !
Edit : I say it is much better than (canon) Harry Potter.
“I couldn’t act on moral considerations if they lacked the power to move me. …” HPMOR, chapt. 20