Hey Pedrojuan, your best bet is to start with the development community and check out the resources they have there: https://github.com/tootsuite/mastodon
Also, I am going to need someone who is active at DiEM to take over the hosting and running of the d25 instance as I can no longer devote resources to it. Would you, or someone else from DiD, be interested in taking it over? It currently runs on a tiny instance at CloudScale at under ~€1/day.
This is my personal Mastodon.