International Code of Ethics for order of co-authors in research papers
The meaning of author order varies across fields. In some fields, authors are listed alphabetically. In others, the order reflects some sort of perceived contribution. Some people prefer to be the last author.

The only unified code, and it is unwritten at that, regarding author order, is to talk to your authors and be considerate to their feelings. It is academic misconduct to leave someone out as an author. Similarly, it is wrong to list someone who should not be an author. This means that it is up to everyone to decide. If your research group is so disfunctional that this is hard, have those conversations at the start. In fact, I advise everyone to have those conversations at the start and during the process just to keep hard feelings from developing.