Building a terrarium is a great project that allows you to attempt to create an isolated ecosystem. In most cases, it is difficult to create a self-sustaining ecosystem, but it is definitely possible.
The first step in building a terrarium is to decide what sort of container you will utilize. There are many options available, ranging from glass or acrylic aquariums to open basins. You should consider what kind of creatures you wish to house in your terrarium before choosing a container, since you probably don't want any escaping. The most popular choice is the glass aquarium since it is durable, easy to clean, transparent, and serves as an insulator. You will also have to decide on a size. A 75 gallon aquarium will obviously hold a lot more creatures than a 5 gallon.
Once you have your aquarium, you will have to decide what sort of substrate you want to use. If you are planning on building a terrarium with desert creatures, you should fill it with sand. If you want creatures from a more temperate climate, you should fill the bottom of the terrarium with soil. If you are using soil, it is a good idea to add earthworms to help keep the soil fresh.
If you want to add a pool of water to the terrarium, now is a good time to do it. It is best to use a metal or plastic container to hold the water in place since it will probably drain into the rest of the substrate otherwise. The water will allow you to add amphibians and provide an easily-accessed source of water for other creatures.
Now that you have your substrate in place, you can add plants. You should choose plants that match the substrate, since temperate plants probably won't fare well in sand. You might want to only add plants to the rear of the terrarium in order to increase visibility.
If you are planning to add creatures that need heat, you should install heat lamps that hang inside the terrarium. If you have plants, you should place the terrarium near a window or add adequate artificial fluorescent lighting. If you are planning on having flying insects, you should add a metal screen cover to the top of the terrarium.
Now is the time to start adding animals. If you plan to add ants, you should do it right away so they have time to establish a colony, otherwise they could be eaten by predators right away. Next, you can add whatever other animals you want. Try to avoid overcrowding since it decreases the probability of a predator-prey ecosystem achieving self-sustenance.
If your ecosystem fails, don't despair. Make sure that the lifeforms are getting everything that they need to survive and there is enough prey to reproduce faster than they are consumed by predators. Once you have your terrarium going, you won't have to put much more work into it and you will have more time to enjoy it.