Peel onions and garlic, halve onions and cut them into thin slices. Chop garlic finely. Heat 2 tablespoons of oil in a frying pan. Fry the onions and garlic for 1-2 minutes. Add chili flakes and tomato paste and sauté for about 30 seconds while stirring.
Season with salt, pepper and 1 pinch of sugar. Spread evenly in an ovenproof dish.
Preheat oven (electric cooker: 200 °C/circulating air: 180 °C/gas: see manufacturer). Wash the tomatoes. Clean and wash the zucchini and eggplant. Cut the vegetables into 2-3 mm thin slices, then alternately layer them in the mould, close together like roof tiles.
Season with salt and pepper. Sprinkle with 6 tablespoons of olive oil. Cover the mould with aluminium foil and close well at the edge of the mould. Bake gratin in the hot oven for about 45 minutes.
Finely pluck the mozzarella with your hands. Remove aluminium foil and sprinkle mozzarella over the vegetables. Bake at the same temperature for about 15 minutes. Rémy's advice: Roasted baguette with a little olive oil and salt tastes delicious.