Yes, you can compost directly in an urban planter box, but it works best when you treat it as in-situ composting rather than filling the whole box with a traditional compost pile. This method is often called trench composting or direct composting. It is practical for balconies, patios, rooftops, and small city gardens if you have enough soil volume and outdoor airflow.
The basic idea is simple: dig a small trench or pocket in a corner of the planter, add fruit and vegetable scraps, coffee grounds, crushed eggshells, or small amounts of garden trimmings, then cover them with at least 6 to 8 inches of soil. Rotate the burial spot each time so you do not overload one area. The scraps break down slowly and feed the soil food web around your plants.
For best results, keep a balance. Add browns such as shredded paper, cardboard, dried leaves, or coco coir when the soil feels too wet or smells sour. Keep the planter moist but not soggy, and avoid burying scraps right against plant stems or shallow roots. If you have a worm-friendly planter, red wigglers can speed up decomposition, but they need stable moisture, shade, and a steady supply of organic matter.
Not everything belongs in an urban planter. Avoid meat, fish, dairy, oily foods, pet waste, and diseased plants, because they can attract pests, rodents, and odors. Also avoid large amounts of citrus, onions, or spicy food if worms are present. In a small indoor planter, direct composting may cause fungus gnats, mold, or smells, so a worm bin or bokashi system followed by burying the pre-composted material is often better.
The biggest mistake is adding too much fresh material at once. A planter is not a hot compost pile. If you bury more scraps than the soil can process, you may get anaerobic pockets, root damage, and unwanted visitors. Start small, bury pieces finely chopped, and wait until the previous scraps have mostly disappeared before adding more.
You can compost directly in an urban planter box successfully if you use moderation, cover scraps thoroughly, balance moisture and browns, and choose the right materials. It will not produce a large batch of finished compost quickly, but it can turn your planter into a slow, living soil system that reduces waste and feeds your plants.