The key to maintaining a community for any length of time is interdependence. There are several different kinds of interdependence and ways of creating it. But without interdependence a community is no more than a social club, and as prone to falling apart from strife as any social club.
Some of the weaker forms of interdependence include Fantasy Interdependence, were the group is encouraged to imagine themselves striving together against an enemy or towards an important goal. Another weak form is Organization Interdependence where the people are put together in the same organizational structure and therefore have to work together. While these can be somewhat useful, stronger forms of interdependence will be necessary for the long term sustainability of any community.
One of the strongest forms of interdependence is Enemy Interdependence. This is where a group of people see themselves as being together against a common enemy. This is, as we all know, a very effective means of getting people to work together. However, it has several very real dangers. First, the interdependence is based on there being enemy. If the enemy goes away, so does the interdependence. Also, such a form of interdependence discourages dissent. Polite, well thought-out disagreement is vital for a community to be sufficiently adaptable to survive in the long term. Without it the community will stagnate, and when faced with a new problem, it will fall. But, when faced with a enemy it is easy to discard such disagreements until later, or worse, to consider all such disagreements as weakening the community, or strengthening the enemy. The third biggest problem with Enemy Interdependence is that sometimes the enemy wins.
The form of interdependence that has the potential to be the strongest is Need Interdependence. In this form the interdependence is created by the members of the community needing each other to obtain something they need. The more fundamental the need, the stronger the interdependence. So, if the community members need each other to obtain their necessities of life, it will be as strong as it can be. Assuming they aren’t in a spaceship and need each other for oxygen. This form of interdependence is most easily created by insisting on the community being self-sufficient. In other words, all of the needs of the members of the community (food, water, shelter, clothing, etc) are all made from beginning to end by the community itself. So if a member of the community wishes to rebel, they would be well advised to not go so far as to jeopardize the community, otherwise they may starve to death.
Interdependence is necessary to get communities through rough times, where it may otherwise be easier to simply quit. By removing the option of quitting, because their source of food comes from the community, the community members will maintain. Also, in the case of strong disagreement, all members of the community will be most interested in repairing the rift in the community, rather than winning. After all, what does it matter who “wins” if neither side will eat? The community must be maintained. This also changes the goal of handling “crime.” “Justice” ceases to be about punishing the guilty, and becomes primarily about healing the damage done to the community. Which may or may not involve punishing the guilty.