Although bettas are known as fighting fish (and appropriately so), there are some other species that can be kept with them if you're interested in having a community tank rather than a single fish.
First, there are several things to keep in mind when cohabitating a betta with other fish species. Using a 10-gallon or larger aquarium is recommended, and offering numerous hiding areas and distinct territories can help a betta and other fish coexist. This can be accomplished with the use of live plants, aquarium decorations, caves, rocks, etc. Whatever decorations you choose, you'll want to arrange them in a manner that will help minimize aggression in the betta and offer the other fish places where they can retreat. Along with providing hiding spots, decorations can help break up the lines of sight for a betta and help other fish from becoming too stressed.
While the temperament of every betta will be different, there are some other species that typically are a safe bet to house with your betta.
Harlequin rasboras - these black and orange fish are easygoing and peaceful. A good fish for beginners, they reach an average length of about 2 inches.
Eyespot rasboras - these rasboras generally stay under an inch in length and will school with each other; they also need a group of six or more.
Kubotai rasboras - just as with the eyespot rasboras, the kubotai rasbora stays very small, about 3/4"", and is known to have a peaceful demeanor.
All of the rasboras listed above are schooling fish, and should be in a group of at least six fish; however, the bigger the school, the more at ease the fish will feel.
Neon tetras - these are easy to care for, colorful, and one of the most popular freshwater fish in the aquarium hobby. They are peaceful by nature and reach a size of just over an inch on average.
Ember tetras - these are active, remain small at less than an inch when full grown, and have a peaceful disposition. Their coloration especially stands out in planted aquariums.
Kitty tetras - More subdued in color than neons and embers, these are a peaceful fish that can grow up to about an inch and a quarter and hold their own with bettas.
Just as with the rasboras, the tetras listed above are also schooling fish. They do best in a group of at least 6, but the more, the merrier.
Otocinclus - this is a small catfish that is very peacefull and is known for helping to keep algae down in the tank. A schooling/shoaling species.
Cory cats - these are scavengers and also very popular fish. While size varies slightly by species, most of them will only get a little over 2 inches in length. They thrive in groups of at least 6.
Bristlenose pleco - while it's recommended to have a minimum tank size of 20 gallons for bristlenose plecos, they can make great betta tankmates if your betta is in a larger enclosure. The bristlenose pleco will typically reach around 4-5 inches when full grown. These are also scavengers with a very distinct look and lots of personality. This fish, however, does not need a school, though more than one in a tank is perfectly fine if desired.
Rosy loach - a peaceful, schooling fish that's very active; it is one of the smallest species of loach.
Kuhli loach - another fish that will happily scavenge for leftover food. The kuhli loach prefers sand in which to burrow. Because these are nocturnal and like to hide, it's a perfect housemate in most betta cases.
Dwarf chain loach - since these are active and need a group to thrive, they are also better in a larger aquarium (30 gallons minimum, with more room being a better option). They are likely to prey upon small shrimps and snails. Speaking of which.....
Mystery snail - a large snail species for the freshwater aquarium, these are always on the lookout for algae to consume! Along with algae, they will also search for leftover food and will help keep gravel, plants, and decorations cleaner.
Rabbbit snail - very peaceful and active large snails. These are slow to reproduce and have a very endearing appearance. Like most snails, they make great scavengers and will help cut down on algae.
Nerite snail - like the other snails listed, these are helpful in keeping your aquarium clean and are very peaceful. One advantage to a nerite snail is they can't breed in freshwater. If you're worried about having too many snails all of a sudden, this won't be an issue with a nerite. There are also many different types and patterns of nerite snails available.
Certain wild type livebearers, such as Endler's, limia, and black-chin, are often quite compatible with bettas, as they have a peaceful disposition and inhabit similar water parameters.
Pencilfish may work out, but these fish also tend to inhabit the top of the water column, so it likely would depend on the temperament of the specific betta.
Larger shrimp, such as bamboo or amano shrimp, may be tolerated, as they are usually in different areas of the aquarium and are generally too large to be eaten. Small shrimp housed with a betta will often become food.
Mexican dwarf crayfish have been housed successfully with betta fish as well, though young, very small ones may not be the best choice.
While some hobbyists will advise it's ok to put betta fish with dwarf clawed frogs, we don't recommend this. These frogs are timid and can be easily outcompeted for food or nipped at. Clawed frogs are also a poor choice as they become large enough to in turn eat the betta! In general, keeping amphibians with bettas is not ideal.
Fish that are too ""flashy"" are likely not ideal either, as they may be seen as competition and could become a target for the betta.
There are a number of fish and other critters a betta can coexist with peacefully if you'd like more than a single fish in your aquarium, provided you have enough space and keep their needs in mind as well. Always monitor new acquisitions during introduction and, of course, quarantine before adding to your betta aquarium when possible.
Bettas Need More Than Bowls - University of Illinois College of Veterinary Medicine