The Codex is a magical item divided into four parts, and it opens a portal to the realm of Realix.
Opening the realm of Realix
To open the portal of Realix, the four pieces of the Codex must be brought together and a spell needs to be used. The balance between Light and Darkness must be respected to open the portal (since Darkar needed Bloom) , which is why Darkar had Bloom kidnapped and turned her into Dark Bloom.
One Codex is hidden at Alfea-- protected by the pixie ,Concorda. Another is hidden at Cloud Tower-- Protected by the pixie,? Discorda. The third is at Red Fountain? --? Protected by the pixie,? Athena. The final Codex piece is hidden in Pixie Village? -- protected? by the pixie,? Ninfea.
Lord Darkar originally thought that the Codex was in the Pixie Village, but after gathering information through Karborg, his pet,? he found out that it consisted of four pieces: one in each of the three schools of Magix and a fourth piece in the Pixie Village. Each of these pieces were protected by a Guardian Pixie.
Throughout Season 2, Lord Darkar obtained the pieces of the Codex of Red Fountain, Cloud Tower and of the Pixie Village with the help of the Trix, while he got the Alfea Codex through Bloom, whom the clone of Avalon that Darkar had sent to Alfea had temporarily infecting her with a Dark Virus, turning her into Dark Bloom for the first time.
Faragonda had a copy of each Codex piece made after Lord Darkar's return in Season 2 as a precaution in case he managed to get hold of the pieces found in the three schools and at the Pixie Village, which indeed happened. When Lord Darkar kidnapped Bloom and turned her into Dark Bloom, he then opened the portal of Realix with her help and after entering that Realm sealed the Portal. Later, the Winx arrived to Darkar's Fortress in trying to save Bloom but were unable to enter Realix. The Guardian Pixies then used their Codex copies to open another Portal, but they had to solve the Puzzle of the Codex, which was a riddle they had to solve so as to open the Portal. The Puzzle was in the form of many color strips which had to be arranged in a specific pattern, which Stella did by following her fashion instinct and hence opening the Portal.