Yes, you can compost directly inside an urban planter box, but it works best as trench composting rather than a traditional compost pile. In a small planter, you do not want a visible heap of scraps competing with your plants. Instead, dig a hole or trench about 8 to 12 inches deep, add a small amount of chopped fruit and vegetable scraps, coffee grounds, tea leaves, or crushed eggshells, then cover it fully with soil. Keep the spot at least a few inches away from plant stems and shallow roots.
To reduce odors, pests, and nutrient problems, balance each burying with brown materials such as shredded paper, dried leaves, or cardboard. Do not add meat, fish, dairy, oily foods, cooked sauces, pet waste, or diseased plants. These can attract animals and create smells in a balcony or courtyard. Bury scraps in different spots each time, and use only small amounts so the soil can break them down quickly.
Direct composting can feed soil microbes and worms, improve moisture retention, and reduce kitchen waste. However, fresh scraps can temporarily tie up nitrogen, heat up the soil, or become a home for pests if they are left uncovered. It is usually safer around established ornamental plants than around young seedlings or root crops that are close to harvest.
If your planter box is shallow, indoors, or very small, consider a separate worm bin or countertop compost system instead. Add only finished compost to the planter. If you compost directly in the box, start with a mature, well-drained planter, keep the soil moist but not soggy, and stop burying scraps near plants during extreme heat or freezing weather.
In short, yes—you can compost directly in an urban planter box, but treat it as a slow, buried soil-building method, not an open compost bin. With small amounts, good coverage, and the right materials, it can work well in a balcony, patio, or small-space garden.