Recently we have upgraded Sitecore to 10.2. For code generation we have implemented 'Leprechaun' and code is being generated fine. But I want to know if 'Leprechaun' is recommended by Sitecore. If no, then what is the preferred way of code/model generation apart from TDS in Sitecore 10.2? and if there is any video or article available for the same. Can anyone please help me with that?

  • There is no recommended way to do code generation from Sitecore. Closing this as it would be entirely opinion based.
    – Richard Seal
    Commented Oct 21, 2022 at 17:14

1 Answer 1


Leprechaun is an open API code generator from Sitecore Content Serialized or from Unicorn serialized items. The leprechaun can be run at build-time with a pre-build step or with CLI.

Leprechaun uses state-of-the-art Roslyn code generation technology instead of T4 templates for a speedy generation that doesn't require Visual Studio.

Why should I use Leprechaun?

It's Really Flexible

Leprechaun uses C# Script files as templates. If you're familiar with C#, it's a breeze. Out of the box, a Synthesis script file is provided, but it can easily be adapted to generate templates Glass, Fortis, or more! The template is essentially a big StringBuilder that you can build out however you like and Leprechaun will fill in the rest.

It Can Be Run at Build-Time

Sick of trying to resolve merge conflicts in gigantic model files? You don't need to do that anymore with Leprechaun. The outputted model files don't have to be checked into source control at all!

Why not?

Leprechaun generates models based off of the yaml files outputted by Rainbow. Since these yaml files are on disk already, there's no need for Sitecore to be running or for Visual Studio to be open in order to generate the models. Without these dependencies, you can generate models as a pre-build step.

It's Helix-Friendly

Most everything in Leprechaun is config-based. The base Leprechaun.config (for Rainbow, for Sitecore Serialization) file contains everything needed for Leprechaun to get started for a single project. However, these configs can be extended and overridden. For each module you have, create a CodeGen.config file and have it extend another config.

It’s a Helix-friendly code generator which was really important during the upgrade.

So yes it is good to use as it is Sitecore friendly.

For the git repo, you can visit here - https://github.com/blipson89/Leprechaun

Not the answer you're looking for? Browse other questions tagged or ask your own question.