It is generally not recommended to keep pea crabs in a standard aquarium, especially with other fish or invertebrates.
Why Not?
Pea crabs are scavengers and detritivores that may not thrive on a standard fish diet. They can become aggressive toward smaller tank mates and may have parasitic relationships with hosts. They are also small and difficult to maintain in captivity.
If You Try It
Use a dedicated tank with sand substrate and hiding places like rocks and coral. House them only with compatible species such as snails or shrimp. Provide algae, decaying matter, and occasional small pieces of fish or shrimp. Research the specific species carefully.
Keeping pea crabs is best left to experienced invertebrate keepers who can provide the right environment and diet.