Wash and dry all the vegetables thoroughly. Slice the eggplant and zucchini lengthwise into thin strips and cut the peppers into large sections. Lightly brush everything with olive oil and season with salt and pepper.
Heat a grill pan or outdoor grill over medium-high heat. Grill the vegetables until tender with visible grill marks, turning them carefully to avoid breaking. Allow them to cool completely before assembling.
Place basil leaves, garlic, pine nuts, Parmesan cheese, and salt into a food processor. Blend while slowly adding olive oil until the mixture becomes smooth and creamy. Taste and adjust seasoning if needed.
Line a loaf pan or terrine mold with plastic wrap, leaving enough overhang on all sides. This makes removing the finished terrine much easier after chilling.
Start with a layer of grilled zucchini, followed by pesto, peppers, spinach, onions, and eggplant. Continue layering until all ingredients are used, gently pressing each layer down to remove air pockets.
Fold the plastic wrap over the top and lightly press the terrine. Refrigerate for at least two hours, or overnight for the best texture and flavor development.
Carefully invert the terrine onto a serving platter. Remove the plastic wrap and garnish with fresh basil leaves and a drizzle of pesto before slicing.